]>
cloudbase.mooo.com Git - z180-stamp.git/blob - avr/timer.c
7 #include <avr/interrupt.h>
8 #include <util/atomic.h>
15 /* timer interrupt/overflow counter */
16 volatile uint32_t timestamp
;
19 /*---------------------------------------------------------*/
20 /* 1000Hz timer interrupt generated by OC3A */
21 /*---------------------------------------------------------*/
23 ISR(TIMER3_COMPA_vect
)
25 static int_fast8_t tick_10ms
;
36 /* Drive timer procedure of low level disk I/O module */
45 /*--------------------------------------------------------------------------*/
57 /*--------------------------------------------------------------------------*/
61 void timer_setup(void)
70 OCR1A
= F_CPU
/ 1000 - 1; // Timer1: 1000Hz interval (OC1A)
72 TIMSK1
= _BV(OCIE1A
); // Enable TC1.oca interrupt
76 uint32_t get_timer(uint32_t base
)
80 ATOMIC_BLOCK(ATOMIC_FORCEON
)