46 #include <avr/interrupt.h> 47 #include <util/atomic.h> 67 #if defined BOARD_PROTO_48 //ProtoBoardMega48 70 #define TIMER_INT_VECT_COMP TIMER0_COMPA_vect 72 #define TIMER_INT_VECT_COMP TIMER2_COMPA_vect 78 #define TIMER_INT_VECT_COMP TIMER0_COMP_vect 80 #define TIMER_INT_VECT_COMP TIMER2_COMP_vect 99 #if defined BOARD_PROTO_128 //ProtoBoardMega128 101 #define COMPARE_VALUE 172 102 #define PRESCALER_VALUE 4 104 #elif defined BOARD_PROTO_48 //ProtoBoardMega48 106 #define COMPARE_VALUE 249 107 #define PRESCALER_VALUE 3 119 #if defined BOARD_PROTO_48 //Mega48/88/168 136 TCCR0B = PRESCALER_VALUE;
138 OCR0A = COMPARE_VALUE;
151 TCCR0 = PRESCALER_VALUE;
154 OCR0 = COMPARE_VALUE;
162 #if defined BOARD_PROTO_48 //Mega48/88/168 179 TCCR2B = PRESCALER_VALUE;
181 OCR2A = COMPARE_VALUE;
193 TCCR2 = PRESCALER_VALUE;
196 OCR2 = COMPARE_VALUE;
208 #pragma GCC diagnostic push // avoid false positive on gcc 4.9.2 209 #pragma GCC diagnostic ignored "-Wreturn-type" 212 ATOMIC_BLOCK(ATOMIC_RESTORESTATE)
217 #pragma GCC diagnostic pop 225 static uint8_t ucGlobalTick10 = 10;
226 static uint8_t ucGlobalTick100 = 10;
236 if (ucGlobalTick10 == 0)
244 if (ucGlobalTick100 == 0)
246 ucGlobalTick100 = 10;
uint32_t HwTimerGetValue(void)
Get the value of globalTimer variable guarded by disable/enable interrupts.
static uint32_t ulGlobalTimer
Gets incremented every TIMER_RESOLUTION_MS milliseconds by interrupt.
ISR(TIMER_INT_VECT_COMP)
Interrupt service routine for timer interrupt.
#define TIMER_INT_VECT_COMP
void SysTimerUserInterrupt10(void)
This function is called by SysHWTimer every 10ms.
System wide Definitions for FREMO Clock.
void SysTimerUserInterrupt(void)
This function is called by SysHWTimer every 1ms.
Hardware dependent timer module for Atmel AVR.
User function called by timer ISR.
void SysTimerUserInterrupt100(void)
This function is called by SysHWTimer every 100ms.
void HwTimerInit(void)
Initialize the hardware time.