diff options
author | Ayke van Laethem <[email protected]> | 2022-04-20 15:18:09 +0200 |
---|---|---|
committer | Ron Evans <[email protected]> | 2022-05-25 11:53:30 +0200 |
commit | 9de76fb42e9bbb06d842e9673836f4eadf32ddae (patch) | |
tree | 7632f5c4676584ba6fb4f35a19d78ff4d1b2f383 /interp | |
parent | 52c61de19f068b8c932c1546fc671ea809e0c899 (diff) | |
download | tinygo-9de76fb42e9bbb06d842e9673836f4eadf32ddae.tar.gz tinygo-9de76fb42e9bbb06d842e9673836f4eadf32ddae.zip |
avr: simplify timer-based time
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.
Diffstat (limited to 'interp')
0 files changed, 0 insertions, 0 deletions