5 static volatile timer_t timer;
7 static void timer_isr(void) __attribute__ ((interrupt_handler));
13 *TPU_TSR3 &= ~TSR2_TCFVm ; //reset overflow flag (clear interrupt)
16 //timer initialisation
17 /*free running counter*/
20 *SYS_MSTPCRA &= ~MSTPCRA_TPUm; // power TPU unit
22 *TPU_TCR3 =0x00 | 0x06; //rising edge, f divided by 256
23 *TPU_TMDR3 =0x00; // normal mode
24 *TPU_TSR3 &= ~TSR3_TCFVm ; //reset overflow flag
25 *TPU_TIER3 |=TIER3_TCIEVm; //enable overflow interrupt
27 *TPU_TSTR |=TSTR_CST3m; //start timer
29 excptvec_set(52, timer_isr);