Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
lib: Make sure that PWM continues to work even if it misses an IRQ.
If the soft PWM driver misses an IRQ then the next CC value (computed as CC[x] += delay) could already be behind the timer counter value, and hence the next compare IRQ won't fire until the timer counter value wraps around. Example code which demonstrates the bug (by having a long neopixel write that stops IRQs): import microbit import music import neopixel np = neopixel.NeoPixel(microbit.pin0, 64) while True: music.play(music.BA_DING, wait=False) microbit.sleep(1000) np.clear() microbit.sleep(2000) Prior to this commit the music would only play every 16 seconds or so, which is the time taken for the PWM fast ticker to wrap around. Fixes issue #600. Signed-off-by: Damien George <damien@micropython.org>
- Loading branch information