]>
cloudbase.mooo.com Git - z180-stamp.git/blob - avr/timer.c
5 #include <avr/interrupt.h>
6 #include <util/atomic.h>
9 /* timer interrupt/overflow counter */
10 /* counts up every ms. */
14 /*---------------------------------------------------------*/
15 /* 1000Hz timer interrupt generated by OC3A */
16 /*---------------------------------------------------------*/
18 ISR(TIMER3_COMPA_vect
)
20 static int_fast8_t tick_10ms
;
23 extern void disk_timerproc(void);
32 /* Drive timer procedure of low level disk I/O module */
39 /*--------------------------------------------------------------------------*/
42 void timer_setup(void)
51 OCR1A
= F_CPU
/ 1000 - 1; // Timer1: 1000Hz interval (OC1A)
53 TIMSK1
= _BV(OCIE1A
); // Enable TC1.oca interrupt
57 /*--------------------------------------------------------------------------*/
59 uint32_t get_timer(uint32_t base
)
62 ATOMIC_BLOCK(ATOMIC_FORCEON
)