优化一下

Signed-off-by: kevin <kevin@lmve.net>
This commit is contained in:
2025-12-23 22:19:38 +08:00
parent d08a3d08d6
commit 5c7974a773
4 changed files with 13 additions and 9 deletions
+1 -1
View File
@@ -3,7 +3,7 @@
void setup() { void setup() {
// put your setup code here, to run once: // put your setup code here, to run once:
//delay(1000);
lcd_init(); lcd_init();
+10 -6
View File
@@ -35,7 +35,7 @@ void LCD_Writ_Bus(uint8_t dat)
******************************************************************************/ ******************************************************************************/
void LCD_WR_DATA8(uint8_t dat) void LCD_WR_DATA8(uint8_t dat)
{ {
digitalWrite(LCD_DS,1);//写数据
LCD_Writ_Bus(dat); LCD_Writ_Bus(dat);
} }
@@ -47,9 +47,10 @@ void LCD_WR_DATA8(uint8_t dat)
******************************************************************************/ ******************************************************************************/
void LCD_WR_DATA(uint16_t dat) void LCD_WR_DATA(uint16_t dat)
{ {
digitalWrite(LCD_DS,1);//写数据
LCD_Writ_Bus(dat>>8); //LCD_Writ_Bus(dat>>8);
LCD_Writ_Bus(dat); vspi->transfer16(dat);
} }
@@ -62,6 +63,7 @@ void LCD_WR_REG(uint8_t dat)
{ {
digitalWrite(LCD_DS,0);//写命令 digitalWrite(LCD_DS,0);//写命令
LCD_Writ_Bus(dat); LCD_Writ_Bus(dat);
digitalWrite(LCD_DS,1);//写数据
} }
/****************************************************************************** /******************************************************************************
@@ -121,8 +123,10 @@ void Lcd_Init(void)
{ {
//************* Start Initial Sequence **********// //************* Start Initial Sequence **********//
//delay(120);
//LCD_WR_REG(0x01); //LCD_WR_REG(0x01);
//delay(100); //上电后硬件会自己复位
delay(220);
LCD_WR_REG(0x36); LCD_WR_REG(0x36);
if(USE_HORIZONTAL==0)LCD_WR_DATA8(0x00); if(USE_HORIZONTAL==0)LCD_WR_DATA8(0x00);
else if(USE_HORIZONTAL==1)LCD_WR_DATA8(0xC0); else if(USE_HORIZONTAL==1)LCD_WR_DATA8(0xC0);
@@ -199,7 +203,7 @@ LCD_WR_DATA8(0x23);
LCD_WR_REG(0x21); LCD_WR_REG(0x21);
LCD_WR_REG(0x11); LCD_WR_REG(0x11);
//Delay (120); delay(120);
LCD_WR_REG(0x29); LCD_WR_REG(0x29);
} }
+1 -1
View File
@@ -18,7 +18,7 @@
#define USE_HORIZONTAL 0 //设置横屏或者竖屏显示 0或1为竖屏 2或3为横屏 #define USE_HORIZONTAL 0 //设置横屏或者竖屏显示 0或1为竖屏 2或3为横屏
#define LCD_W 240 #define LCD_W 240
#define LCD_H 240 #define LCD_H 320
#define OLED_CMD 0 //写命令 #define OLED_CMD 0 //写命令
#define OLED_DATA 1 //写数据 #define OLED_DATA 1 //写数据
Binary file not shown.