altos/fox: Add MRAM and SD card drivers
authorKeith Packard <keithp@keithp.com>
Fri, 26 Apr 2013 04:25:12 +0000 (21:25 -0700)
committerKeith Packard <keithp@keithp.com>
Fri, 27 Apr 2018 02:33:48 +0000 (19:33 -0700)
Signed-off-by: Keith Packard <keithp@keithp.com>
src/fox1ihu/Makefile
src/fox1ihu/ao_fox1ihu.c
src/fox1ihu/ao_pins.h

index d702cca8a458ca733d69427d3d502f6e112f4cb6..aa5c6b4a8a3c606b59e02d404c6e608696fb90c4 100644 (file)
@@ -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
index 5bbad3281bb9c5f93ffe0c9b3681a99e3b6b19fa..2e1a2fdfe6a81d092fb5751c37f8caad380de5e5 100644 (file)
@@ -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;
 }
index f901a96b3579120238fd85a4cdb08a12756135e5..028360a50a5ac53f463fbf8dc21ad66edf2e01b2 100644 (file)
 #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_ */