|
|
|
|
@ -3,6 +3,7 @@
|
|
|
|
|
|
|
|
|
|
uint8_t foo;
|
|
|
|
|
uint16_t bar;
|
|
|
|
|
uint16_t timertmp;
|
|
|
|
|
|
|
|
|
|
void baz() {
|
|
|
|
|
foo++;
|
|
|
|
|
@ -35,7 +36,7 @@ int __attribute__((noreturn)) main(void) {
|
|
|
|
|
|
|
|
|
|
for(;;){
|
|
|
|
|
|
|
|
|
|
SOFTTIMER(1,500) {
|
|
|
|
|
SOFTTIMER(1,500) {
|
|
|
|
|
// do_stuff();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -45,16 +46,15 @@ int __attribute__((noreturn)) main(void) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ISR(TIMER1_OVF_vect,ISR_NOBLOCK){
|
|
|
|
|
uint16_t tmp;
|
|
|
|
|
tmp=timer1_acc;
|
|
|
|
|
tmp++;
|
|
|
|
|
timertmp=timer1_acc;
|
|
|
|
|
timertmp++;
|
|
|
|
|
|
|
|
|
|
/* the ATOMIC is acutally only needed if timer1_acc is never read from an ISR, which
|
|
|
|
|
* is probably the case.
|
|
|
|
|
* ATOMIC_FORCEON: the ISR_NOBLOCK sets sei() a few cycles before.
|
|
|
|
|
*/
|
|
|
|
|
ATOMIC_BLOCK(ATOMIC_FORCEON){
|
|
|
|
|
timer1_acc=tmp;
|
|
|
|
|
timer1_acc=timertmp;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|