1919#include "driver/gpio.h"
2020#include "esp_lcd_hx8399.h"
2121
22+ #define HX8399_CMD_PAGE (0xB9)
23+ #define HX8399_BKxSEL_BYTE0 (0xFF)
24+ #define HX8399_BKxSEL_BYTE1 (0x83)
25+ #define HX8399_BKxSEL_BYTE2 (0x99)
26+ #define HX8399_CMD_CLOSE (0x00)
27+
2228#define HX8399_CMD_DSI_INT0 (0xBA)
2329#define HX8399_DSI_1_LANE (0x00)
2430#define HX8399_DSI_2_LANE (0x01)
@@ -203,6 +209,9 @@ static esp_err_t panel_hx8399_init(esp_lcd_panel_t *panel)
203209 return ESP_ERR_INVALID_ARG ;
204210 }
205211
212+ ESP_RETURN_ON_ERROR (esp_lcd_panel_io_tx_param (io , HX8399_CMD_PAGE , (uint8_t []) {
213+ HX8399_CMD_CLOSE ,
214+ }, 1 ), TAG , "send command failed" );
206215 ESP_RETURN_ON_ERROR (esp_lcd_panel_io_tx_param (io , LCD_CMD_SLPOUT , NULL , 0 ), TAG ,
207216 "io tx param failed" );
208217 vTaskDelay (pdMS_TO_TICKS (120 ));
@@ -212,6 +221,10 @@ static esp_err_t panel_hx8399_init(esp_lcd_panel_t *panel)
212221 ESP_RETURN_ON_ERROR (esp_lcd_panel_io_tx_param (io , LCD_CMD_COLMOD , (uint8_t []) {
213222 hx8399 -> colmod_val ,
214223 }, 1 ), TAG , "send command failed" );
224+
225+ ESP_RETURN_ON_ERROR (esp_lcd_panel_io_tx_param (io , HX8399_CMD_PAGE , (uint8_t []) {
226+ HX8399_BKxSEL_BYTE0 , HX8399_BKxSEL_BYTE1 , HX8399_BKxSEL_BYTE2
227+ }, 3 ), TAG , "send command failed" );
215228 ESP_RETURN_ON_ERROR (esp_lcd_panel_io_tx_param (io , HX8399_CMD_DSI_INT0 , (uint8_t []) {
216229 lane_command ,
217230 }, 1 ), TAG , "send command failed" );
@@ -294,6 +307,9 @@ static esp_err_t panel_hx8399_invert_color(esp_lcd_panel_t *panel, bool invert_c
294307 } else {
295308 command = LCD_CMD_INVOFF ;
296309 }
310+ ESP_RETURN_ON_ERROR (esp_lcd_panel_io_tx_param (io , HX8399_CMD_PAGE , (uint8_t []) {
311+ HX8399_CMD_CLOSE ,
312+ }, 1 ), TAG , "send command failed" );
297313 ESP_RETURN_ON_ERROR (esp_lcd_panel_io_tx_param (io , command , NULL , 0 ), TAG , "send command failed" );
298314
299315 return ESP_OK ;
@@ -310,6 +326,9 @@ static esp_err_t panel_hx8399_disp_on_off(esp_lcd_panel_t *panel, bool on_off)
310326 } else {
311327 command = LCD_CMD_DISPOFF ;
312328 }
329+ ESP_RETURN_ON_ERROR (esp_lcd_panel_io_tx_param (io , HX8399_CMD_PAGE , (uint8_t []) {
330+ HX8399_CMD_CLOSE ,
331+ }, 1 ), TAG , "send command failed" );
313332 ESP_RETURN_ON_ERROR (esp_lcd_panel_io_tx_param (io , command , NULL , 0 ), TAG , "send command failed" );
314333 return ESP_OK ;
315334}
0 commit comments