From 070b556a07095bb3452a5619f35853f81aad7c8f Mon Sep 17 00:00:00 2001 From: Dominic Clifton Date: Sun, 22 Feb 2015 21:40:29 +0000 Subject: [PATCH] Enable blackbox flash logging only on SPRacingF3 and Naze rev5 targets. --- Makefile | 2 ++ src/main/main.c | 10 +++++++--- src/main/target/SPRACINGF3/target.h | 22 ++++++++++++++++++++-- 3 files changed, 29 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 0f1945e41..f3f29edd4 100644 --- a/Makefile +++ b/Makefile @@ -504,6 +504,8 @@ SPRACINGF3_SRC = \ drivers/barometer_ms5611.c \ drivers/compass_hmc5883l.c \ drivers/display_ug2864hsweg01.h \ + drivers/flash_m25p16.c \ + io/flashfs.c \ $(HIGHEND_SRC) \ $(COMMON_SRC) diff --git a/src/main/main.c b/src/main/main.c index 8d64a1cc9..7e530b3f3 100644 --- a/src/main/main.c +++ b/src/main/main.c @@ -365,10 +365,14 @@ void init(void) #endif #ifdef USE_FLASHFS - #ifdef NAZE - // naze32 rev5 and above have 16mbit of flash available +#ifdef NAZE + if (hardwareRevision == NAZE32_REV5) { m25p16_init(); - #endif + } +#endif +#ifdef SPRACINGF3 + m25p16_init(); +#endif flashfsInit(); #endif diff --git a/src/main/target/SPRACINGF3/target.h b/src/main/target/SPRACINGF3/target.h index 712165643..0114f9c43 100644 --- a/src/main/target/SPRACINGF3/target.h +++ b/src/main/target/SPRACINGF3/target.h @@ -45,6 +45,9 @@ #define USE_MAG_HMC5883 #define MAG_HMC5883_ALIGN CW270_DEG +#define USE_FLASHFS +#define USE_FLASH_M25P16 + #define BEEPER #define LED0 @@ -81,8 +84,23 @@ #define USE_I2C #define I2C_DEVICE (I2CDEV_1) // PB6/SCL, PB7/SDA -//#define USE_SPI -//#define USE_SPI_DEVICE_2 // PB12,13,14,15 on AF5 +#define USE_SPI +#define USE_SPI_DEVICE_2 // PB12,13,14,15 on AF5 + +#define SPI2_GPIO GPIOB +#define SPI2_GPIO_PERIPHERAL RCC_AHBPeriph_GPIOB +#define SPI2_NSS_PIN Pin_12 +#define SPI2_NSS_PIN_SOURCE GPIO_PinSource12 +#define SPI2_SCK_PIN Pin_13 +#define SPI2_SCK_PIN_SOURCE GPIO_PinSource13 +#define SPI2_MISO_PIN Pin_14 +#define SPI2_MISO_PIN_SOURCE GPIO_PinSource14 +#define SPI2_MOSI_PIN Pin_15 +#define SPI2_MOSI_PIN_SOURCE GPIO_PinSource15 + +#define M25P16_CS_GPIO GPIOB +#define M25P16_CS_PIN GPIO_Pin_12 +#define M25P16_SPI_INSTANCE SPI2 #define USE_ADC -- 2.11.4.GIT