Thank you all, guys, for debugging this one.
I've pushed a patch that makes delayMicrosecond() independent from micros().
Paul, I've borrowed the implementation from the Teensy core, if you don't mind!
I've only slightly changed it:
- the "bne" instruction to "bge" to allow delays of 0uS
- changed the calculation of "n" (multiply seems to use 1 cycle as the shift and
makes the formula generic)
@leonid_leonid
sorry, I didn't looked at the forum thread with your implementation!