altos/fox: Enable M25 driver for MRAM.
authorKeith Packard <keithp@keithp.com>
Thu, 21 Mar 2013 17:16:35 +0000 (10:16 -0700)
committerKeith Packard <keithp@keithp.com>
Fri, 27 Apr 2018 02:33:48 +0000 (19:33 -0700)
The M25 driver can also talk to the MRAM chip, with a few adjustments

Signed-off-by: Keith Packard <keithp@keithp.com>
src/fox1ihu/Makefile
src/fox1ihu/ao_fox1ihu.c
src/fox1ihu/ao_pins.h

index 94315e794420bda28b11b5b73e99bcfad8c4f3c4..d702cca8a458ca733d69427d3d502f6e112f4cb6 100644 (file)
@@ -11,6 +11,8 @@ INC = \
        ao_arch_funcs.h \
        ao_pins.h \
        ao_product.h \
+       ao_watchdog.h \
+       ao_storage.h \
        ao_task.h \
        stm32l.h \
        Makefile
@@ -42,6 +44,8 @@ ALTOS_SRC = \
        ao_exti_stm.c \
        ao_adc_stm.c \
        ao_data.c \
+       ao_storage.c \
+       ao_m25.c \
        ao_watchdog.c
 
 PRODUCT=Fox1IHU-v1
index 9f7821f7916451b10c8abe978f07821ecd69f2e3..5bbad3281bb9c5f93ffe0c9b3681a99e3b6b19fa 100644 (file)
@@ -17,8 +17,8 @@
 
 #include <ao.h>
 #include <ao_exti.h>
-#include <ao_packet.h>
-#include <ao_send_packet.h>
+#include <ao_watchdog.h>
+#include <ao_storage.h>
 
 int
 main(void)
@@ -44,6 +44,8 @@ main(void)
 
        ao_usb_init();
 
+       ao_storage_init();
+
        ao_watchdog_init();
 
        ao_start_scheduler();
index e73ef63ad116b3bd39f6118e2b7205ea1a71adca..f901a96b3579120238fd85a4cdb08a12756135e5 100644 (file)
@@ -250,4 +250,11 @@ struct ao_adc {
 #define AO_WATCHDOG_PORT       (&stm_gpiod)
 #define AO_WATCHDOG_BIT                3
 
+/* 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
+
 #endif /* _AO_PINS_H_ */