From cd5335ddec421b4aa921c26fc02fb400dc08867f Mon Sep 17 00:00:00 2001 From: nathan Date: Wed, 15 Jun 2016 20:56:19 -0700 Subject: [PATCH] max7456 driver io tags, moved some sirin #defines out (they're in common now) --- src/main/drivers/max7456.c | 12 ++++++++++-- src/main/target/SIRINFPV/target.h | 9 ++------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/main/drivers/max7456.c b/src/main/drivers/max7456.c index 57874fbf3..06af3ccb2 100644 --- a/src/main/drivers/max7456.c +++ b/src/main/drivers/max7456.c @@ -31,8 +31,10 @@ #include "max7456.h" -#define DISABLE_MAX7456 GPIO_SetBits(MAX7456_CS_GPIO, MAX7456_CS_PIN) -#define ENABLE_MAX7456 GPIO_ResetBits(MAX7456_CS_GPIO, MAX7456_CS_PIN) +#define DISABLE_MAX7456 IOHi(max7456CsPin) +#define ENABLE_MAX7456 IOLo(max7456CsPin) + +static IO_t max7456CsPin = IO_NONE; /** PAL or NTSC, value is number of chars total */ #define VIDEO_MODE_PIXELS_NTSC 390 @@ -57,6 +59,12 @@ void max7456_init(uint8_t system) { uint16_t x; char buf[30]; +#ifdef MAX7456_SPI_CS_PIN + max7456CsPin = IOGetByTag(IO_TAG(MAX7456_SPI_CS_PIN)); +#endif + IOInit(max7456CsPin, OWNER_SYSTEM, RESOURCE_SPI); + IOConfigGPIO(max7456CsPin, SPI_IO_CS_CFG); + //Minimum spi clock period for max7456 is 100ns (10Mhz) spiSetDivisor(MAX7456_SPI_INSTANCE, SPI_9MHZ_CLOCK_DIVIDER); diff --git a/src/main/target/SIRINFPV/target.h b/src/main/target/SIRINFPV/target.h index 0fb5ac2fd..7b98c9061 100644 --- a/src/main/target/SIRINFPV/target.h +++ b/src/main/target/SIRINFPV/target.h @@ -109,9 +109,8 @@ #define SPI3_MOSI_PIN PB5 #define USE_MAX7456 -#define MAX7456_CS_GPIO GPIOA -#define MAX7456_CS_PIN GPIO_Pin_15 -#define MAX7456_SPI_INSTANCE SPI3 +#define MAX7456_SPI_INSTANCE SPI3 +#define MAX7456_SPI_CS_PIN PA15 #define USE_RTC6705 #define RTC6705_SPIDATA_GPIO GPIOC @@ -155,11 +154,7 @@ #define VBAT_ADC_CHANNEL ADC_Channel_1 //#define USE_QUAD_MIXER_ONLY -#define BLACKBOX #define ENABLE_BLACKBOX_LOGGING_ON_SDCARD_BY_DEFAULT -#define TELEMETRY -#define SERIAL_RX -#define USE_CLI #define OSD #define CONFIG_FASTLOOP_PREFERRED_ACC ACC_DEFAULT