Updated initialization of LEDC module
Firmware is now not using the ledcsetup function but is directly setting up the ledc hardware. This enables the LEDC output to be inverted as needed for the OMOTE hardware.
This commit is contained in:
parent
b872a70a8e
commit
745e2dff51
1 changed files with 19 additions and 3 deletions
|
@ -83,9 +83,25 @@ void Display::setup()
|
|||
digitalWrite(this->backlight_pin, HIGH);
|
||||
|
||||
this->tft = TFT_eSPI();
|
||||
ledcSetup(LCD_BACKLIGHT_LEDC_CHANNEL, LCD_BACKLIGHT_LEDC_FREQUENCY, LCD_BACKLIGHT_LEDC_BIT_RESOLUTION);
|
||||
ledcAttachPin(this->backlight_pin, LCD_BACKLIGHT_LEDC_CHANNEL);
|
||||
ledcWrite(LCD_BACKLIGHT_LEDC_CHANNEL, 0);
|
||||
// Configure the backlight PWM
|
||||
// Manual setup because ledcSetup() briefly turns on the backlight
|
||||
ledc_channel_config_t ledc_channel_left;
|
||||
ledc_channel_left.gpio_num = (gpio_num_t)this->backlight_pin;
|
||||
ledc_channel_left.speed_mode = LEDC_HIGH_SPEED_MODE;
|
||||
ledc_channel_left.channel = LEDC_CHANNEL_5;
|
||||
ledc_channel_left.intr_type = LEDC_INTR_DISABLE;
|
||||
ledc_channel_left.timer_sel = LEDC_TIMER_1;
|
||||
ledc_channel_left.flags.output_invert = 1; // Can't do this with ledcSetup()
|
||||
ledc_channel_left.duty = 0;
|
||||
|
||||
ledc_timer_config_t ledc_timer;
|
||||
ledc_timer.speed_mode = LEDC_HIGH_SPEED_MODE;
|
||||
ledc_timer.duty_resolution = LEDC_TIMER_8_BIT;
|
||||
ledc_timer.timer_num = LEDC_TIMER_1;
|
||||
ledc_timer.freq_hz = 640;
|
||||
|
||||
ledc_channel_config(&ledc_channel_left);
|
||||
ledc_timer_config(&ledc_timer);
|
||||
|
||||
// Slowly charge the VSW voltage to prevent a brownout
|
||||
// Workaround for hardware rev 1!
|
||||
|
|
Loading…
Add table
Reference in a new issue