Merge branch 'fix/backlight-off' into develop

This commit is contained in:
Tomas Rezucha 2021-08-11 21:02:57 +02:00
commit 72a5d3da79
3 changed files with 13 additions and 18 deletions

View file

@ -934,16 +934,9 @@ menu "LVGL TFT Display controller"
endchoice
choice
default LV_DISP_BACKLIGHT_SWITCH
prompt "Backlight Control" if \
(! ( LV_TFT_DISPLAY_CONTROLLER_SH1107 || LV_TFT_DISPLAY_CONTROLLER_SSD1306 ) )
default LV_DISP_BACKLIGHT_SWITCH if LV_PREDEFINED_DISPLAY_M5STACK
default LV_DISP_BACKLIGHT_OFF if LV_PREDEFINED_DISPLAY_M5CORE2
default LV_DISP_BACKLIGHT_SWITCH if LV_PREDEFINED_DISPLAY_WROVER4
default LV_DISP_BACKLIGHT_SWITCH if LV_PREDEFINED_DISPLAY_ERTFT0356
default LV_DISP_BACKLIGHT_SWITCH if LV_PREDEFINED_DISPLAY_TTGO
default LV_DISP_BACKLIGHT_SWITCH if LV_PREDEFINED_DISPLAY_TTGO_CAMERA_PLUS
default LV_DISP_BACKLIGHT_SWITCH if LV_PREDEFINED_DISPLAY_WT32_SC01
default LV_DISP_BACKLIGHT_OFF
config LV_DISP_BACKLIGHT_OFF
bool
@ -995,7 +988,7 @@ menu "LVGL TFT Display controller"
default 4 if LV_PREDEFINED_DISPLAY_TTGO
default 2 if LV_PREDEFINED_DISPLAY_TTGO_CAMERA_PLUS
default 23 if LV_PREDEFINED_DISPLAY_WT32_SC01
default 27
default -1
help
Configure the display BCLK (LED) pin here.

View file

@ -47,7 +47,7 @@ void *disp_driver_init(void)
// We still use menuconfig for these settings
// It will be set up during runtime in the future
#ifndef CONFIG_LV_DISP_BACKLIGHT_OFF
#if (defined(CONFIG_LV_DISP_BACKLIGHT_SWITCH) || defined(CONFIG_LV_DISP_BACKLIGHT_PWM))
const disp_backlight_config_t bckl_config = {
.gpio_num = CONFIG_LV_DISP_PIN_BCKL,
#if defined CONFIG_LV_DISP_BACKLIGHT_PWM
@ -63,15 +63,12 @@ void *disp_driver_init(void)
.timer_idx = 0,
.channel_idx = 0 // @todo this prevents us from having two PWM controlled displays
};
const disp_backlight_config_t *bckl_config_p = &bckl_config;
#else
const disp_backlight_config_t *bckl_config_p = NULL;
#endif
disp_backlight_h bckl_handle = disp_backlight_new(bckl_config_p);
disp_backlight_h bckl_handle = disp_backlight_new(&bckl_config);
disp_backlight_set(bckl_handle, 100);
return bckl_handle;
#else
return NULL;
#endif
}
void disp_driver_flush(lv_disp_drv_t * drv, const lv_area_t * area, lv_color_t * color_map)

View file

@ -22,11 +22,16 @@ static const char *TAG = "disp_backlight";
disp_backlight_h disp_backlight_new(const disp_backlight_config_t *config)
{
// Check input parameters
if (config == NULL)
return NULL;
if (!GPIO_IS_VALID_OUTPUT_GPIO(config->gpio_num)) {
ESP_LOGW(TAG, "Invalid GPIO number");
return NULL;
}
disp_backlight_t *bckl_dev = calloc(1, sizeof(disp_backlight_t));
if (bckl_dev == NULL){
ESP_LOGW(TAG, "Could not create new LCD backlight instance");
ESP_LOGW(TAG, "Not enough memory");
return NULL;
}