From c4d42c27c5cc3bf130b5bb24f605a73921f4c0fd Mon Sep 17 00:00:00 2001 From: kevin Date: Sun, 5 Jan 2025 04:19:01 +0800 Subject: [PATCH] Signed-off-by: kevin --- esp32c3_code/.gitignore | 3 ++- esp32c3_code/lcd.cpp | 26 +++++++++----------------- 2 files changed, 11 insertions(+), 18 deletions(-) diff --git a/esp32c3_code/.gitignore b/esp32c3_code/.gitignore index dbe9c82..26cf0bc 100644 --- a/esp32c3_code/.gitignore +++ b/esp32c3_code/.gitignore @@ -1 +1,2 @@ -.vscode/ \ No newline at end of file +.vscode/ +*.bin \ No newline at end of file diff --git a/esp32c3_code/lcd.cpp b/esp32c3_code/lcd.cpp index 8f071c5..f101a3b 100644 --- a/esp32c3_code/lcd.cpp +++ b/esp32c3_code/lcd.cpp @@ -3,9 +3,6 @@ SPIClass * vspi = NULL; - - - /****************************************************************************** 函数说明:LCD串行数据写入函数 入口数据:dat 要写入的串行数据 @@ -75,8 +72,8 @@ void LCD_WR_REG(uint8_t dat) ******************************************************************************/ void LCD_Address_Set(uint16_t x1,uint16_t y1,uint16_t x2,uint16_t y2) { - if(USE_HORIZONTAL==0) - { + +#if USE_HORIZONTAL==0 LCD_WR_REG(0x2a);//列地址设置 LCD_WR_DATA(x1); LCD_WR_DATA(x2); @@ -84,9 +81,7 @@ void LCD_Address_Set(uint16_t x1,uint16_t y1,uint16_t x2,uint16_t y2) LCD_WR_DATA(y1); LCD_WR_DATA(y2); LCD_WR_REG(0x2c);//储存器写 - } - else if(USE_HORIZONTAL==1) - { + #elif USE_HORIZONTAL==1 LCD_WR_REG(0x2a);//列地址设置 LCD_WR_DATA(x1); LCD_WR_DATA(x2); @@ -94,9 +89,7 @@ void LCD_Address_Set(uint16_t x1,uint16_t y1,uint16_t x2,uint16_t y2) LCD_WR_DATA(y1+80); LCD_WR_DATA(y2+80); LCD_WR_REG(0x2c);//储存器写 - } - else if(USE_HORIZONTAL==2) - { + #elif USE_HORIZONTAL==2 LCD_WR_REG(0x2a);//列地址设置 LCD_WR_DATA(x1); LCD_WR_DATA(x2); @@ -104,9 +97,7 @@ void LCD_Address_Set(uint16_t x1,uint16_t y1,uint16_t x2,uint16_t y2) LCD_WR_DATA(y1); LCD_WR_DATA(y2); LCD_WR_REG(0x2c);//储存器写 - } - else - { + #elif USE_HORIZONTAL==3 LCD_WR_REG(0x2a);//列地址设置 LCD_WR_DATA(x1+80); LCD_WR_DATA(x2+80); @@ -114,7 +105,10 @@ void LCD_Address_Set(uint16_t x1,uint16_t y1,uint16_t x2,uint16_t y2) LCD_WR_DATA(y1); LCD_WR_DATA(y2); LCD_WR_REG(0x2c);//储存器写 - } + +#endif + + } @@ -126,8 +120,6 @@ void LCD_Address_Set(uint16_t x1,uint16_t y1,uint16_t x2,uint16_t y2) void Lcd_Init(void) { - - //************* Start Initial Sequence **********// LCD_WR_REG(0x36); if(USE_HORIZONTAL==0)LCD_WR_DATA8(0x00);