Fix ILI9488 init function | Fix little ILI9488 display artifacts | auto-dma by default for all esp devices | ESP32-S3 support added | updated to be compatible with esp-idf =< 4 and >= 5 versions
This commit is contained in:
parent
26fe6e7703
commit
0b55ade07e
23 changed files with 160 additions and 87 deletions
|
@ -11,6 +11,7 @@
|
|||
#include "driver/gpio.h"
|
||||
#include "esp_log.h"
|
||||
#include "soc/ledc_periph.h" // to invert LEDC output on IDF version < v4.3
|
||||
#include "soc/gpio_sig_map.h"
|
||||
|
||||
typedef struct {
|
||||
bool pwm_control; // true: LEDC is used, false: GPIO is used
|
||||
|
@ -49,22 +50,37 @@ disp_backlight_h disp_backlight_new(const disp_backlight_config_t *config)
|
|||
};
|
||||
const ledc_timer_config_t LCD_backlight_timer = {
|
||||
.speed_mode = LEDC_LOW_SPEED_MODE,
|
||||
#ifdef ESP_IDF_VERSION_MAJOR >=5
|
||||
.duty_resolution = LEDC_TIMER_10_BIT,
|
||||
#else
|
||||
.bit_num = LEDC_TIMER_10_BIT,
|
||||
#endif
|
||||
.timer_num = config->timer_idx,
|
||||
.freq_hz = 5000,
|
||||
.clk_cfg = LEDC_AUTO_CLK};
|
||||
|
||||
ESP_ERROR_CHECK(ledc_timer_config(&LCD_backlight_timer));
|
||||
ESP_ERROR_CHECK(ledc_channel_config(&LCD_backlight_channel));
|
||||
#ifdef ESP_IDF_VERSION_MAJOR >=5
|
||||
esp_rom_gpio_connect_out_signal(config->gpio_num, ledc_periph_signal[LEDC_LOW_SPEED_MODE].sig_out0_idx + config->channel_idx, config->output_invert,0);
|
||||
#else
|
||||
gpio_matrix_out(config->gpio_num, ledc_periph_signal[LEDC_LOW_SPEED_MODE].sig_out0_idx + config->channel_idx, config->output_invert, 0);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
// Configure GPIO for output
|
||||
bckl_dev->index = config->gpio_num;
|
||||
|
||||
#ifdef ESP_IDF_VERSION_MAJOR >=5
|
||||
esp_rom_gpio_connect_out_signal(config->gpio_num, SIG_GPIO_OUT_IDX, config->output_invert, false);
|
||||
esp_rom_gpio_pad_select_gpio(config->gpio_num);
|
||||
ESP_ERROR_CHECK(gpio_set_direction(config->gpio_num, GPIO_MODE_OUTPUT));
|
||||
#else
|
||||
gpio_pad_select_gpio(config->gpio_num);
|
||||
ESP_ERROR_CHECK(gpio_set_direction(config->gpio_num, GPIO_MODE_OUTPUT));
|
||||
gpio_matrix_out(config->gpio_num, SIG_GPIO_OUT_IDX, config->output_invert, false);
|
||||
#endif
|
||||
}
|
||||
|
||||
return (disp_backlight_h)bckl_dev;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue