From 49a3ba84b4e94f494ab375135c3802170dc77aeb Mon Sep 17 00:00:00 2001 From: C47D Date: Thu, 29 Jul 2021 18:56:22 -0500 Subject: [PATCH] display bsp: Move ESP32 pin specific code to display_bsp --- lvgl_tft/display_bsp.c | 33 +++++++++++++++++++++++++++++++++ lvgl_tft/display_bsp.h | 9 +++++++++ 2 files changed, 42 insertions(+) create mode 100644 lvgl_tft/display_bsp.c create mode 100644 lvgl_tft/display_bsp.h diff --git a/lvgl_tft/display_bsp.c b/lvgl_tft/display_bsp.c new file mode 100644 index 0000000..965d64f --- /dev/null +++ b/lvgl_tft/display_bsp.c @@ -0,0 +1,33 @@ +#include "freertos/FreeRTOS.h" +#include "freertos/task.h" + +#include "display_bsp.h" + +#include "sdkconfig.h" +#include "driver/gpio.h" + +void display_bsp_delay(uint32_t delay_ms) +{ + vTaskDelay(pdMS_TO_TICKS(delay_ms)); +} + +void display_bsp_backlight(uint8_t state) +{ +#ifdef CONFIG_LV_DISP_PIN_BCKL + gpio_set_level(CONFIG_LV_DISP_PIN_BCKL, state); +#endif +} + +void display_bsp_gpio_dc(uint8_t state) +{ +#ifdef CONFIG_LV_DISPLAY_USE_DC + gpio_set_level(CONFIG_LV_DISP_PIN_DC, state); +#endif +} + +void display_bsp_gpio_rst(uint8_t state) +{ +#ifdef CONFIG_LV_DISP_USE_RST + gpio_set_level(CONFIG_LV_DISP_PIN_RST, state); +#endif +} diff --git a/lvgl_tft/display_bsp.h b/lvgl_tft/display_bsp.h new file mode 100644 index 0000000..3de8795 --- /dev/null +++ b/lvgl_tft/display_bsp.h @@ -0,0 +1,9 @@ +#ifndef DISPLAY_BSP_H_ +#define DISPLAY_BSP_H_ + +void display_bsp_delay(uint32_t delay_ms); +void display_bsp_backlight(uint8_t state); +void display_bsp_gpio_dc(uint8_t state); +void display_bsp_gpio_rst(uint8_t state); + +#endif