Update TFT drivers for new backligh control

This commit is contained in:
Tomas Rezucha 2021-08-03 14:17:58 +02:00
parent fa042b0ecd
commit 3c4399d510
22 changed files with 43 additions and 437 deletions

View file

@ -65,31 +65,14 @@ void ili9486_init(void)
{0x00, {0}, 0xff},
};
#if ILI9486_BCKL == 15
gpio_config_t io_conf;
io_conf.intr_type = GPIO_PIN_INTR_DISABLE;
io_conf.mode = GPIO_MODE_OUTPUT;
io_conf.pin_bit_mask = GPIO_SEL_15;
io_conf.pull_down_en = GPIO_PULLDOWN_DISABLE;
io_conf.pull_up_en = GPIO_PULLUP_DISABLE;
gpio_config(&io_conf);
#endif
//Initialize non-SPI GPIOs
gpio_pad_select_gpio(ILI9486_DC);
gpio_pad_select_gpio(ILI9486_DC);
gpio_set_direction(ILI9486_DC, GPIO_MODE_OUTPUT);
#if ILI9486_USE_RST
gpio_pad_select_gpio(ILI9486_RST);
gpio_pad_select_gpio(ILI9486_RST);
gpio_set_direction(ILI9486_RST, GPIO_MODE_OUTPUT);
#endif
#if ILI9486_ENABLE_BACKLIGHT_CONTROL
gpio_pad_select_gpio(ILI9486_BCKL);
gpio_set_direction(ILI9486_BCKL, GPIO_MODE_OUTPUT);
#endif
#if ILI9486_USE_RST
//Reset the display
gpio_set_level(ILI9486_RST, 0);
vTaskDelay(100 / portTICK_RATE_MS);
@ -110,9 +93,7 @@ void ili9486_init(void)
cmd++;
}
ili9486_enable_backlight(true);
ili9486_set_orientation(CONFIG_LV_DISPLAY_ORIENTATION);
ili9486_set_orientation(CONFIG_LV_DISPLAY_ORIENTATION);
}
void ili9486_flush(lv_disp_drv_t * drv, const lv_area_t * area, lv_color_t * color_map)
@ -144,22 +125,6 @@ void ili9486_flush(lv_disp_drv_t * drv, const lv_area_t * area, lv_color_t * col
ili9486_send_color((void*) color_map, size * 2);
}
void ili9486_enable_backlight(bool backlight)
{
#if ILI9486_ENABLE_BACKLIGHT_CONTROL
ESP_LOGI(TAG, "%s backlight.", backlight ? "Enabling" : "Disabling");
uint32_t tmp = 0;
#if (ILI9486_BCKL_ACTIVE_LVL==1)
tmp = backlight ? 1 : 0;
#else
tmp = backlight ? 0 : 1;
#endif
gpio_set_level(ILI9486_BCKL, tmp);
#endif
}
/**********************
* STATIC FUNCTIONS
**********************/