Carve out backlight control to separate component
This commit is contained in:
parent
678779c848
commit
fa042b0ecd
6 changed files with 227 additions and 108 deletions
|
@ -4,8 +4,10 @@
|
|||
|
||||
#include "disp_driver.h"
|
||||
#include "disp_spi.h"
|
||||
#include "esp_lcd_backlight.h"
|
||||
#include "sdkconfig.h"
|
||||
|
||||
void disp_driver_init(void)
|
||||
void *disp_driver_init(void)
|
||||
{
|
||||
#if defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_ILI9341
|
||||
ili9341_init();
|
||||
|
@ -42,6 +44,34 @@ void disp_driver_init(void)
|
|||
#elif defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_ILI9163C
|
||||
ili9163c_init();
|
||||
#endif
|
||||
|
||||
// We still use menuconfig for these settings
|
||||
// It will be set up during runtime in the future
|
||||
#ifndef CONFIG_LV_DISP_BACKLIGHT_OFF
|
||||
const disp_backlight_config_t bckl_config = {
|
||||
.gpio_num = CONFIG_LV_DISP_PIN_BCKL,
|
||||
#if defined CONFIG_LV_DISP_BACKLIGHT_PWM
|
||||
.pwm_control = true,
|
||||
#else
|
||||
.pwm_control = false,
|
||||
#endif
|
||||
#if defined CONFIG_LV_BACKLIGHT_ACTIVE_LVL
|
||||
.output_invert = false, // Backlight on high
|
||||
#else
|
||||
.output_invert = true, // Backlight on low
|
||||
#endif
|
||||
.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_set(bckl_handle, 100);
|
||||
|
||||
return bckl_handle;
|
||||
}
|
||||
|
||||
void disp_driver_flush(lv_disp_drv_t * drv, const lv_area_t * area, lv_color_t * color_map)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue