mirror of https://github.com/tinygo-org/tinygo.git
Browse Source
Simplify the interrupt-based timer code in a few ways: - Do not recalibrate the timer every 100ms. Instead, rely on the fact that the machine package will calbrate the timer if necessary if it makes changes to Timer0. - Do not configure Timer0 and then set nanosecondsInTick based on that value. Instead, use a fixed value. These two changes together mean that in code that doesn't use PWM, nanosecondsInTick will be constant which makes the TIMER0_OVF interrupt handler a lot smaller. Together this reduces the code size of AVR binaries by about 1200 bytes, making it pretty close to the pre-timer code size (only about 250 bytes larger). It also somehow fixes a problem with tinygo.org/x/drivers/examples/ws2812 on the Arduino Uno. I'm not quite sure what was going wrong, but bisecting pointed towards the timer code (https://github.com/tinygo-org/tinygo/pull/2428) and with this simplification the bug appears to be gone.pull/2872/head
Ayke van Laethem
3 years ago
committed by
Ron Evans
1 changed files with 6 additions and 15 deletions
Loading…
Reference in new issue