-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Open
Description
Recent versions of the Arduino IDE/Core for AVR do Link Time Optimization, which means that calls to delayMicroseconds() where the argument is constant are likely to be optimized to the point where they become significantly inaccurate for small numbers...
The simplest solution is probably to define delayMicroseconds() with a "never inline" attribute, but it would probably be a better idea to use libc and/or compiler built-ins instead.
test sketch:
void setup() {
}
void loop() {
byte x;
x = PORTB;
delayMicroseconds(1);
x = PORTB;
delayMicroseconds(2);
x = PORTB;
delayMicroseconds(3);
x = PORTB;
delayMicroseconds(100);
x = PORTB;
delayMicroseconds(2334);
x = PORTB;
delayMicroseconds(x);
x = PORTB;
}
Metadata
Metadata
Assignees
Labels
No labels