Fix: change LCD backlight to use ledc pwm driver instead of gpio. Fixes #13

Refs: #13
main
rkcf 2023-02-04 18:31:49 -06:00
parent 69d9914c4c
commit bb63df4f61
1 changed files with 11 additions and 3 deletions

View File

@ -298,10 +298,18 @@ static void lvgl_increase_tick(void *arg) {
/* Setup for TFT LCD Display and LVGL GUI */ /* Setup for TFT LCD Display and LVGL GUI */
static void display_init(void) { static void display_init(void) {
ESP_LOGI(TAG, "Initialing LCD"); ESP_LOGI(TAG, "Initialing LCD");
// Configure backlight // Configure backlight
gpio_reset_pin(LCD_BK_LIGHT_PIN); ledc_channel_config_t ledc_lcd_bk_light_channel = {
gpio_set_direction(LCD_BK_LIGHT_PIN, GPIO_MODE_OUTPUT); .channel = LEDC_CHANNEL_2,
gpio_set_level(LCD_BK_LIGHT_PIN, 1); .gpio_num = LCD_BK_LIGHT_PIN,
.speed_mode = LEDC_LOW_SPEED_MODE,
.timer_sel = LEDC_TIMER_0,
.intr_type = LEDC_INTR_DISABLE,
.duty = 3000,
.hpoint = 0
};
ESP_ERROR_CHECK(ledc_channel_config(&ledc_lcd_bk_light_channel));
// Setup SPI Bus // Setup SPI Bus
spi_bus_config_t spi_cfg = { spi_bus_config_t spi_cfg = {