display_bsp: Move IO initialization here

This commit is contained in:
C47D 2021-07-29 19:04:39 -05:00
parent 49a3ba84b4
commit 6122d139de
2 changed files with 19 additions and 0 deletions

View file

@ -6,6 +6,24 @@
#include "sdkconfig.h" #include "sdkconfig.h"
#include "driver/gpio.h" #include "driver/gpio.h"
void display_bsp_init_io(void)
{
#ifdef CONFIG_LV_DISPLAY_USE_DC
gpio_pad_select_gpio(CONFIG_LV_DISP_PIN_DC);
gpio_set_direction(CONFIG_LV_DISP_PIN_DC, GPIO_MODE_OUTPUT);
#endif
#ifdef CONFIG_LV_DISP_USE_RST
gpio_pad_select_gpio(CONFIG_LV_DISP_PIN_RST);
gpio_set_direction(CONFIG_LV_DISP_PIN_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
}
void display_bsp_delay(uint32_t delay_ms) void display_bsp_delay(uint32_t delay_ms)
{ {
vTaskDelay(pdMS_TO_TICKS(delay_ms)); vTaskDelay(pdMS_TO_TICKS(delay_ms));

View file

@ -1,6 +1,7 @@
#ifndef DISPLAY_BSP_H_ #ifndef DISPLAY_BSP_H_
#define DISPLAY_BSP_H_ #define DISPLAY_BSP_H_
void display_bsp_init_io(void);
void display_bsp_delay(uint32_t delay_ms); void display_bsp_delay(uint32_t delay_ms);
void display_bsp_backlight(uint8_t state); void display_bsp_backlight(uint8_t state);
void display_bsp_gpio_dc(uint8_t state); void display_bsp_gpio_dc(uint8_t state);