circuitpython/ports
Thea Flowers 4fdf518251
Track unadjusted PWM duty cycle to avoid accumulating conversion errors
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.
2019-10-23 14:34:14 -07:00
..
atmel-samd Track unadjusted PWM duty cycle to avoid accumulating conversion errors 2019-10-23 14:34:14 -07:00
cxd56 Merge pull request #2226 from kamtom480/circuitpython-device-open 2019-10-23 15:08:40 -04:00
nrf Add functions to get top and limit stack 2019-10-18 11:04:45 +02:00
stm32f4 Add functions to get top and limit stack 2019-10-18 11:04:45 +02:00
unix Fix unix build by using safe mode stub 2019-03-12 11:56:35 -07:00