avr-rust / delay

arduino-like delay routines based on busy-wait loops
Apache License 2.0
15 stars 11 forks source link

Force inlining to fix delays #14

Closed v1nsai closed 2 years ago

v1nsai commented 3 years ago

Delays were being ignored when functions from this crate were not inlined. Turning on LTO in Cargo profile works too, but this fix works upstream without any changes required to users' Cargo.toml.

rkarabut commented 3 years ago

I don't have time to investigate this properly at the moment, but while this indeed seems to be working (until the ~4.3s delay limit is hit, triggering an integer overflow), the code fixing the said overflow in https://github.com/avr-rust/delay/pull/16 somehow also works without forcing the inlining. I'd really like to know why :)