Manipulation of Millis() value
after sanguino wakes 8 sec sleep, advance millis() value 8000. possible?
yes , no. no, if use standard arduino libraries. yes, if not mind patch them.
in hardware/cores/arduino/wiring.c
you find
and code advances them. can add function advance them on own demand. take care make advance function internally atomic. start like
and end like
in hardware/cores/arduino/wiring.c
you find
code: [select]
volatile unsigned long timer0_overflow_count = 0;
volatile unsigned long timer0_millis = 0;
static unsigned char timer0_fract = 0;
and code advances them. can add function advance them on own demand. take care make advance function internally atomic. start like
code: [select]
uint8_t old_sreg = sreg;
cli();
and end like
code: [select]
sreg = old_sreg;
cli();
Arduino Forum > Forum 2005-2010 (read only) > Software > Syntax & Programs > Manipulation of Millis() value
arduino
Comments
Post a Comment