Merge pull request #129 from lvgl/feat/add_gpio_helper

Update (initialization) helpers
This commit is contained in:
Carlos Diaz 2021-10-13 19:15:22 -05:00 committed by GitHub
commit 0a924fc1b6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 35 additions and 0 deletions

View file

@ -134,6 +134,39 @@ void lvgl_driver_init(void)
#endif
}
void display_bsp_init_io(void)
{
esp_err_t err = ESP_OK;
gpio_config_t io_conf;
#ifdef CONFIG_LV_DISPLAY_USE_DC
io_conf.mode = GPIO_MODE_OUTPUT;
io_conf.pin_bit_mask = (1ULL << CONFIG_LV_DISP_PIN_DC);
err = gpio_config(&io_conf);
ESP_ERROR_CHECK(err);
#endif
#ifdef CONFIG_LV_DISP_USE_RST
io_conf.mode = GPIO_MODE_OUTPUT;
io_conf.pin_bit_mask = (1ULL << CONFIG_LV_DISP_PIN_RST);
err = gpio_config(&io_conf);
ESP_ERROR_CHECK(err);
#endif
#ifndef CONFIG_LV_DISP_BACKLIGHT_OFF
io_conf.mode = GPIO_MODE_OUTPUT;
io_conf.pin_bit_mask = (1ULL << CONFIG_LV_DISP_PIN_BCKL);
err = gpio_config(&io_conf);
ESP_ERROR_CHECK(err);
#endif
#ifdef CONFIG_LV_DISP_PIN_BUSY
io_conf.mode = GPIO_MODE_INPUT;
io_conf.pin_bit_mask = (1ULL << CONFIG_LV_DISP_PIN_BUSY);
err = gpio_config(&io_conf);
ESP_ERROR_CHECK(err);
#endif
}
/* Initialize spi bus master
*

View file

@ -98,6 +98,8 @@ void lvgl_driver_init(void);
bool lvgl_spi_driver_init(int host, int miso_pin, int mosi_pin, int sclk_pin,
int max_transfer_sz, int dma_channel, int quadwp_pin, int quadhd_pin);
/* Initialize display GPIOs, e.g. DC and RST pins */
void display_bsp_init_io(void);
/**********************
* MACROS
**********************/