forked from Traumflug/Teacup_Firmware
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtimer.h
More file actions
33 lines (23 loc) · 659 Bytes
/
Copy pathtimer.h
File metadata and controls
33 lines (23 loc) · 659 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#ifndef _TIMER_H
#define _TIMER_H
#include <stdint.h>
#ifndef SIMULATOR
#include <avr/io.h>
#endif
#include "simulator.h"
// time-related constants
#define US * (F_CPU / 1000000)
#define MS * (F_CPU / 1000)
/// How often we overflow and update our clock.
/// With F_CPU = 16MHz, max is < 4.096ms (TICK_TIME = 65535).
#define TICK_TIME 2 MS
/// Convert back to ms from cpu ticks so our system clock runs
/// properly if you change TICK_TIME.
#define TICK_TIME_MS (TICK_TIME / (F_CPU / 1000))
/*
timer stuff
*/
void timer_init(void) __attribute__ ((cold));
char timer_set(int32_t delay, char check_short);
void timer_stop(void);
#endif /* _TIMER_H */