Update TFT drivers for new backligh control
This commit is contained in:
parent
fa042b0ecd
commit
3c4399d510
|
@ -111,16 +111,6 @@ void GC9A01_init(void)
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#if GC9A01_BCKL == 15
|
|
||||||
gpio_config_t io_conf;
|
|
||||||
io_conf.intr_type = GPIO_PIN_INTR_DISABLE;
|
|
||||||
io_conf.mode = GPIO_MODE_OUTPUT;
|
|
||||||
io_conf.pin_bit_mask = GPIO_SEL_15;
|
|
||||||
io_conf.pull_down_en = GPIO_PULLDOWN_DISABLE;
|
|
||||||
io_conf.pull_up_en = GPIO_PULLUP_DISABLE;
|
|
||||||
gpio_config(&io_conf);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//Initialize non-SPI GPIOs
|
//Initialize non-SPI GPIOs
|
||||||
gpio_pad_select_gpio(GC9A01_DC);
|
gpio_pad_select_gpio(GC9A01_DC);
|
||||||
gpio_set_direction(GC9A01_DC, GPIO_MODE_OUTPUT);
|
gpio_set_direction(GC9A01_DC, GPIO_MODE_OUTPUT);
|
||||||
|
@ -128,14 +118,7 @@ void GC9A01_init(void)
|
||||||
#if GC9A01_USE_RST
|
#if GC9A01_USE_RST
|
||||||
gpio_pad_select_gpio(GC9A01_RST);
|
gpio_pad_select_gpio(GC9A01_RST);
|
||||||
gpio_set_direction(GC9A01_RST, GPIO_MODE_OUTPUT);
|
gpio_set_direction(GC9A01_RST, GPIO_MODE_OUTPUT);
|
||||||
#endif
|
|
||||||
|
|
||||||
#if GC9A01_ENABLE_BACKLIGHT_CONTROL
|
|
||||||
gpio_pad_select_gpio(GC9A01_BCKL);
|
|
||||||
gpio_set_direction(GC9A01_BCKL, GPIO_MODE_OUTPUT);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if GC9A01_USE_RST
|
|
||||||
//Reset the display
|
//Reset the display
|
||||||
gpio_set_level(GC9A01_RST, 0);
|
gpio_set_level(GC9A01_RST, 0);
|
||||||
vTaskDelay(100 / portTICK_RATE_MS);
|
vTaskDelay(100 / portTICK_RATE_MS);
|
||||||
|
@ -156,8 +139,6 @@ void GC9A01_init(void)
|
||||||
cmd++;
|
cmd++;
|
||||||
}
|
}
|
||||||
|
|
||||||
GC9A01_enable_backlight(true);
|
|
||||||
|
|
||||||
GC9A01_set_orientation(CONFIG_LV_DISPLAY_ORIENTATION);
|
GC9A01_set_orientation(CONFIG_LV_DISPLAY_ORIENTATION);
|
||||||
|
|
||||||
#if GC9A01_INVERT_COLORS == 1
|
#if GC9A01_INVERT_COLORS == 1
|
||||||
|
@ -197,22 +178,6 @@ void GC9A01_flush(lv_disp_drv_t * drv, const lv_area_t * area, lv_color_t * colo
|
||||||
GC9A01_send_color((void*)color_map, size * 2);
|
GC9A01_send_color((void*)color_map, size * 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GC9A01_enable_backlight(bool backlight)
|
|
||||||
{
|
|
||||||
#if GC9A01_ENABLE_BACKLIGHT_CONTROL
|
|
||||||
ESP_LOGI(TAG, "%s backlight.", backlight ? "Enabling" : "Disabling");
|
|
||||||
uint32_t tmp = 0;
|
|
||||||
|
|
||||||
#if (GC9A01_BCKL_ACTIVE_LVL==1)
|
|
||||||
tmp = backlight ? 1 : 0;
|
|
||||||
#else
|
|
||||||
tmp = backlight ? 0 : 1;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
gpio_set_level(GC9A01_BCKL, tmp);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void GC9A01_sleep_in()
|
void GC9A01_sleep_in()
|
||||||
{
|
{
|
||||||
uint8_t data[] = {0x08};
|
uint8_t data[] = {0x08};
|
||||||
|
|
|
@ -28,16 +28,6 @@ extern "C" {
|
||||||
#define GC9A01_DC CONFIG_LV_DISP_PIN_DC
|
#define GC9A01_DC CONFIG_LV_DISP_PIN_DC
|
||||||
#define GC9A01_RST CONFIG_LV_DISP_PIN_RST
|
#define GC9A01_RST CONFIG_LV_DISP_PIN_RST
|
||||||
#define GC9A01_USE_RST CONFIG_LV_DISP_USE_RST
|
#define GC9A01_USE_RST CONFIG_LV_DISP_USE_RST
|
||||||
#define GC9A01_BCKL CONFIG_LV_DISP_PIN_BCKL
|
|
||||||
|
|
||||||
#define GC9A01_ENABLE_BACKLIGHT_CONTROL CONFIG_LV_ENABLE_BACKLIGHT_CONTROL
|
|
||||||
|
|
||||||
#if CONFIG_LV_BACKLIGHT_ACTIVE_LVL
|
|
||||||
#define GC9A01_BCKL_ACTIVE_LVL 1
|
|
||||||
#else
|
|
||||||
#define GC9A01_BCKL_ACTIVE_LVL 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define GC9A01_INVERT_COLORS CONFIG_LV_INVERT_COLORS
|
#define GC9A01_INVERT_COLORS CONFIG_LV_INVERT_COLORS
|
||||||
|
|
||||||
/**********************
|
/**********************
|
||||||
|
@ -50,7 +40,6 @@ extern "C" {
|
||||||
|
|
||||||
void GC9A01_init(void);
|
void GC9A01_init(void);
|
||||||
void GC9A01_flush(lv_disp_drv_t * drv, const lv_area_t * area, lv_color_t * color_map);
|
void GC9A01_flush(lv_disp_drv_t * drv, const lv_area_t * area, lv_color_t * color_map);
|
||||||
void GC9A01_enable_backlight(bool backlight);
|
|
||||||
void GC9A01_sleep_in(void);
|
void GC9A01_sleep_in(void);
|
||||||
void GC9A01_sleep_out(void);
|
void GC9A01_sleep_out(void);
|
||||||
|
|
||||||
|
|
|
@ -166,14 +166,7 @@ void hx8357_init(void)
|
||||||
#if HX8357_USE_RST
|
#if HX8357_USE_RST
|
||||||
gpio_pad_select_gpio(HX8357_RST);
|
gpio_pad_select_gpio(HX8357_RST);
|
||||||
gpio_set_direction(HX8357_RST, GPIO_MODE_OUTPUT);
|
gpio_set_direction(HX8357_RST, GPIO_MODE_OUTPUT);
|
||||||
#endif
|
|
||||||
|
|
||||||
#if HX8357_ENABLE_BACKLIGHT_CONTROL
|
|
||||||
gpio_pad_select_gpio(HX8357_BCKL);
|
|
||||||
gpio_set_direction(HX8357_BCKL, GPIO_MODE_OUTPUT);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if HX8357_USE_RST
|
|
||||||
//Reset the display
|
//Reset the display
|
||||||
gpio_set_level(HX8357_RST, 0);
|
gpio_set_level(HX8357_RST, 0);
|
||||||
vTaskDelay(10 / portTICK_RATE_MS);
|
vTaskDelay(10 / portTICK_RATE_MS);
|
||||||
|
@ -210,8 +203,6 @@ void hx8357_init(void)
|
||||||
#else
|
#else
|
||||||
hx8357_send_cmd(HX8357_INVOFF);
|
hx8357_send_cmd(HX8357_INVOFF);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
hx8357_enable_backlight(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -248,23 +239,6 @@ void hx8357_flush(lv_disp_drv_t * drv, const lv_area_t * area, lv_color_t * colo
|
||||||
hx8357_send_color((void*)color_map, size * 2);
|
hx8357_send_color((void*)color_map, size * 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
void hx8357_enable_backlight(bool backlight)
|
|
||||||
{
|
|
||||||
#if HX8357_ENABLE_BACKLIGHT_CONTROL
|
|
||||||
ESP_LOGD(TAG, "%s backlight.\n", backlight ? "Enabling" : "Disabling");
|
|
||||||
uint32_t tmp = 0;
|
|
||||||
|
|
||||||
#if (HX8357_BCKL_ACTIVE_LVL==1)
|
|
||||||
tmp = backlight ? 1 : 0;
|
|
||||||
#else
|
|
||||||
tmp = backlight ? 0 : 1;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
gpio_set_level(HX8357_BCKL, tmp);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void hx8357_set_rotation(uint8_t r)
|
void hx8357_set_rotation(uint8_t r)
|
||||||
{
|
{
|
||||||
r = r & 3; // can't be higher than 3
|
r = r & 3; // can't be higher than 3
|
||||||
|
|
|
@ -38,17 +38,8 @@ extern "C" {
|
||||||
#define HX8357_DC CONFIG_LV_DISP_PIN_DC
|
#define HX8357_DC CONFIG_LV_DISP_PIN_DC
|
||||||
#define HX8357_RST CONFIG_LV_DISP_PIN_RST
|
#define HX8357_RST CONFIG_LV_DISP_PIN_RST
|
||||||
#define HX8357_USE_RST CONFIG_LV_DISP_USE_RST
|
#define HX8357_USE_RST CONFIG_LV_DISP_USE_RST
|
||||||
#define HX8357_BCKL CONFIG_LV_DISP_PIN_BCKL
|
|
||||||
|
|
||||||
#define HX8357_ENABLE_BACKLIGHT_CONTROL CONFIG_LV_ENABLE_BACKLIGHT_CONTROL
|
|
||||||
#define HX8357_INVERT_COLORS CONFIG_LV_INVERT_COLORS
|
#define HX8357_INVERT_COLORS CONFIG_LV_INVERT_COLORS
|
||||||
|
|
||||||
#if CONFIG_LV_BACKLIGHT_ACTIVE_LVL
|
|
||||||
#define HX8357_BCKL_ACTIVE_LVL 1
|
|
||||||
#else
|
|
||||||
#define HX8357_BCKL_ACTIVE_LVL 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/*******************
|
/*******************
|
||||||
* HX8357B/D REGS
|
* HX8357B/D REGS
|
||||||
|
@ -136,7 +127,6 @@ extern "C" {
|
||||||
|
|
||||||
void hx8357_init(void);
|
void hx8357_init(void);
|
||||||
void hx8357_flush(lv_disp_drv_t * drv, const lv_area_t * area, lv_color_t * color_map);
|
void hx8357_flush(lv_disp_drv_t * drv, const lv_area_t * area, lv_color_t * color_map);
|
||||||
void hx8357_enable_backlight(bool backlight);
|
|
||||||
void hx8357_set_rotation(uint8_t r);
|
void hx8357_set_rotation(uint8_t r);
|
||||||
|
|
||||||
/**********************
|
/**********************
|
||||||
|
|
|
@ -199,15 +199,13 @@ void il3820_init(void)
|
||||||
gpio_pad_select_gpio(IL3820_DC_PIN);
|
gpio_pad_select_gpio(IL3820_DC_PIN);
|
||||||
gpio_set_direction(IL3820_DC_PIN, GPIO_MODE_OUTPUT);
|
gpio_set_direction(IL3820_DC_PIN, GPIO_MODE_OUTPUT);
|
||||||
|
|
||||||
#if IL3820_USE_RST
|
|
||||||
gpio_pad_select_gpio(IL3820_RST_PIN);
|
|
||||||
gpio_set_direction(IL3820_RST_PIN, GPIO_MODE_OUTPUT);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
gpio_pad_select_gpio(IL3820_BUSY_PIN);
|
gpio_pad_select_gpio(IL3820_BUSY_PIN);
|
||||||
gpio_set_direction(IL3820_BUSY_PIN, GPIO_MODE_INPUT);
|
gpio_set_direction(IL3820_BUSY_PIN, GPIO_MODE_INPUT);
|
||||||
|
|
||||||
#if IL3820_USE_RST
|
#if IL3820_USE_RST
|
||||||
|
gpio_pad_select_gpio(IL3820_RST_PIN);
|
||||||
|
gpio_set_direction(IL3820_RST_PIN, GPIO_MODE_OUTPUT);
|
||||||
|
|
||||||
/* Harware reset */
|
/* Harware reset */
|
||||||
gpio_set_level( IL3820_RST_PIN, 0);
|
gpio_set_level( IL3820_RST_PIN, 0);
|
||||||
vTaskDelay(IL3820_RESET_DELAY / portTICK_RATE_MS);
|
vTaskDelay(IL3820_RESET_DELAY / portTICK_RATE_MS);
|
||||||
|
|
|
@ -143,10 +143,6 @@ void ili9163c_init(void)
|
||||||
gpio_pad_select_gpio(ILI9163C_RST);
|
gpio_pad_select_gpio(ILI9163C_RST);
|
||||||
gpio_set_direction(ILI9163C_RST, GPIO_MODE_OUTPUT);
|
gpio_set_direction(ILI9163C_RST, GPIO_MODE_OUTPUT);
|
||||||
|
|
||||||
#if ILI9163C_ENABLE_BACKLIGHT_CONTROL
|
|
||||||
gpio_pad_select_gpio(ILI9163C_BCKL);
|
|
||||||
gpio_set_direction(ILI9163C_BCKL, GPIO_MODE_OUTPUT);
|
|
||||||
#endif
|
|
||||||
//Reset the display
|
//Reset the display
|
||||||
gpio_set_level(ILI9163C_RST, 0);
|
gpio_set_level(ILI9163C_RST, 0);
|
||||||
vTaskDelay(100 / portTICK_RATE_MS);
|
vTaskDelay(100 / portTICK_RATE_MS);
|
||||||
|
@ -166,8 +162,6 @@ void ili9163c_init(void)
|
||||||
cmd++;
|
cmd++;
|
||||||
}
|
}
|
||||||
|
|
||||||
ili9163c_enable_backlight(true);
|
|
||||||
|
|
||||||
ili9163c_set_orientation(CONFIG_LV_DISPLAY_ORIENTATION);
|
ili9163c_set_orientation(CONFIG_LV_DISPLAY_ORIENTATION);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -199,22 +193,6 @@ void ili9163c_flush(lv_disp_drv_t *drv, const lv_area_t *area, lv_color_t *color
|
||||||
ili9163c_send_color((void *)color_map, size * 2);
|
ili9163c_send_color((void *)color_map, size * 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ili9163c_enable_backlight(bool backlight)
|
|
||||||
{
|
|
||||||
#if ILI9163C_ENABLE_BACKLIGHT_CONTROL
|
|
||||||
ESP_LOGD(TAG, "%s backlight.", backlight ? "Enabling" : "Disabling");
|
|
||||||
uint32_t tmp = 0;
|
|
||||||
|
|
||||||
#if (ILI9163C_BCKL_ACTIVE_LVL == 1)
|
|
||||||
tmp = backlight ? 1 : 0;
|
|
||||||
#else
|
|
||||||
tmp = backlight ? 0 : 1;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
gpio_set_level(ILI9163C_BCKL, tmp);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void ili9163c_sleep_in()
|
void ili9163c_sleep_in()
|
||||||
{
|
{
|
||||||
uint8_t data[] = {0x08};
|
uint8_t data[] = {0x08};
|
||||||
|
|
|
@ -28,33 +28,22 @@ extern "C"
|
||||||
*********************/
|
*********************/
|
||||||
#define ILI9163C_DC CONFIG_LV_DISP_PIN_DC
|
#define ILI9163C_DC CONFIG_LV_DISP_PIN_DC
|
||||||
#define ILI9163C_RST CONFIG_LV_DISP_PIN_RST
|
#define ILI9163C_RST CONFIG_LV_DISP_PIN_RST
|
||||||
#define ILI9163C_BCKL CONFIG_LV_DISP_PIN_BCKL
|
|
||||||
|
|
||||||
#define ILI9163C_ENABLE_BACKLIGHT_CONTROL CONFIG_LV_ENABLE_BACKLIGHT_CONTROL
|
|
||||||
|
|
||||||
#if CONFIG_LV_BACKLIGHT_ACTIVE_LVL
|
|
||||||
#define ILI9163C_BCKL_ACTIVE_LVL 1
|
|
||||||
#else
|
|
||||||
#define ILI9163C_BCKL_ACTIVE_LVL 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define ILI9163C_INVERT_COLORS CONFIG_LV_INVERT_COLORS
|
#define ILI9163C_INVERT_COLORS CONFIG_LV_INVERT_COLORS
|
||||||
|
|
||||||
/**********************
|
/**********************
|
||||||
* TYPEDEFS
|
* TYPEDEFS
|
||||||
**********************/
|
**********************/
|
||||||
|
|
||||||
/**********************
|
/**********************
|
||||||
* GLOBAL PROTOTYPES
|
* GLOBAL PROTOTYPES
|
||||||
**********************/
|
**********************/
|
||||||
|
|
||||||
void ili9163c_init(void);
|
void ili9163c_init(void);
|
||||||
void ili9163c_flush(lv_disp_drv_t *drv, const lv_area_t *area, lv_color_t *color_map);
|
void ili9163c_flush(lv_disp_drv_t *drv, const lv_area_t *area, lv_color_t *color_map);
|
||||||
void ili9163c_enable_backlight(bool backlight);
|
void ili9163c_sleep_in(void);
|
||||||
void ili9163c_sleep_in(void);
|
void ili9163c_sleep_out(void);
|
||||||
void ili9163c_sleep_out(void);
|
|
||||||
|
|
||||||
/**********************
|
/**********************
|
||||||
* MACROS
|
* MACROS
|
||||||
**********************/
|
**********************/
|
||||||
|
|
||||||
|
|
|
@ -80,30 +80,14 @@ void ili9341_init(void)
|
||||||
{0, {0}, 0xff},
|
{0, {0}, 0xff},
|
||||||
};
|
};
|
||||||
|
|
||||||
#if ILI9341_BCKL == 15
|
|
||||||
gpio_config_t io_conf;
|
|
||||||
io_conf.intr_type = GPIO_PIN_INTR_DISABLE;
|
|
||||||
io_conf.mode = GPIO_MODE_OUTPUT;
|
|
||||||
io_conf.pin_bit_mask = GPIO_SEL_15;
|
|
||||||
io_conf.pull_down_en = GPIO_PULLDOWN_DISABLE;
|
|
||||||
io_conf.pull_up_en = GPIO_PULLUP_DISABLE;
|
|
||||||
gpio_config(&io_conf);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//Initialize non-SPI GPIOs
|
//Initialize non-SPI GPIOs
|
||||||
gpio_pad_select_gpio(ILI9341_DC);
|
gpio_pad_select_gpio(ILI9341_DC);
|
||||||
gpio_set_direction(ILI9341_DC, GPIO_MODE_OUTPUT);
|
gpio_set_direction(ILI9341_DC, GPIO_MODE_OUTPUT);
|
||||||
|
|
||||||
#if ILI9341_USE_RST
|
#if ILI9341_USE_RST
|
||||||
gpio_pad_select_gpio(ILI9341_RST);
|
gpio_pad_select_gpio(ILI9341_RST);
|
||||||
gpio_set_direction(ILI9341_RST, GPIO_MODE_OUTPUT);
|
gpio_set_direction(ILI9341_RST, GPIO_MODE_OUTPUT);
|
||||||
#endif
|
|
||||||
|
|
||||||
#if ILI9341_ENABLE_BACKLIGHT_CONTROL
|
|
||||||
gpio_pad_select_gpio(ILI9341_BCKL);
|
|
||||||
gpio_set_direction(ILI9341_BCKL, GPIO_MODE_OUTPUT);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if ILI9341_USE_RST
|
|
||||||
//Reset the display
|
//Reset the display
|
||||||
gpio_set_level(ILI9341_RST, 0);
|
gpio_set_level(ILI9341_RST, 0);
|
||||||
vTaskDelay(100 / portTICK_RATE_MS);
|
vTaskDelay(100 / portTICK_RATE_MS);
|
||||||
|
@ -124,8 +108,6 @@ void ili9341_init(void)
|
||||||
cmd++;
|
cmd++;
|
||||||
}
|
}
|
||||||
|
|
||||||
ili9341_enable_backlight(true);
|
|
||||||
|
|
||||||
ili9341_set_orientation(CONFIG_LV_DISPLAY_ORIENTATION);
|
ili9341_set_orientation(CONFIG_LV_DISPLAY_ORIENTATION);
|
||||||
|
|
||||||
#if ILI9341_INVERT_COLORS == 1
|
#if ILI9341_INVERT_COLORS == 1
|
||||||
|
@ -158,29 +140,10 @@ void ili9341_flush(lv_disp_drv_t * drv, const lv_area_t * area, lv_color_t * col
|
||||||
|
|
||||||
/*Memory write*/
|
/*Memory write*/
|
||||||
ili9341_send_cmd(0x2C);
|
ili9341_send_cmd(0x2C);
|
||||||
|
|
||||||
|
|
||||||
uint32_t size = lv_area_get_width(area) * lv_area_get_height(area);
|
uint32_t size = lv_area_get_width(area) * lv_area_get_height(area);
|
||||||
|
|
||||||
ili9341_send_color((void*)color_map, size * 2);
|
ili9341_send_color((void*)color_map, size * 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ili9341_enable_backlight(bool backlight)
|
|
||||||
{
|
|
||||||
#if ILI9341_ENABLE_BACKLIGHT_CONTROL
|
|
||||||
ESP_LOGI(TAG, "%s backlight.", backlight ? "Enabling" : "Disabling");
|
|
||||||
uint32_t tmp = 0;
|
|
||||||
|
|
||||||
#if (ILI9341_BCKL_ACTIVE_LVL==1)
|
|
||||||
tmp = backlight ? 1 : 0;
|
|
||||||
#else
|
|
||||||
tmp = backlight ? 0 : 1;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
gpio_set_level(ILI9341_BCKL, tmp);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void ili9341_sleep_in()
|
void ili9341_sleep_in()
|
||||||
{
|
{
|
||||||
uint8_t data[] = {0x08};
|
uint8_t data[] = {0x08};
|
||||||
|
|
|
@ -29,16 +29,6 @@ extern "C" {
|
||||||
#define ILI9341_DC CONFIG_LV_DISP_PIN_DC
|
#define ILI9341_DC CONFIG_LV_DISP_PIN_DC
|
||||||
#define ILI9341_USE_RST CONFIG_LV_DISP_USE_RST
|
#define ILI9341_USE_RST CONFIG_LV_DISP_USE_RST
|
||||||
#define ILI9341_RST CONFIG_LV_DISP_PIN_RST
|
#define ILI9341_RST CONFIG_LV_DISP_PIN_RST
|
||||||
#define ILI9341_BCKL CONFIG_LV_DISP_PIN_BCKL
|
|
||||||
|
|
||||||
#define ILI9341_ENABLE_BACKLIGHT_CONTROL CONFIG_LV_ENABLE_BACKLIGHT_CONTROL
|
|
||||||
|
|
||||||
#if CONFIG_LV_BACKLIGHT_ACTIVE_LVL
|
|
||||||
#define ILI9341_BCKL_ACTIVE_LVL 1
|
|
||||||
#else
|
|
||||||
#define ILI9341_BCKL_ACTIVE_LVL 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define ILI9341_INVERT_COLORS CONFIG_LV_INVERT_COLORS
|
#define ILI9341_INVERT_COLORS CONFIG_LV_INVERT_COLORS
|
||||||
|
|
||||||
/**********************
|
/**********************
|
||||||
|
@ -51,7 +41,6 @@ extern "C" {
|
||||||
|
|
||||||
void ili9341_init(void);
|
void ili9341_init(void);
|
||||||
void ili9341_flush(lv_disp_drv_t * drv, const lv_area_t * area, lv_color_t * color_map);
|
void ili9341_flush(lv_disp_drv_t * drv, const lv_area_t * area, lv_color_t * color_map);
|
||||||
void ili9341_enable_backlight(bool backlight);
|
|
||||||
void ili9341_sleep_in(void);
|
void ili9341_sleep_in(void);
|
||||||
void ili9341_sleep_out(void);
|
void ili9341_sleep_out(void);
|
||||||
|
|
||||||
|
|
|
@ -80,14 +80,7 @@ void ili9481_init(void)
|
||||||
#if ILI9481_USE_RST
|
#if ILI9481_USE_RST
|
||||||
gpio_pad_select_gpio(ILI9481_RST);
|
gpio_pad_select_gpio(ILI9481_RST);
|
||||||
gpio_set_direction(ILI9481_RST, GPIO_MODE_OUTPUT);
|
gpio_set_direction(ILI9481_RST, GPIO_MODE_OUTPUT);
|
||||||
#endif
|
|
||||||
|
|
||||||
#if ILI9481_ENABLE_BACKLIGHT_CONTROL
|
|
||||||
gpio_pad_select_gpio(ILI9481_BCKL);
|
|
||||||
gpio_set_direction(ILI9481_BCKL, GPIO_MODE_OUTPUT);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if ILI9481_USE_RST
|
|
||||||
//Reset the display
|
//Reset the display
|
||||||
gpio_set_level(ILI9481_RST, 0);
|
gpio_set_level(ILI9481_RST, 0);
|
||||||
vTaskDelay(100 / portTICK_RATE_MS);
|
vTaskDelay(100 / portTICK_RATE_MS);
|
||||||
|
@ -112,8 +105,6 @@ void ili9481_init(void)
|
||||||
cmd++;
|
cmd++;
|
||||||
}
|
}
|
||||||
|
|
||||||
ili9481_enable_backlight(true);
|
|
||||||
|
|
||||||
ili9481_set_orientation(ILI9481_DISPLAY_ORIENTATION);
|
ili9481_set_orientation(ILI9481_DISPLAY_ORIENTATION);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -173,22 +164,6 @@ void ili9481_flush(lv_disp_drv_t * drv, const lv_area_t * area, lv_color_t * col
|
||||||
heap_caps_free(mybuf);
|
heap_caps_free(mybuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ili9481_enable_backlight(bool backlight)
|
|
||||||
{
|
|
||||||
#if ILI9481_ENABLE_BACKLIGHT_CONTROL
|
|
||||||
ESP_LOGI(TAG, "%s backlight.", backlight ? "Enabling" : "Disabling");
|
|
||||||
uint32_t tmp = 0;
|
|
||||||
|
|
||||||
#if (ILI9481_BCKL_ACTIVE_LVL==1)
|
|
||||||
tmp = backlight ? 1 : 0;
|
|
||||||
#else
|
|
||||||
tmp = backlight ? 0 : 1;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
gpio_set_level(ILI9481_BCKL, tmp);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
/**********************
|
/**********************
|
||||||
* STATIC FUNCTIONS
|
* STATIC FUNCTIONS
|
||||||
**********************/
|
**********************/
|
||||||
|
|
|
@ -28,17 +28,9 @@ extern "C" {
|
||||||
#define ILI9481_DC CONFIG_LV_DISP_PIN_DC
|
#define ILI9481_DC CONFIG_LV_DISP_PIN_DC
|
||||||
#define ILI9481_RST CONFIG_LV_DISP_PIN_RST
|
#define ILI9481_RST CONFIG_LV_DISP_PIN_RST
|
||||||
#define ILI9481_USE_RST CONFIG_LV_DISP_USE_RST
|
#define ILI9481_USE_RST CONFIG_LV_DISP_USE_RST
|
||||||
#define ILI9481_BCKL CONFIG_LV_DISP_PIN_BCKL
|
|
||||||
|
|
||||||
#define ILI9481_ENABLE_BACKLIGHT_CONTROL CONFIG_LV_ENABLE_BACKLIGHT_CONTROL
|
|
||||||
#define ILI9481_INVERT_COLORS CONFIG_LV_INVERT_COLORS
|
#define ILI9481_INVERT_COLORS CONFIG_LV_INVERT_COLORS
|
||||||
#define ILI9481_DISPLAY_ORIENTATION CONFIG_LV_DISPLAY_ORIENTATION
|
#define ILI9481_DISPLAY_ORIENTATION CONFIG_LV_DISPLAY_ORIENTATION
|
||||||
|
|
||||||
#if CONFIG_LV_BACKLIGHT_ACTIVE_LVL
|
|
||||||
#define ILI9481_BCKL_ACTIVE_LVL 1
|
|
||||||
#else
|
|
||||||
#define ILI9481_BCKL_ACTIVE_LVL 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*******************
|
/*******************
|
||||||
* ILI9481 REGS
|
* ILI9481 REGS
|
||||||
|
@ -118,7 +110,6 @@ extern "C" {
|
||||||
|
|
||||||
void ili9481_init(void);
|
void ili9481_init(void);
|
||||||
void ili9481_flush(lv_disp_drv_t * drv, const lv_area_t * area, lv_color_t * color_map);
|
void ili9481_flush(lv_disp_drv_t * drv, const lv_area_t * area, lv_color_t * color_map);
|
||||||
void ili9481_enable_backlight(bool backlight);
|
|
||||||
|
|
||||||
/**********************
|
/**********************
|
||||||
* MACROS
|
* MACROS
|
||||||
|
|
|
@ -65,16 +65,6 @@ void ili9486_init(void)
|
||||||
{0x00, {0}, 0xff},
|
{0x00, {0}, 0xff},
|
||||||
};
|
};
|
||||||
|
|
||||||
#if ILI9486_BCKL == 15
|
|
||||||
gpio_config_t io_conf;
|
|
||||||
io_conf.intr_type = GPIO_PIN_INTR_DISABLE;
|
|
||||||
io_conf.mode = GPIO_MODE_OUTPUT;
|
|
||||||
io_conf.pin_bit_mask = GPIO_SEL_15;
|
|
||||||
io_conf.pull_down_en = GPIO_PULLDOWN_DISABLE;
|
|
||||||
io_conf.pull_up_en = GPIO_PULLUP_DISABLE;
|
|
||||||
gpio_config(&io_conf);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//Initialize non-SPI GPIOs
|
//Initialize non-SPI GPIOs
|
||||||
gpio_pad_select_gpio(ILI9486_DC);
|
gpio_pad_select_gpio(ILI9486_DC);
|
||||||
gpio_set_direction(ILI9486_DC, GPIO_MODE_OUTPUT);
|
gpio_set_direction(ILI9486_DC, GPIO_MODE_OUTPUT);
|
||||||
|
@ -82,14 +72,7 @@ void ili9486_init(void)
|
||||||
#if ILI9486_USE_RST
|
#if ILI9486_USE_RST
|
||||||
gpio_pad_select_gpio(ILI9486_RST);
|
gpio_pad_select_gpio(ILI9486_RST);
|
||||||
gpio_set_direction(ILI9486_RST, GPIO_MODE_OUTPUT);
|
gpio_set_direction(ILI9486_RST, GPIO_MODE_OUTPUT);
|
||||||
#endif
|
|
||||||
|
|
||||||
#if ILI9486_ENABLE_BACKLIGHT_CONTROL
|
|
||||||
gpio_pad_select_gpio(ILI9486_BCKL);
|
|
||||||
gpio_set_direction(ILI9486_BCKL, GPIO_MODE_OUTPUT);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if ILI9486_USE_RST
|
|
||||||
//Reset the display
|
//Reset the display
|
||||||
gpio_set_level(ILI9486_RST, 0);
|
gpio_set_level(ILI9486_RST, 0);
|
||||||
vTaskDelay(100 / portTICK_RATE_MS);
|
vTaskDelay(100 / portTICK_RATE_MS);
|
||||||
|
@ -110,8 +93,6 @@ void ili9486_init(void)
|
||||||
cmd++;
|
cmd++;
|
||||||
}
|
}
|
||||||
|
|
||||||
ili9486_enable_backlight(true);
|
|
||||||
|
|
||||||
ili9486_set_orientation(CONFIG_LV_DISPLAY_ORIENTATION);
|
ili9486_set_orientation(CONFIG_LV_DISPLAY_ORIENTATION);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -144,22 +125,6 @@ void ili9486_flush(lv_disp_drv_t * drv, const lv_area_t * area, lv_color_t * col
|
||||||
ili9486_send_color((void*) color_map, size * 2);
|
ili9486_send_color((void*) color_map, size * 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ili9486_enable_backlight(bool backlight)
|
|
||||||
{
|
|
||||||
#if ILI9486_ENABLE_BACKLIGHT_CONTROL
|
|
||||||
ESP_LOGI(TAG, "%s backlight.", backlight ? "Enabling" : "Disabling");
|
|
||||||
uint32_t tmp = 0;
|
|
||||||
|
|
||||||
#if (ILI9486_BCKL_ACTIVE_LVL==1)
|
|
||||||
tmp = backlight ? 1 : 0;
|
|
||||||
#else
|
|
||||||
tmp = backlight ? 0 : 1;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
gpio_set_level(ILI9486_BCKL, tmp);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
/**********************
|
/**********************
|
||||||
* STATIC FUNCTIONS
|
* STATIC FUNCTIONS
|
||||||
**********************/
|
**********************/
|
||||||
|
|
|
@ -28,15 +28,7 @@ extern "C" {
|
||||||
#define ILI9486_DC CONFIG_LV_DISP_PIN_DC
|
#define ILI9486_DC CONFIG_LV_DISP_PIN_DC
|
||||||
#define ILI9486_RST CONFIG_LV_DISP_PIN_RST
|
#define ILI9486_RST CONFIG_LV_DISP_PIN_RST
|
||||||
#define ILI9486_USE_RST CONFIG_LV_DISP_USE_RST
|
#define ILI9486_USE_RST CONFIG_LV_DISP_USE_RST
|
||||||
#define ILI9486_BCKL CONFIG_LV_DISP_PIN_BCKL
|
|
||||||
|
|
||||||
#define ILI9486_ENABLE_BACKLIGHT_CONTROL CONFIG_LV_ENABLE_BACKLIGHT_CONTROL
|
|
||||||
|
|
||||||
#if CONFIG_LV_BACKLIGHT_ACTIVE_LVL
|
|
||||||
#define ILI9486_BCKL_ACTIVE_LVL 1
|
|
||||||
#else
|
|
||||||
#define ILI9486_BCKL_ACTIVE_LVL 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**********************
|
/**********************
|
||||||
* TYPEDEFS
|
* TYPEDEFS
|
||||||
|
@ -48,7 +40,6 @@ extern "C" {
|
||||||
|
|
||||||
void ili9486_init(void);
|
void ili9486_init(void);
|
||||||
void ili9486_flush(lv_disp_drv_t * drv, const lv_area_t * area, lv_color_t * color_map);
|
void ili9486_flush(lv_disp_drv_t * drv, const lv_area_t * area, lv_color_t * color_map);
|
||||||
void ili9486_enable_backlight(bool backlight);
|
|
||||||
|
|
||||||
/**********************
|
/**********************
|
||||||
* MACROS
|
* MACROS
|
||||||
|
|
|
@ -82,14 +82,7 @@ void ili9488_init(void)
|
||||||
#if ILI9488_USE_RST
|
#if ILI9488_USE_RST
|
||||||
gpio_pad_select_gpio(ILI9488_RST);
|
gpio_pad_select_gpio(ILI9488_RST);
|
||||||
gpio_set_direction(ILI9488_RST, GPIO_MODE_OUTPUT);
|
gpio_set_direction(ILI9488_RST, GPIO_MODE_OUTPUT);
|
||||||
#endif
|
|
||||||
|
|
||||||
#if ILI9488_ENABLE_BACKLIGHT_CONTROL
|
|
||||||
gpio_pad_select_gpio(ILI9488_BCKL);
|
|
||||||
gpio_set_direction(ILI9488_BCKL, GPIO_MODE_OUTPUT);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if ILI9488_USE_RST
|
|
||||||
//Reset the display
|
//Reset the display
|
||||||
gpio_set_level(ILI9488_RST, 0);
|
gpio_set_level(ILI9488_RST, 0);
|
||||||
vTaskDelay(100 / portTICK_RATE_MS);
|
vTaskDelay(100 / portTICK_RATE_MS);
|
||||||
|
@ -114,8 +107,6 @@ void ili9488_init(void)
|
||||||
cmd++;
|
cmd++;
|
||||||
}
|
}
|
||||||
|
|
||||||
ili9488_enable_backlight(true);
|
|
||||||
|
|
||||||
ili9488_set_orientation(CONFIG_LV_DISPLAY_ORIENTATION);
|
ili9488_set_orientation(CONFIG_LV_DISPLAY_ORIENTATION);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -175,22 +166,6 @@ void ili9488_flush(lv_disp_drv_t * drv, const lv_area_t * area, lv_color_t * col
|
||||||
heap_caps_free(mybuf);
|
heap_caps_free(mybuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ili9488_enable_backlight(bool backlight)
|
|
||||||
{
|
|
||||||
#if ILI9488_ENABLE_BACKLIGHT_CONTROL
|
|
||||||
ESP_LOGI(TAG, "%s backlight.", backlight ? "Enabling" : "Disabling");
|
|
||||||
uint32_t tmp = 0;
|
|
||||||
|
|
||||||
#if (ILI9488_BCKL_ACTIVE_LVL==1)
|
|
||||||
tmp = backlight ? 1 : 0;
|
|
||||||
#else
|
|
||||||
tmp = backlight ? 0 : 1;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
gpio_set_level(ILI9488_BCKL, tmp);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
/**********************
|
/**********************
|
||||||
* STATIC FUNCTIONS
|
* STATIC FUNCTIONS
|
||||||
**********************/
|
**********************/
|
||||||
|
|
|
@ -27,16 +27,7 @@ extern "C" {
|
||||||
*********************/
|
*********************/
|
||||||
#define ILI9488_DC CONFIG_LV_DISP_PIN_DC
|
#define ILI9488_DC CONFIG_LV_DISP_PIN_DC
|
||||||
#define ILI9488_RST CONFIG_LV_DISP_PIN_RST
|
#define ILI9488_RST CONFIG_LV_DISP_PIN_RST
|
||||||
#define ILI9488_USE_RST CONFIG_LV_DISP_USE_RST
|
#define ILI9488_USE_RST CONFIG_LV_DISP_USE_RSTS
|
||||||
#define ILI9488_BCKL CONFIG_LV_DISP_PIN_BCKL
|
|
||||||
|
|
||||||
#define ILI9488_ENABLE_BACKLIGHT_CONTROL CONFIG_LV_ENABLE_BACKLIGHT_CONTROL
|
|
||||||
|
|
||||||
#if CONFIG_LV_BACKLIGHT_ACTIVE_LVL
|
|
||||||
#define ILI9488_BCKL_ACTIVE_LVL 1
|
|
||||||
#else
|
|
||||||
#define ILI9488_BCKL_ACTIVE_LVL 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*******************
|
/*******************
|
||||||
* ILI9488 REGS
|
* ILI9488 REGS
|
||||||
|
@ -155,7 +146,6 @@ typedef struct {
|
||||||
|
|
||||||
void ili9488_init(void);
|
void ili9488_init(void);
|
||||||
void ili9488_flush(lv_disp_drv_t * drv, const lv_area_t * area, lv_color_t * color_map);
|
void ili9488_flush(lv_disp_drv_t * drv, const lv_area_t * area, lv_color_t * color_map);
|
||||||
void ili9488_enable_backlight(bool backlight);
|
|
||||||
|
|
||||||
/**********************
|
/**********************
|
||||||
* MACROS
|
* MACROS
|
||||||
|
|
|
@ -148,29 +148,12 @@ void ra8875_init(void)
|
||||||
|
|
||||||
ESP_LOGI(TAG, "Initializing RA8875...");
|
ESP_LOGI(TAG, "Initializing RA8875...");
|
||||||
|
|
||||||
#if (CONFIG_LV_DISP_PIN_BCKL == 15)
|
|
||||||
gpio_config_t io_conf;
|
|
||||||
io_conf.intr_type = GPIO_PIN_INTR_DISABLE;
|
|
||||||
io_conf.mode = GPIO_MODE_OUTPUT;
|
|
||||||
io_conf.pin_bit_mask = GPIO_SEL_15;
|
|
||||||
io_conf.pull_down_en = GPIO_PULLDOWN_DISABLE;
|
|
||||||
io_conf.pull_up_en = GPIO_PULLUP_DISABLE;
|
|
||||||
gpio_config(&io_conf);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Initialize non-SPI GPIOs
|
// Initialize non-SPI GPIOs
|
||||||
|
|
||||||
#if RA8875_USE_RST
|
#if RA8875_USE_RST
|
||||||
gpio_pad_select_gpio(RA8875_RST);
|
gpio_pad_select_gpio(RA8875_RST);
|
||||||
gpio_set_direction(RA8875_RST, GPIO_MODE_OUTPUT);
|
gpio_set_direction(RA8875_RST, GPIO_MODE_OUTPUT);
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef CONFIG_LV_DISP_PIN_BCKL
|
|
||||||
gpio_pad_select_gpio(CONFIG_LV_DISP_PIN_BCKL);
|
|
||||||
gpio_set_direction(CONFIG_LV_DISP_PIN_BCKL, GPIO_MODE_OUTPUT);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if RA8875_USE_RST
|
|
||||||
// Reset the RA8875
|
// Reset the RA8875
|
||||||
gpio_set_level(RA8875_RST, 0);
|
gpio_set_level(RA8875_RST, 0);
|
||||||
vTaskDelay(DIV_ROUND_UP(100, portTICK_RATE_MS));
|
vTaskDelay(DIV_ROUND_UP(100, portTICK_RATE_MS));
|
||||||
|
@ -200,28 +183,8 @@ void ra8875_init(void)
|
||||||
ESP_LOGW(TAG, "WARNING: Memory clear timed out; RA8875 may be unresponsive.");
|
ESP_LOGW(TAG, "WARNING: Memory clear timed out; RA8875 may be unresponsive.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Enable the display and backlight
|
// Enable the display
|
||||||
ra8875_enable_display(true);
|
ra8875_enable_display(true);
|
||||||
ra8875_enable_backlight(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ra8875_enable_backlight(bool backlight)
|
|
||||||
{
|
|
||||||
#if CONFIG_LV_ENABLE_BACKLIGHT_CONTROL
|
|
||||||
ESP_LOGI(TAG, "%s backlight.", backlight ? "Enabling" : "Disabling");
|
|
||||||
uint32_t tmp = 0;
|
|
||||||
|
|
||||||
#if CONFIG_LV_BACKLIGHT_ACTIVE_LVL
|
|
||||||
tmp = backlight ? 1 : 0;
|
|
||||||
#else
|
|
||||||
tmp = backlight ? 0 : 1;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef CONFIG_LV_DISP_PIN_BCKL
|
|
||||||
gpio_set_level(CONFIG_LV_DISP_PIN_BCKL, tmp);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ra8875_enable_display(bool enable)
|
void ra8875_enable_display(bool enable)
|
||||||
|
|
|
@ -97,7 +97,6 @@ extern "C" {
|
||||||
**********************/
|
**********************/
|
||||||
|
|
||||||
void ra8875_init(void);
|
void ra8875_init(void);
|
||||||
void ra8875_enable_backlight(bool backlight);
|
|
||||||
void ra8875_enable_display(bool enable);
|
void ra8875_enable_display(bool enable);
|
||||||
void ra8875_flush(lv_disp_drv_t * drv, const lv_area_t * area, lv_color_t * color_map);
|
void ra8875_flush(lv_disp_drv_t * drv, const lv_area_t * area, lv_color_t * color_map);
|
||||||
|
|
||||||
|
|
|
@ -131,7 +131,6 @@ extern "C" {
|
||||||
|
|
||||||
void st7735s_init(void);
|
void st7735s_init(void);
|
||||||
void st7735s_flush(lv_disp_drv_t * drv, const lv_area_t * area, lv_color_t * color_map);
|
void st7735s_flush(lv_disp_drv_t * drv, const lv_area_t * area, lv_color_t * color_map);
|
||||||
void st7735s_enable_backlight(bool backlight);
|
|
||||||
void st7735s_sleep_in(void);
|
void st7735s_sleep_in(void);
|
||||||
void st7735s_sleep_out(void);
|
void st7735s_sleep_out(void);
|
||||||
|
|
||||||
|
|
|
@ -94,11 +94,6 @@ void st7789_init(void)
|
||||||
gpio_set_direction(ST7789_RST, GPIO_MODE_OUTPUT);
|
gpio_set_direction(ST7789_RST, GPIO_MODE_OUTPUT);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ST7789_ENABLE_BACKLIGHT_CONTROL
|
|
||||||
gpio_pad_select_gpio(ST7789_BCKL);
|
|
||||||
gpio_set_direction(ST7789_BCKL, GPIO_MODE_OUTPUT);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//Reset the display
|
//Reset the display
|
||||||
#if !defined(ST7789_SOFT_RST)
|
#if !defined(ST7789_SOFT_RST)
|
||||||
gpio_set_level(ST7789_RST, 0);
|
gpio_set_level(ST7789_RST, 0);
|
||||||
|
@ -122,27 +117,9 @@ void st7789_init(void)
|
||||||
cmd++;
|
cmd++;
|
||||||
}
|
}
|
||||||
|
|
||||||
st7789_enable_backlight(true);
|
|
||||||
|
|
||||||
st7789_set_orientation(CONFIG_LV_DISPLAY_ORIENTATION);
|
st7789_set_orientation(CONFIG_LV_DISPLAY_ORIENTATION);
|
||||||
}
|
}
|
||||||
|
|
||||||
void st7789_enable_backlight(bool backlight)
|
|
||||||
{
|
|
||||||
#if ST7789_ENABLE_BACKLIGHT_CONTROL
|
|
||||||
printf("%s backlight.\n", backlight ? "Enabling" : "Disabling");
|
|
||||||
uint32_t tmp = 0;
|
|
||||||
|
|
||||||
#if (ST7789_BCKL_ACTIVE_LVL==1)
|
|
||||||
tmp = backlight ? 1 : 0;
|
|
||||||
#else
|
|
||||||
tmp = backlight ? 0 : 1;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
gpio_set_level(ST7789_BCKL, tmp);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
/* The ST7789 display controller can drive 320*240 displays, when using a 240*240
|
/* The ST7789 display controller can drive 320*240 displays, when using a 240*240
|
||||||
* display there's a gap of 80px, we need to edit the coordinates to take into
|
* display there's a gap of 80px, we need to edit the coordinates to take into
|
||||||
* account that gap, this is not necessary in all orientations. */
|
* account that gap, this is not necessary in all orientations. */
|
||||||
|
|
|
@ -23,7 +23,6 @@ extern "C"
|
||||||
|
|
||||||
#define ST7789_DC CONFIG_LV_DISP_PIN_DC
|
#define ST7789_DC CONFIG_LV_DISP_PIN_DC
|
||||||
#define ST7789_RST CONFIG_LV_DISP_PIN_RST
|
#define ST7789_RST CONFIG_LV_DISP_PIN_RST
|
||||||
#define ST7789_BCKL CONFIG_LV_DISP_PIN_BCKL
|
|
||||||
|
|
||||||
#if CONFIG_LV_DISP_USE_RST
|
#if CONFIG_LV_DISP_USE_RST
|
||||||
#if CONFIG_LV_DISP_ST7789_SOFT_RESET
|
#if CONFIG_LV_DISP_ST7789_SOFT_RESET
|
||||||
|
@ -33,16 +32,8 @@ extern "C"
|
||||||
#define ST7789_SOFT_RST
|
#define ST7789_SOFT_RST
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#define ST7789_ENABLE_BACKLIGHT_CONTROL CONFIG_LV_ENABLE_BACKLIGHT_CONTROL
|
|
||||||
#define ST7789_INVERT_COLORS CONFIG_LV_INVERT_COLORS
|
#define ST7789_INVERT_COLORS CONFIG_LV_INVERT_COLORS
|
||||||
|
|
||||||
#if CONFIG_LV_BACKLIGHT_ACTIVE_LVL
|
|
||||||
#define ST7789_BCKL_ACTIVE_LVL 1
|
|
||||||
#else
|
|
||||||
#define ST7789_BCKL_ACTIVE_LVL 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* ST7789 commands */
|
/* ST7789 commands */
|
||||||
#define ST7789_NOP 0x00
|
#define ST7789_NOP 0x00
|
||||||
#define ST7789_SWRESET 0x01
|
#define ST7789_SWRESET 0x01
|
||||||
|
@ -121,7 +112,6 @@ extern "C"
|
||||||
|
|
||||||
void st7789_init(void);
|
void st7789_init(void);
|
||||||
void st7789_flush(lv_disp_drv_t *drv, const lv_area_t *area, lv_color_t *color_map);
|
void st7789_flush(lv_disp_drv_t *drv, const lv_area_t *area, lv_color_t *color_map);
|
||||||
void st7789_enable_backlight(bool backlight);
|
|
||||||
|
|
||||||
void st7789_send_cmd(uint8_t cmd);
|
void st7789_send_cmd(uint8_t cmd);
|
||||||
void st7789_send_data(void *data, uint16_t length);
|
void st7789_send_data(void *data, uint16_t length);
|
||||||
|
|
|
@ -81,16 +81,6 @@ void st7796s_init(void)
|
||||||
{0, {0}, 0xff},
|
{0, {0}, 0xff},
|
||||||
};
|
};
|
||||||
|
|
||||||
#if ST7796S_BCKL == 15
|
|
||||||
gpio_config_t io_conf;
|
|
||||||
io_conf.intr_type = GPIO_PIN_INTR_DISABLE;
|
|
||||||
io_conf.mode = GPIO_MODE_OUTPUT;
|
|
||||||
io_conf.pin_bit_mask = GPIO_SEL_15;
|
|
||||||
io_conf.pull_down_en = GPIO_PULLDOWN_DISABLE;
|
|
||||||
io_conf.pull_up_en = GPIO_PULLUP_DISABLE;
|
|
||||||
gpio_config(&io_conf);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//Initialize non-SPI GPIOs
|
//Initialize non-SPI GPIOs
|
||||||
gpio_pad_select_gpio(ST7796S_DC);
|
gpio_pad_select_gpio(ST7796S_DC);
|
||||||
gpio_set_direction(ST7796S_DC, GPIO_MODE_OUTPUT);
|
gpio_set_direction(ST7796S_DC, GPIO_MODE_OUTPUT);
|
||||||
|
@ -98,14 +88,7 @@ void st7796s_init(void)
|
||||||
#if ST7796S_USE_RST
|
#if ST7796S_USE_RST
|
||||||
gpio_pad_select_gpio(ST7796S_RST);
|
gpio_pad_select_gpio(ST7796S_RST);
|
||||||
gpio_set_direction(ST7796S_RST, GPIO_MODE_OUTPUT);
|
gpio_set_direction(ST7796S_RST, GPIO_MODE_OUTPUT);
|
||||||
#endif
|
|
||||||
|
|
||||||
#if ST7796S_ENABLE_BACKLIGHT_CONTROL
|
|
||||||
gpio_pad_select_gpio(ST7796S_BCKL);
|
|
||||||
gpio_set_direction(ST7796S_BCKL, GPIO_MODE_OUTPUT);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if ST7796S_USE_RST
|
|
||||||
//Reset the display
|
//Reset the display
|
||||||
gpio_set_level(ST7796S_RST, 0);
|
gpio_set_level(ST7796S_RST, 0);
|
||||||
vTaskDelay(100 / portTICK_RATE_MS);
|
vTaskDelay(100 / portTICK_RATE_MS);
|
||||||
|
@ -128,8 +111,6 @@ void st7796s_init(void)
|
||||||
cmd++;
|
cmd++;
|
||||||
}
|
}
|
||||||
|
|
||||||
st7796s_enable_backlight(true);
|
|
||||||
|
|
||||||
st7796s_set_orientation(CONFIG_LV_DISPLAY_ORIENTATION);
|
st7796s_set_orientation(CONFIG_LV_DISPLAY_ORIENTATION);
|
||||||
|
|
||||||
#if ST7796S_INVERT_COLORS == 1
|
#if ST7796S_INVERT_COLORS == 1
|
||||||
|
@ -167,22 +148,6 @@ void st7796s_flush(lv_disp_drv_t *drv, const lv_area_t *area, lv_color_t *color_
|
||||||
st7796s_send_color((void *)color_map, size * 2);
|
st7796s_send_color((void *)color_map, size * 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
void st7796s_enable_backlight(bool backlight)
|
|
||||||
{
|
|
||||||
#if ST7796S_ENABLE_BACKLIGHT_CONTROL
|
|
||||||
ESP_LOGI(TAG, "%s backlight.", backlight ? "Enabling" : "Disabling");
|
|
||||||
uint32_t tmp = 0;
|
|
||||||
|
|
||||||
#if (ST7796S_BCKL_ACTIVE_LVL == 1)
|
|
||||||
tmp = backlight ? 1 : 0;
|
|
||||||
#else
|
|
||||||
tmp = backlight ? 0 : 1;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
gpio_set_level(ST7796S_BCKL, tmp);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void st7796s_sleep_in()
|
void st7796s_sleep_in()
|
||||||
{
|
{
|
||||||
uint8_t data[] = {0x08};
|
uint8_t data[] = {0x08};
|
||||||
|
|
|
@ -29,17 +29,9 @@ extern "C"
|
||||||
#define ST7796S_DC CONFIG_LV_DISP_PIN_DC
|
#define ST7796S_DC CONFIG_LV_DISP_PIN_DC
|
||||||
#define ST7796S_RST CONFIG_LV_DISP_PIN_RST
|
#define ST7796S_RST CONFIG_LV_DISP_PIN_RST
|
||||||
#define ST7796S_USE_RST CONFIG_LV_DISP_USE_RST
|
#define ST7796S_USE_RST CONFIG_LV_DISP_USE_RST
|
||||||
#define ST7796S_BCKL CONFIG_LV_DISP_PIN_BCKL
|
|
||||||
|
|
||||||
#define ST7796S_ENABLE_BACKLIGHT_CONTROL CONFIG_LV_ENABLE_BACKLIGHT_CONTROL
|
|
||||||
#define ST7796S_INVERT_COLORS CONFIG_LV_INVERT_COLORS
|
#define ST7796S_INVERT_COLORS CONFIG_LV_INVERT_COLORS
|
||||||
#define ST7796S_DISPLAY_ORIENTATION CONFIG_LV_DISPLAY_ORIENTATION
|
#define ST7796S_DISPLAY_ORIENTATION CONFIG_LV_DISPLAY_ORIENTATION
|
||||||
|
|
||||||
#if CONFIG_LV_BACKLIGHT_ACTIVE_LVL
|
|
||||||
#define ST7796S_BCKL_ACTIVE_LVL 1
|
|
||||||
#else
|
|
||||||
#define ST7796S_BCKL_ACTIVE_LVL 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*******************
|
/*******************
|
||||||
* ST7796S REGS
|
* ST7796S REGS
|
||||||
|
@ -119,7 +111,6 @@ extern "C"
|
||||||
|
|
||||||
void st7796s_init(void);
|
void st7796s_init(void);
|
||||||
void st7796s_flush(lv_disp_drv_t *drv, const lv_area_t *area, lv_color_t *color_map);
|
void st7796s_flush(lv_disp_drv_t *drv, const lv_area_t *area, lv_color_t *color_map);
|
||||||
void st7796s_enable_backlight(bool backlight);
|
|
||||||
|
|
||||||
/**********************
|
/**********************
|
||||||
* MACROS
|
* MACROS
|
||||||
|
|
Loading…
Reference in a new issue