circuitpython/ports/raspberrypi/common-hal
Jeff Epler bef07961ab raspberrypi: audiopwmout: subtle for #5092
I noticed that the loop over 65535 possible denominators took a long time,
causing up to 100ms wait for a sound sample to start playing!

This algorithm, adapted from an algorithm shown in Python's fractions.py,
is guaranteed to find the best denominator in a small number of steps
(I think log2-many steps but I'm not sure). In practice, it means the time
between samples playing is just 10ms, and some of that is recreating the
sine wave sample in Python each time.

It often finds the same solution as the old code, but sometimes it finds
one a bit better since it compares the ratios using float point instead
of integer arithmetic.
2021-08-24 16:33:20 -05:00
..
alarm Clean up sleep memory, mark as not-implemented 2021-06-20 17:57:51 -04:00
analogio run code formatting script 2021-03-15 19:27:36 +05:30
audiobusio partial buffer mgmt fix 2021-08-09 09:47:13 -04:00
audiopwmio raspberrypi: audiopwmout: subtle for #5092 2021-08-24 16:33:20 -05:00
board Removed more includes 2021-02-26 22:35:38 -06:00
busio Fix RP2040 I2C instance check 2021-08-18 08:55:52 -07:00
countio run code formatting script 2021-03-15 19:27:36 +05:30
digitalio run code formatting script 2021-03-15 19:27:36 +05:30
displayio Added support for specifying the JMP pin (RP2 PIO) 2021-07-22 18:39:04 +02:00
imagecapture Added support for specifying the JMP pin (RP2 PIO) 2021-07-22 18:39:04 +02:00
microcontroller update run-mode 2021-07-18 00:00:58 +05:30
neopixel_write Added support for specifying the JMP pin (RP2 PIO) 2021-07-22 18:39:04 +02:00
nvm run code formatting script 2021-03-15 19:27:36 +05:30
os run code formatting script 2021-03-15 19:27:36 +05:30
pulseio Set output low in SIO 2021-07-28 09:00:36 -07:00
pwmio Block when setting duty_cycle until the new value is taken 2021-07-27 12:37:35 -07:00
rgbmatrix run code formatting script 2021-03-15 19:27:36 +05:30
rotaryio Added support for specifying the JMP pin (RP2 PIO) 2021-07-22 18:39:04 +02:00
rp2pio Check jmp_pin specified when JMP PIN opcodes used 2021-07-23 13:35:20 +02:00
rtc run code formatting script 2021-03-15 19:27:36 +05:30
supervisor run code formatting script 2021-03-15 19:27:36 +05:30
watchdog run code formatting script 2021-03-15 19:27:36 +05:30