summaryrefslogtreecommitdiffstats
path: root/timer.h
blob: 8ddf9e7e285f0ec3cdf0ae0317e29246b10da45e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#ifndef TIMER_H
#define TIMER_H 1

#include <stdint.h>

#define TIMER_DIFF(a, b) ((a) >= (b) ?  (a) - (b) : UINT16_MAX - (b) + (a))


extern uint16_t timer_count;


void timer_init(void);
void timer_clear(void);
uint16_t timer_read(void);
uint16_t timer_elapsed(uint16_t last);

#endif