After taking a look at the source code of wiring/arduino_ide, I found out this:
timer0_overflow_count
That's the one micros() uses.
So I did a quick test:
#include <WProgram.h>
int8_t secondsCounter = 0;
extern unsigned long timer0_overflow_count;
void setup()
{
Serial.begin(115200);
timer0_overflow_count = 0;
}
void loop()
{
delay(1000);
secondsCounter++;
if (secondsCounter > 4)
{
timer0_overflow_count = 0;
secondsCounter = 0;
Serial.println("!");
} else Serial.println(micros());
}
And heck, it works. Could it be so simple, or am I going to mess up other stuff up? Just wondering...
Wk