summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2013-04-25 21:25:12 -0700
committerKeith Packard <keithp@keithp.com>2018-04-26 19:33:48 -0700
commit4c37ccc63d37ff0a4382f6812060d3c5fd4b6cfb (patch)
tree5c473dee1a7f0487fa36844815929a492363d1b7
parentf517aa5e042af8dd7fd36be47e4b196f212e79b0 (diff)
altos/fox: Add MRAM and SD card drivers
Signed-off-by: Keith Packard <keithp@keithp.com>
-rw-r--r--src/fox1ihu/Makefile8
-rw-r--r--src/fox1ihu/ao_fox1ihu.c3
-rw-r--r--src/fox1ihu/ao_pins.h22
3 files changed, 27 insertions, 6 deletions
diff --git a/src/fox1ihu/Makefile b/src/fox1ihu/Makefile
index d702cca8..aa5c6b4a 100644
--- a/src/fox1ihu/Makefile
+++ b/src/fox1ihu/Makefile
@@ -15,6 +15,9 @@ INC = \
ao_storage.h \
ao_task.h \
stm32l.h \
+ ao_sdcard.h \
+ ao_bufio.h \
+ ao_fat.h \
Makefile
#PROFILE=ao_profile.c
@@ -45,7 +48,10 @@ ALTOS_SRC = \
ao_adc_stm.c \
ao_data.c \
ao_storage.c \
- ao_m25.c \
+ ao_mr25.c \
+ ao_sdcard.c \
+ ao_bufio.c \
+ ao_fat.c \
ao_watchdog.c
PRODUCT=Fox1IHU-v1
diff --git a/src/fox1ihu/ao_fox1ihu.c b/src/fox1ihu/ao_fox1ihu.c
index 5bbad328..2e1a2fdf 100644
--- a/src/fox1ihu/ao_fox1ihu.c
+++ b/src/fox1ihu/ao_fox1ihu.c
@@ -19,6 +19,7 @@
#include <ao_exti.h>
#include <ao_watchdog.h>
#include <ao_storage.h>
+#include <ao_fat.h>
int
main(void)
@@ -48,6 +49,8 @@ main(void)
ao_watchdog_init();
+ ao_fat_init();
+
ao_start_scheduler();
return 0;
}
diff --git a/src/fox1ihu/ao_pins.h b/src/fox1ihu/ao_pins.h
index f901a96b..028360a5 100644
--- a/src/fox1ihu/ao_pins.h
+++ b/src/fox1ihu/ao_pins.h
@@ -70,10 +70,13 @@
#define SPI_1_PA5_PA6_PA7 0
#define SPI_1_PB3_PB4_PB5 0
#define SPI_1_PE13_PE14_PE15 1 /* */
+#define SPI_1_OSPEEDR STM_OSPEEDR_10MHz
-#define HAS_SPI_2 0
+#define HAS_SPI_2 1
#define SPI_2_PB13_PB14_PB15 1 /* */
#define SPI_2_PD1_PD3_PD4 0
+#define SPI_2_OSPEEDR STM_OSPEEDR_10MHz
+#define HAS_STORAGE_DEBUG 1
#define SPI_2_PORT (&stm_gpiob)
#define SPI_2_SCK_PIN 13
@@ -252,9 +255,18 @@ struct ao_adc {
/* MRAM device */
-#define M25_MAX_CHIPS 1
-#define AO_M25_SPI_CS_PORT (&stm_gpiod)
-#define AO_M25_SPI_CS_MASK (1 << 0)
-#define AO_M25_SPI_BUS AO_SPI_2_PB13_PB14_PB15
+#define AO_MR25_SPI_CS_PORT (&stm_gpiod)
+#define AO_MR25_SPI_CS_PIN 0
+#define AO_MR25_SPI_BUS AO_SPI_2_PB13_PB14_PB15
+
+/* SD card */
+
+#define AO_SDCARD_SPI_CS_PORT (&stm_gpiod)
+#define AO_SDCARD_SPI_CS_PIN 1
+#define AO_SDCARD_SPI_BUS AO_SPI_2_PB13_PB14_PB15
+#define AO_SDCARD_SPI_PORT (&stm_gpiob)
+#define AO_SDCARD_SPI_SCK_PIN 13
+#define AO_SDCARD_SPI_MISO_PIN 14
+#define AO_SDCARD_SPI_MOSI_PIN 15
#endif /* _AO_PINS_H_ */