4fdf518251
Fixes #2086 When the frequency of a `PWMOut` is change it re-sets the PWM's duty cycle as well, since the registers have to be re-calculated based on the new frequency. Unfortunately, `common_hal_pulseio_pwmout_get_duty_cycle` will return a value very close to, but not exactly, the value passed to `common_hal_pulseio_pwmout_set_duty_cycle`. If the frequency is modified without the calling code also re-setting the duty cycle then the duty cycle will decay over time. This fixes that problem by tracking the unadjusted duty cycle and re-setting the duty cycle to that value when the frequency is changed. |
||
---|---|---|
.. | ||
__init__.c | ||
PulseIn.c | ||
PulseIn.h | ||
PulseOut.c | ||
PulseOut.h | ||
PWMOut.c | ||
PWMOut.h |