raspberrypi: audiopwmout: simple fix for #5092
This commit is contained in:
parent
02bbb204e0
commit
77b0c76a37
@ -175,8 +175,8 @@ void common_hal_audiopwmio_pwmaudioout_play(audiopwmio_pwmaudioout_obj_t *self,
|
||||
uint32_t best_error = system_clock;
|
||||
|
||||
for (uint32_t denominator = 0xffff; denominator > 0; denominator--) {
|
||||
uint32_t numerator = (denominator * sample_rate) / system_clock;
|
||||
uint32_t remainder = (denominator * sample_rate) % system_clock;
|
||||
uint32_t numerator = ((uint64_t)denominator * sample_rate) / system_clock;
|
||||
uint32_t remainder = ((uint64_t)denominator * sample_rate) % system_clock;
|
||||
if (remainder > (system_clock / 2)) {
|
||||
numerator += 1;
|
||||
remainder = system_clock - remainder;
|
||||
|
Loading…
Reference in New Issue
Block a user