the digitalWriteFast() and etc macros will not compile properly as "single statements", causing constructs like the following to fail with an "'else' without a previous 'if' error"
void setup() {
if (digitalRead(1) == HIGH)
digitalWriteFast(2, HIGH);
else
digitalWriteFast(3, HIGH);
}
This can be fixed (in a standard way) by wrapping them in a 1-time loop:
#define digitalWriteFast(P, V) \
do { \
if (__builtin_constant_p(P)) { \
BIT_WRITE(*__digitalPinToPortReg(P), __digitalPinToBit(P), (V)); \
} else { \
digitalWrite((P), (V)); \
} \
} while (0)
the digitalWriteFast() and etc macros will not compile properly as "single statements", causing constructs like the following to fail with an "'else' without a previous 'if' error"
This can be fixed (in a standard way) by wrapping them in a 1-time loop: