Skip to content

Commit

Permalink
Fix LEDC channels above 8 not properly clearing
Browse files Browse the repository at this point in the history
Fixes: #2660
  • Loading branch information
me-no-dev committed Apr 12, 2019
1 parent 1efcd21 commit 6dab3f6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions cores/esp32/esp32-hal-ledc.c
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ static void _ledcSetupChannel(uint8_t chan, uint8_t idle_level)
LEDC_CHAN(group, channel).conf0.sig_out_en = 0;//This is the output enable control bit for channel
LEDC_CHAN(group, channel).conf1.duty_start = 0;//When duty_num duty_cycle and duty_scale has been configured. these register won't take effect until set duty_start. this bit is automatically cleared by hardware.
if(group) {
LEDC_CHAN(group, channel).conf0.val &= ~BIT(4);
LEDC_CHAN(group, channel).conf0.low_speed_update = 1;
} else {
LEDC_CHAN(group, channel).conf0.clk_en = 0;
}
Expand Down Expand Up @@ -196,15 +196,15 @@ void ledcWrite(uint8_t chan, uint32_t duty)
LEDC_CHAN(group, channel).conf0.sig_out_en = 1;//This is the output enable control bit for channel
LEDC_CHAN(group, channel).conf1.duty_start = 1;//When duty_num duty_cycle and duty_scale has been configured. these register won't take effect until set duty_start. this bit is automatically cleared by hardware.
if(group) {
LEDC_CHAN(group, channel).conf0.val |= BIT(4);
LEDC_CHAN(group, channel).conf0.low_speed_update = 1;
} else {
LEDC_CHAN(group, channel).conf0.clk_en = 1;
}
} else {
LEDC_CHAN(group, channel).conf0.sig_out_en = 0;//This is the output enable control bit for channel
LEDC_CHAN(group, channel).conf1.duty_start = 0;//When duty_num duty_cycle and duty_scale has been configured. these register won't take effect until set duty_start. this bit is automatically cleared by hardware.
if(group) {
LEDC_CHAN(group, channel).conf0.val &= ~BIT(4);
LEDC_CHAN(group, channel).conf0.low_speed_update = 1;
} else {
LEDC_CHAN(group, channel).conf0.clk_en = 0;
}
Expand Down

0 comments on commit 6dab3f6

Please sign in to comment.