#75 Update lvgl_tft

This commit is contained in:
martinberlin 2022-01-02 12:28:43 +01:00
parent 2868e219fc
commit 63bc5f4cf7
2 changed files with 37 additions and 2 deletions

View file

@ -6,7 +6,7 @@
#include "disp_spi.h" #include "disp_spi.h"
void disp_driver_init(void) void *disp_driver_init(void)
{ {
#if defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_ILI9341 #if defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_ILI9341
ili9341_init(); ili9341_init();
@ -44,6 +44,33 @@ void disp_driver_init(void)
uc8151d_init(); uc8151d_init();
#elif defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_ILI9163C #elif defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_ILI9163C
ili9163c_init(); ili9163c_init();
#elif defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_PCD8544
pcd8544_init();
#endif
// We still use menuconfig for these settings
// It will be set up during runtime in the future
#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
.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
};
disp_backlight_h bckl_handle = disp_backlight_new(&bckl_config);
disp_backlight_set(bckl_handle, 100);
return bckl_handle;
#else
return NULL;
#endif #endif
} }
@ -85,6 +112,8 @@ void disp_driver_flush(lv_disp_drv_t * drv, const lv_area_t * area, lv_color_t *
uc8151d_lv_fb_flush(drv, area, color_map); uc8151d_lv_fb_flush(drv, area, color_map);
#elif defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_ILI9163C #elif defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_ILI9163C
ili9163c_flush(drv, area, color_map); ili9163c_flush(drv, area, color_map);
#elif defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_PCD8544
pcd8544_flush(drv, area, color_map);
#endif #endif
} }
@ -101,6 +130,8 @@ void disp_driver_rounder(lv_disp_drv_t * disp_drv, lv_area_t * area)
jd79653a_lv_rounder_cb(disp_drv, area); jd79653a_lv_rounder_cb(disp_drv, area);
#elif defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_UC8151D #elif defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_UC8151D
uc8151d_lv_rounder_cb(disp_drv, area); uc8151d_lv_rounder_cb(disp_drv, area);
#elif defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_PCD8544
pcd8544_rounder(disp_drv, area);
#endif #endif
} }
@ -119,5 +150,7 @@ void disp_driver_set_px(lv_disp_drv_t * disp_drv, uint8_t * buf, lv_coord_t buf_
jd79653a_lv_set_fb_cb(disp_drv, buf, buf_w, x, y, color, opa); jd79653a_lv_set_fb_cb(disp_drv, buf, buf_w, x, y, color, opa);
#elif defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_UC8151D #elif defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_UC8151D
uc8151d_lv_set_fb_cb(disp_drv, buf, buf_w, x, y, color, opa); uc8151d_lv_set_fb_cb(disp_drv, buf, buf_w, x, y, color, opa);
#elif defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_PCD8544
pcd8544_set_px_cb(disp_drv, buf, buf_w, x, y, color, opa);
#endif #endif
} }

View file

@ -54,6 +54,8 @@ extern "C" {
#include "uc8151d.h" #include "uc8151d.h"
#elif defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_ILI9163C #elif defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_ILI9163C
#include "ili9163c.h" #include "ili9163c.h"
#elif defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_PCD8544
#include "pcd8544.h"
#endif #endif
/********************* /*********************
@ -69,7 +71,7 @@ extern "C" {
**********************/ **********************/
/* Initialize display */ /* Initialize display */
void disp_driver_init(void); void *disp_driver_init(void);
/* Display flush callback */ /* Display flush callback */
void disp_driver_flush(lv_disp_drv_t * drv, const lv_area_t * area, lv_color_t * color_map); void disp_driver_flush(lv_disp_drv_t * drv, const lv_area_t * area, lv_color_t * color_map);