circuitpython/ports/atmel-samd/common-hal/pulseio
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
..
__init__.c Merge commit 'f869d6b2e339c04469c6c9ea3fb2fabd7bbb2d8c' into nrf2_merge 2017-10-24 22:31:16 -07:00
PulseIn.c remove CPy-specific EIC handlers from samd-peripherals 2019-04-04 16:04:11 -04:00
PulseIn.h Prevent freezing USB during high frequency PulseIn. 2018-06-08 12:56:32 -07:00
PulseOut.c atmel-samd: Use RUN_BACKGROUND_TASKS 2019-08-11 08:53:02 -05:00
PulseOut.h m0 pulseout works. Factored out shared timer code. 2018-02-13 18:17:20 -08:00
PWMOut.c Track unadjusted PWM duty cycle to avoid accumulating conversion errors 2019-10-23 14:34:14 -07:00
PWMOut.h Track unadjusted PWM duty cycle to avoid accumulating conversion errors 2019-10-23 14:34:14 -07:00