4 #include <avr/interrupt.h>
6 #include <avr/sfr_defs.h>
11 volatile clock_time_t clock_datetime
= 0;
14 ISR(TIMER1_COMPA_vect
)
19 //Initialise the clock
22 OCR1A
= (((F_CPU
/ 1024) / 100) - 1);
23 TCCR1B
= ((1 << WGM12
) | (1 << CS12
) | (1 << CS10
));
24 TIMSK1
= (1 << OCIE1A
);
28 clock_time_t
clock_time()
32 ATOMIC_BLOCK(ATOMIC_FORCEON
)
34 time
= clock_datetime
;