]>
cloudbase.mooo.com Git - z180-stamp.git/blob - avr/timer.c
6fb19a81b9fa308b18796a001e50c4d8875b7c9d
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
;
28 extern void disk_timerproc(void);
37 /* Drive timer procedure of low level disk I/O module */
46 /*--------------------------------------------------------------------------*/
58 /*--------------------------------------------------------------------------*/
62 void timer_setup(void)
71 OCR1A
= F_CPU
/ 1000 - 1; // Timer1: 1000Hz interval (OC1A)
73 TIMSK1
= _BV(OCIE1A
); // Enable TC1.oca interrupt
77 uint32_t get_timer(uint32_t base
)
81 ATOMIC_BLOCK(ATOMIC_FORCEON
)