From 4c37ccc63d37ff0a4382f6812060d3c5fd4b6cfb Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Thu, 25 Apr 2013 21:25:12 -0700 Subject: [PATCH] altos/fox: Add MRAM and SD card drivers Signed-off-by: Keith Packard --- src/fox1ihu/Makefile | 8 +++++++- src/fox1ihu/ao_fox1ihu.c | 3 +++ src/fox1ihu/ao_pins.h | 22 +++++++++++++++++----- 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 #include #include +#include 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_ */ -- 2.30.2