Fix to Issue #7224 - tested

This commit is contained in:
BooleanMattock 2022-12-02 20:21:40 -05:00
parent ddc56f5fdf
commit afb5301cef

View File

@ -236,14 +236,6 @@ extern void common_hal_pwmio_pwmout_set_duty_cycle(pwmio_pwmout_obj_t *self, uin
} }
// compare_count is the CC register value, which should be TOP+1 for 100% duty cycle. // compare_count is the CC register value, which should be TOP+1 for 100% duty cycle.
pwm_set_chan_level(self->slice, self->ab_channel, compare_count); pwm_set_chan_level(self->slice, self->ab_channel, compare_count);
// Wait for wrap so that we know our new cc value has been applied. Clear
// the internal interrupt and then wait for it to be set. Worst case, we
// wait a full cycle.
pwm_hw->intr = 1 << self->slice;
while ((pwm_hw->en & (1 << self->slice)) != 0 &&
(pwm_hw->intr & (1 << self->slice)) == 0 &&
!mp_hal_is_interrupted()) {
}
} }
uint16_t common_hal_pwmio_pwmout_get_duty_cycle(pwmio_pwmout_obj_t *self) { uint16_t common_hal_pwmio_pwmout_get_duty_cycle(pwmio_pwmout_obj_t *self) {