diff --git a/radio/src/targets/taranis/aspi.h b/radio/src/targets/taranis/aspi.h index a3f4f829f..6a17c8391 100644 --- a/radio/src/targets/taranis/aspi.h +++ b/radio/src/targets/taranis/aspi.h @@ -1,6 +1,6 @@ /** ****************************************************************************** - * @file Project/spi/spi.h + * @file Project/spi/spi.h * @author FrSky Application Team * @Hardware version V0.2 * @date 11-July-2012 @@ -19,20 +19,20 @@ extern "C" { #define __no_operation __NOP -#define LCD_NCS_HIGH() GPIO_LCD->BSRRL = PIN_LCD_NCS -#define LCD_NCS_LOW() GPIO_LCD->BSRRH = PIN_LCD_NCS +#define LCD_NCS_HIGH() GPIO_LCD_NCS->BSRRL = PIN_LCD_NCS +#define LCD_NCS_LOW() GPIO_LCD_NCS->BSRRH = PIN_LCD_NCS -#define LCD_A0_HIGH() GPIO_LCD->BSRRL = PIN_LCD_A0 -#define LCD_A0_LOW() GPIO_LCD->BSRRH = PIN_LCD_A0 +#define LCD_A0_HIGH() GPIO_LCD_SPI->BSRRL = PIN_LCD_A0 +#define LCD_A0_LOW() GPIO_LCD_SPI->BSRRH = PIN_LCD_A0 -#define LCD_RST_HIGH() GPIO_LCD->BSRRL = PIN_LCD_RST -#define LCD_RST_LOW() GPIO_LCD->BSRRH = PIN_LCD_RST +#define LCD_RST_HIGH() GPIO_LCD_RST->BSRRL = PIN_LCD_RST +#define LCD_RST_LOW() GPIO_LCD_RST->BSRRH = PIN_LCD_RST -#define LCD_CLK_HIGH() GPIO_LCD->BSRRL = PIN_LCD_CLK -#define LCD_CLK_LOW() GPIO_LCD->BSRRH = PIN_LCD_CLK +#define LCD_CLK_HIGH() GPIO_LCD_SPI->BSRRL = PIN_LCD_CLK +#define LCD_CLK_LOW() GPIO_LCD_SPI->BSRRH = PIN_LCD_CLK -#define LCD_MOSI_HIGH() GPIO_LCD->BSRRL = PIN_LCD_MOSI -#define LCD_MOSI_LOW() GPIO_LCD->BSRRH = PIN_LCD_MOSI +#define LCD_MOSI_HIGH() GPIO_LCD_SPI->BSRRL = PIN_LCD_MOSI +#define LCD_MOSI_LOW() GPIO_LCD_SPI->BSRRH = PIN_LCD_MOSI void AspiCmd(u8 Command_Byte); void AspiData(u8 Para_data); diff --git a/radio/src/targets/taranis/hal.h b/radio/src/targets/taranis/hal.h index ef6bfa74b..655598944 100644 --- a/radio/src/targets/taranis/hal.h +++ b/radio/src/targets/taranis/hal.h @@ -225,14 +225,28 @@ #define GPIOBL GPIOB #define GPIO_PinSource_BL GPIO_PinSource8 -// LCD GPIOD 10-14 -#define RCC_AHB1Periph_LCD RCC_AHB1Periph_GPIOD -#define GPIO_LCD GPIOD -#define PIN_LCD_MOSI GPIO_Pin_10 //PD.10 -#define PIN_LCD_CLK GPIO_Pin_11 //PD.11 -#define PIN_LCD_NCS GPIO_Pin_14 //PD.14 -#define PIN_LCD_A0 GPIO_Pin_13 //PD.13 -#define PIN_LCD_RST GPIO_Pin_12 //pd12 test //RESET occurs when powered up,but should delay before initialize +// LCD +#if defined(REVPLUS) + #define RCC_AHB1Periph_LCD RCC_AHB1Periph_GPIOA | RCC_AHB1Periph_GPIOC | RCC_AHB1Periph_GPIOD + #define GPIO_LCD_SPI GPIOC + #define GPIO_LCD_NCS GPIOA + #define GPIO_LCD_RST GPIOD + #define PIN_LCD_MOSI GPIO_Pin_12 //PC.12 + #define PIN_LCD_CLK GPIO_Pin_10 //PC.10 + #define PIN_LCD_NCS GPIO_Pin_15 //PA.15 + #define PIN_LCD_A0 GPIO_Pin_11 //PC.11 + #define PIN_LCD_RST GPIO_Pin_12 //PD.12 +#else + #define RCC_AHB1Periph_LCD RCC_AHB1Periph_GPIOD + #define GPIO_LCD_SPI GPIOD + #define GPIO_LCD_NCS GPIOD + #define GPIO_LCD_RST GPIOD + #define PIN_LCD_MOSI GPIO_Pin_10 //PD.10 + #define PIN_LCD_CLK GPIO_Pin_11 //PD.11 + #define PIN_LCD_NCS GPIO_Pin_14 //PD.14 + #define PIN_LCD_A0 GPIO_Pin_13 //PD.13 + #define PIN_LCD_RST GPIO_Pin_12 //PD.12 +#endif // Audio - I2S3 #define CODEC_I2S SPI3 diff --git a/radio/src/targets/taranis/lcd_driver.cpp b/radio/src/targets/taranis/lcd_driver.cpp index e9e3c1129..8de433294 100644 --- a/radio/src/targets/taranis/lcd_driver.cpp +++ b/radio/src/targets/taranis/lcd_driver.cpp @@ -171,16 +171,23 @@ static void LCD_Hardware_Init() GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL; - GPIO_Init(GPIO_LCD, &GPIO_InitStructure); + GPIO_Init(GPIO_LCD_SPI, &GPIO_InitStructure); LCD_NCS_HIGH(); /*!< Configure lcd NCS pin in output pushpull mode ,PULLUP *************/ - GPIO_InitStructure.GPIO_Pin = PIN_LCD_NCS |PIN_LCD_RST; + GPIO_InitStructure.GPIO_Pin = PIN_LCD_NCS; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT; GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz; GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP; + GPIO_Init(GPIO_LCD_NCS, &GPIO_InitStructure); - GPIO_Init(GPIO_LCD, &GPIO_InitStructure); + /*!< Configure lcd RST pin in output pushpull mode ,PULLUP *************/ + GPIO_InitStructure.GPIO_Pin = PIN_LCD_RST; + GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT; + GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; + GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz; + GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP; + GPIO_Init(GPIO_LCD_RST, &GPIO_InitStructure); } //275us