/* * Timer.c * * Created: 28/10/2021 17:51:29 * Author: n0x */ #include #include volatile uint16_t cntr = 0; void Timer_init (void){ TCCR0A |= (1< 250KHz */ TIMSK0 |= (1< 1KHz (1ms) */ } uint16_t Timer_getTick(void){ uint16_t tmp; cli(); tmp = cntr; sei(); return tmp; } ISR(TIMER0_COMPA_vect){ cntr++; }