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);