summaryrefslogtreecommitdiff
path: root/tests/float/bytes_construct.py
diff options
context:
space:
mode:
authorThea Flowers <theaflowers@google.com>2019-10-22 10:37:36 -0700
committerThea Flowers <me@thea.codes>2019-10-23 14:34:14 -0700
commit4fdf518251dd0751cf4e9b06b7ffb2b944e7d15c (patch)
treeacbc40ae426ac761425b886671fddf60828960a7 /tests/float/bytes_construct.py
parentaf1fab1915048a62695dfa988f115b606c5d297b (diff)
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.
Diffstat (limited to 'tests/float/bytes_construct.py')
0 files changed, 0 insertions, 0 deletions