diff --git a/lvgl_tft/GC9A01.c b/lvgl_tft/GC9A01.c index 6f32051..c807233 100644 --- a/lvgl_tft/GC9A01.c +++ b/lvgl_tft/GC9A01.c @@ -111,31 +111,14 @@ 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 - gpio_pad_select_gpio(GC9A01_DC); + gpio_pad_select_gpio(GC9A01_DC); gpio_set_direction(GC9A01_DC, GPIO_MODE_OUTPUT); #if GC9A01_USE_RST - gpio_pad_select_gpio(GC9A01_RST); + gpio_pad_select_gpio(GC9A01_RST); 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 gpio_set_level(GC9A01_RST, 0); vTaskDelay(100 / portTICK_RATE_MS); @@ -156,8 +139,6 @@ void GC9A01_init(void) cmd++; } - GC9A01_enable_backlight(true); - GC9A01_set_orientation(CONFIG_LV_DISPLAY_ORIENTATION); #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); } -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() { uint8_t data[] = {0x08}; diff --git a/lvgl_tft/GC9A01.h b/lvgl_tft/GC9A01.h index 2995811..e39c14d 100644 --- a/lvgl_tft/GC9A01.h +++ b/lvgl_tft/GC9A01.h @@ -25,19 +25,9 @@ extern "C" { /********************* * DEFINES *********************/ -#define GC9A01_DC CONFIG_LV_DISP_PIN_DC -#define GC9A01_RST CONFIG_LV_DISP_PIN_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_DC CONFIG_LV_DISP_PIN_DC +#define GC9A01_RST CONFIG_LV_DISP_PIN_RST +#define GC9A01_USE_RST CONFIG_LV_DISP_USE_RST #define GC9A01_INVERT_COLORS CONFIG_LV_INVERT_COLORS /********************** @@ -50,7 +40,6 @@ extern "C" { void GC9A01_init(void); 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_out(void); diff --git a/lvgl_tft/hx8357.c b/lvgl_tft/hx8357.c index 6b6cd34..bb9ea58 100644 --- a/lvgl_tft/hx8357.c +++ b/lvgl_tft/hx8357.c @@ -160,20 +160,13 @@ static uint8_t displayType = HX8357D; void hx8357_init(void) { //Initialize non-SPI GPIOs - gpio_pad_select_gpio(HX8357_DC); + gpio_pad_select_gpio(HX8357_DC); gpio_set_direction(HX8357_DC, GPIO_MODE_OUTPUT); #if HX8357_USE_RST - gpio_pad_select_gpio(HX8357_RST); + gpio_pad_select_gpio(HX8357_RST); 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 gpio_set_level(HX8357_RST, 0); vTaskDelay(10 / portTICK_RATE_MS); @@ -210,8 +203,6 @@ void hx8357_init(void) #else hx8357_send_cmd(HX8357_INVOFF); #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); } -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) { r = r & 3; // can't be higher than 3 diff --git a/lvgl_tft/hx8357.h b/lvgl_tft/hx8357.h index 1e54627..34cbaf9 100644 --- a/lvgl_tft/hx8357.h +++ b/lvgl_tft/hx8357.h @@ -35,19 +35,10 @@ extern "C" { /********************* * DEFINES *********************/ -#define HX8357_DC CONFIG_LV_DISP_PIN_DC -#define HX8357_RST CONFIG_LV_DISP_PIN_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 - -#if CONFIG_LV_BACKLIGHT_ACTIVE_LVL - #define HX8357_BCKL_ACTIVE_LVL 1 -#else - #define HX8357_BCKL_ACTIVE_LVL 0 -#endif +#define HX8357_DC CONFIG_LV_DISP_PIN_DC +#define HX8357_RST CONFIG_LV_DISP_PIN_RST +#define HX8357_USE_RST CONFIG_LV_DISP_USE_RST +#define HX8357_INVERT_COLORS CONFIG_LV_INVERT_COLORS /******************* @@ -136,7 +127,6 @@ extern "C" { void hx8357_init(void); 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); /********************** diff --git a/lvgl_tft/il3820.c b/lvgl_tft/il3820.c index fee39e2..1ce0b39 100644 --- a/lvgl_tft/il3820.c +++ b/lvgl_tft/il3820.c @@ -199,15 +199,13 @@ void il3820_init(void) gpio_pad_select_gpio(IL3820_DC_PIN); 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_set_direction(IL3820_BUSY_PIN, GPIO_MODE_INPUT); #if IL3820_USE_RST + gpio_pad_select_gpio(IL3820_RST_PIN); + gpio_set_direction(IL3820_RST_PIN, GPIO_MODE_OUTPUT); + /* Harware reset */ gpio_set_level( IL3820_RST_PIN, 0); vTaskDelay(IL3820_RESET_DELAY / portTICK_RATE_MS); diff --git a/lvgl_tft/ili9163c.c b/lvgl_tft/ili9163c.c index 77346e4..059d076 100644 --- a/lvgl_tft/ili9163c.c +++ b/lvgl_tft/ili9163c.c @@ -143,10 +143,6 @@ void ili9163c_init(void) gpio_pad_select_gpio(ILI9163C_RST); 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 gpio_set_level(ILI9163C_RST, 0); vTaskDelay(100 / portTICK_RATE_MS); @@ -166,8 +162,6 @@ void ili9163c_init(void) cmd++; } - ili9163c_enable_backlight(true); - 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); } -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() { uint8_t data[] = {0x08}; diff --git a/lvgl_tft/ili9163c.h b/lvgl_tft/ili9163c.h index f164ba8..d6edf57 100644 --- a/lvgl_tft/ili9163c.h +++ b/lvgl_tft/ili9163c.h @@ -26,35 +26,24 @@ extern "C" /********************* * DEFINES *********************/ -#define ILI9163C_DC CONFIG_LV_DISP_PIN_DC -#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_DC CONFIG_LV_DISP_PIN_DC +#define ILI9163C_RST CONFIG_LV_DISP_PIN_RST #define ILI9163C_INVERT_COLORS CONFIG_LV_INVERT_COLORS - /********************** +/********************** * TYPEDEFS **********************/ - /********************** +/********************** * GLOBAL PROTOTYPES **********************/ - void ili9163c_init(void); - 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_out(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_sleep_in(void); +void ili9163c_sleep_out(void); - /********************** +/********************** * MACROS **********************/ diff --git a/lvgl_tft/ili9341.c b/lvgl_tft/ili9341.c index 23aba09..e91680f 100644 --- a/lvgl_tft/ili9341.c +++ b/lvgl_tft/ili9341.c @@ -80,30 +80,14 @@ void ili9341_init(void) {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 - gpio_pad_select_gpio(ILI9341_DC); + gpio_pad_select_gpio(ILI9341_DC); gpio_set_direction(ILI9341_DC, GPIO_MODE_OUTPUT); + #if ILI9341_USE_RST - gpio_pad_select_gpio(ILI9341_RST); + gpio_pad_select_gpio(ILI9341_RST); 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 gpio_set_level(ILI9341_RST, 0); vTaskDelay(100 / portTICK_RATE_MS); @@ -124,9 +108,7 @@ void ili9341_init(void) cmd++; } - ili9341_enable_backlight(true); - - ili9341_set_orientation(CONFIG_LV_DISPLAY_ORIENTATION); + ili9341_set_orientation(CONFIG_LV_DISPLAY_ORIENTATION); #if ILI9341_INVERT_COLORS == 1 ili9341_send_cmd(0x21); @@ -158,29 +140,10 @@ void ili9341_flush(lv_disp_drv_t * drv, const lv_area_t * area, lv_color_t * col /*Memory write*/ ili9341_send_cmd(0x2C); - - uint32_t size = lv_area_get_width(area) * lv_area_get_height(area); - 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() { uint8_t data[] = {0x08}; diff --git a/lvgl_tft/ili9341.h b/lvgl_tft/ili9341.h index e0058b1..62317e8 100644 --- a/lvgl_tft/ili9341.h +++ b/lvgl_tft/ili9341.h @@ -29,16 +29,6 @@ extern "C" { #define ILI9341_DC CONFIG_LV_DISP_PIN_DC #define ILI9341_USE_RST CONFIG_LV_DISP_USE_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 /********************** @@ -51,7 +41,6 @@ extern "C" { void ili9341_init(void); 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_out(void); diff --git a/lvgl_tft/ili9481.c b/lvgl_tft/ili9481.c index f80c810..74bda98 100644 --- a/lvgl_tft/ili9481.c +++ b/lvgl_tft/ili9481.c @@ -80,14 +80,7 @@ void ili9481_init(void) #if ILI9481_USE_RST gpio_pad_select_gpio(ILI9481_RST); 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 gpio_set_level(ILI9481_RST, 0); vTaskDelay(100 / portTICK_RATE_MS); @@ -112,8 +105,6 @@ void ili9481_init(void) cmd++; } - ili9481_enable_backlight(true); - 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); } -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 **********************/ diff --git a/lvgl_tft/ili9481.h b/lvgl_tft/ili9481.h index c0d07fe..1562398 100644 --- a/lvgl_tft/ili9481.h +++ b/lvgl_tft/ili9481.h @@ -25,20 +25,12 @@ extern "C" { /********************* * DEFINES *********************/ -#define ILI9481_DC CONFIG_LV_DISP_PIN_DC -#define ILI9481_RST CONFIG_LV_DISP_PIN_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_DC CONFIG_LV_DISP_PIN_DC +#define ILI9481_RST CONFIG_LV_DISP_PIN_RST +#define ILI9481_USE_RST CONFIG_LV_DISP_USE_RST +#define ILI9481_INVERT_COLORS CONFIG_LV_INVERT_COLORS #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 @@ -118,7 +110,6 @@ extern "C" { void ili9481_init(void); 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 diff --git a/lvgl_tft/ili9486.c b/lvgl_tft/ili9486.c index 166bef8..829f0bd 100644 --- a/lvgl_tft/ili9486.c +++ b/lvgl_tft/ili9486.c @@ -65,31 +65,14 @@ void ili9486_init(void) {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 - gpio_pad_select_gpio(ILI9486_DC); + gpio_pad_select_gpio(ILI9486_DC); gpio_set_direction(ILI9486_DC, GPIO_MODE_OUTPUT); #if ILI9486_USE_RST - gpio_pad_select_gpio(ILI9486_RST); + gpio_pad_select_gpio(ILI9486_RST); 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 gpio_set_level(ILI9486_RST, 0); vTaskDelay(100 / portTICK_RATE_MS); @@ -110,9 +93,7 @@ void ili9486_init(void) cmd++; } - ili9486_enable_backlight(true); - - ili9486_set_orientation(CONFIG_LV_DISPLAY_ORIENTATION); + ili9486_set_orientation(CONFIG_LV_DISPLAY_ORIENTATION); } void ili9486_flush(lv_disp_drv_t * drv, const lv_area_t * area, lv_color_t * color_map) @@ -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); } -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 **********************/ diff --git a/lvgl_tft/ili9486.h b/lvgl_tft/ili9486.h index 08e002f..0b3f4fb 100644 --- a/lvgl_tft/ili9486.h +++ b/lvgl_tft/ili9486.h @@ -28,15 +28,7 @@ extern "C" { #define ILI9486_DC CONFIG_LV_DISP_PIN_DC #define ILI9486_RST CONFIG_LV_DISP_PIN_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 @@ -48,7 +40,6 @@ extern "C" { void ili9486_init(void); 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 diff --git a/lvgl_tft/ili9488.c b/lvgl_tft/ili9488.c index ce8bba0..feb9fba 100644 --- a/lvgl_tft/ili9488.c +++ b/lvgl_tft/ili9488.c @@ -76,20 +76,13 @@ void ili9488_init(void) }; //Initialize non-SPI GPIOs - gpio_pad_select_gpio(ILI9488_DC); + gpio_pad_select_gpio(ILI9488_DC); gpio_set_direction(ILI9488_DC, GPIO_MODE_OUTPUT); #if ILI9488_USE_RST - gpio_pad_select_gpio(ILI9488_RST); + gpio_pad_select_gpio(ILI9488_RST); 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 gpio_set_level(ILI9488_RST, 0); vTaskDelay(100 / portTICK_RATE_MS); @@ -114,9 +107,7 @@ void ili9488_init(void) cmd++; } - ili9488_enable_backlight(true); - - ili9488_set_orientation(CONFIG_LV_DISPLAY_ORIENTATION); + ili9488_set_orientation(CONFIG_LV_DISPLAY_ORIENTATION); } // Flush function based on mvturnho repo @@ -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); } -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 **********************/ diff --git a/lvgl_tft/ili9488.h b/lvgl_tft/ili9488.h index 2ecfd44..1c6c6f9 100644 --- a/lvgl_tft/ili9488.h +++ b/lvgl_tft/ili9488.h @@ -27,16 +27,7 @@ extern "C" { *********************/ #define ILI9488_DC CONFIG_LV_DISP_PIN_DC #define ILI9488_RST CONFIG_LV_DISP_PIN_RST -#define ILI9488_USE_RST CONFIG_LV_DISP_USE_RST -#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 +#define ILI9488_USE_RST CONFIG_LV_DISP_USE_RSTS /******************* * ILI9488 REGS @@ -155,7 +146,6 @@ typedef struct { void ili9488_init(void); 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 diff --git a/lvgl_tft/ra8875.c b/lvgl_tft/ra8875.c index c08ff88..b4f8e2a 100644 --- a/lvgl_tft/ra8875.c +++ b/lvgl_tft/ra8875.c @@ -148,29 +148,12 @@ void ra8875_init(void) 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 #if RA8875_USE_RST gpio_pad_select_gpio(RA8875_RST); 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 gpio_set_level(RA8875_RST, 0); 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."); } - // Enable the display and backlight + // Enable the display 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) diff --git a/lvgl_tft/ra8875.h b/lvgl_tft/ra8875.h index 6942c3e..28c77f9 100644 --- a/lvgl_tft/ra8875.h +++ b/lvgl_tft/ra8875.h @@ -97,7 +97,6 @@ extern "C" { **********************/ void ra8875_init(void); -void ra8875_enable_backlight(bool backlight); void ra8875_enable_display(bool enable); void ra8875_flush(lv_disp_drv_t * drv, const lv_area_t * area, lv_color_t * color_map); diff --git a/lvgl_tft/st7735s.h b/lvgl_tft/st7735s.h index 7422be6..2d02ed0 100644 --- a/lvgl_tft/st7735s.h +++ b/lvgl_tft/st7735s.h @@ -131,7 +131,6 @@ extern "C" { void st7735s_init(void); 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_out(void); diff --git a/lvgl_tft/st7789.c b/lvgl_tft/st7789.c index 9a79022..962eb44 100644 --- a/lvgl_tft/st7789.c +++ b/lvgl_tft/st7789.c @@ -94,11 +94,6 @@ void st7789_init(void) gpio_set_direction(ST7789_RST, GPIO_MODE_OUTPUT); #endif -#if ST7789_ENABLE_BACKLIGHT_CONTROL - gpio_pad_select_gpio(ST7789_BCKL); - gpio_set_direction(ST7789_BCKL, GPIO_MODE_OUTPUT); -#endif - //Reset the display #if !defined(ST7789_SOFT_RST) gpio_set_level(ST7789_RST, 0); @@ -122,27 +117,9 @@ void st7789_init(void) cmd++; } - st7789_enable_backlight(true); - 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 * 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. */ diff --git a/lvgl_tft/st7789.h b/lvgl_tft/st7789.h index 64ac3f1..cacb31b 100644 --- a/lvgl_tft/st7789.h +++ b/lvgl_tft/st7789.h @@ -23,7 +23,6 @@ extern "C" #define ST7789_DC CONFIG_LV_DISP_PIN_DC #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_ST7789_SOFT_RESET @@ -33,16 +32,8 @@ extern "C" #define ST7789_SOFT_RST #endif - -#define ST7789_ENABLE_BACKLIGHT_CONTROL CONFIG_LV_ENABLE_BACKLIGHT_CONTROL #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 */ #define ST7789_NOP 0x00 #define ST7789_SWRESET 0x01 @@ -121,7 +112,6 @@ extern "C" void st7789_init(void); 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_data(void *data, uint16_t length); diff --git a/lvgl_tft/st7796s.c b/lvgl_tft/st7796s.c index 44959f8..7de92ef 100644 --- a/lvgl_tft/st7796s.c +++ b/lvgl_tft/st7796s.c @@ -81,16 +81,6 @@ void st7796s_init(void) {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 gpio_pad_select_gpio(ST7796S_DC); gpio_set_direction(ST7796S_DC, GPIO_MODE_OUTPUT); @@ -98,14 +88,7 @@ void st7796s_init(void) #if ST7796S_USE_RST gpio_pad_select_gpio(ST7796S_RST); 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 gpio_set_level(ST7796S_RST, 0); vTaskDelay(100 / portTICK_RATE_MS); @@ -128,8 +111,6 @@ void st7796s_init(void) cmd++; } - st7796s_enable_backlight(true); - st7796s_set_orientation(CONFIG_LV_DISPLAY_ORIENTATION); #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); } -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() { uint8_t data[] = {0x08}; diff --git a/lvgl_tft/st7796s.h b/lvgl_tft/st7796s.h index 48e566d..95c6d4f 100644 --- a/lvgl_tft/st7796s.h +++ b/lvgl_tft/st7796s.h @@ -26,20 +26,12 @@ extern "C" /********************* * DEFINES *********************/ -#define ST7796S_DC CONFIG_LV_DISP_PIN_DC -#define ST7796S_RST CONFIG_LV_DISP_PIN_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_DC CONFIG_LV_DISP_PIN_DC +#define ST7796S_RST CONFIG_LV_DISP_PIN_RST +#define ST7796S_USE_RST CONFIG_LV_DISP_USE_RST +#define ST7796S_INVERT_COLORS CONFIG_LV_INVERT_COLORS #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 @@ -119,7 +111,6 @@ extern "C" void st7796s_init(void); 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