Support IDF version < v4.3
This commit is contained in:
parent
3c4399d510
commit
11c240daca
|
@ -11,6 +11,7 @@
|
|||
#include "driver/gpio.h"
|
||||
#include "esp_log.h"
|
||||
#include "esp_rom_gpio.h" // for output signal inversion
|
||||
#include "soc/ledc_periph.h" // to invert LEDC output on IDF version < v4.3
|
||||
|
||||
typedef struct {
|
||||
bool pwm_control; // true: LEDC is used, false: GPIO is used
|
||||
|
@ -40,8 +41,7 @@ disp_backlight_h disp_backlight_new(const disp_backlight_config_t *config)
|
|||
.intr_type = LEDC_INTR_DISABLE,
|
||||
.timer_sel = config->timer_idx,
|
||||
.duty = 0,
|
||||
.hpoint = 0,
|
||||
.flags.output_invert = config->output_invert //@todo added only in recent IDF versions
|
||||
.hpoint = 0
|
||||
};
|
||||
const ledc_timer_config_t LCD_backlight_timer = {
|
||||
.speed_mode = LEDC_LOW_SPEED_MODE,
|
||||
|
@ -52,6 +52,7 @@ disp_backlight_h disp_backlight_new(const disp_backlight_config_t *config)
|
|||
|
||||
ESP_ERROR_CHECK(ledc_timer_config(&LCD_backlight_timer));
|
||||
ESP_ERROR_CHECK(ledc_channel_config(&LCD_backlight_channel));
|
||||
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
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue