aboutsummaryrefslogtreecommitdiff
path: root/common/timer.h
diff options
context:
space:
mode:
Diffstat (limited to 'common/timer.h')
-rw-r--r--common/timer.h12
1 files changed, 10 insertions, 2 deletions
diff --git a/common/timer.h b/common/timer.h
index f9e8181e6..d24d3eab6 100644
--- a/common/timer.h
+++ b/common/timer.h
@@ -23,10 +23,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
23#ifndef TIMER_PRESCALER 23#ifndef TIMER_PRESCALER
24# if F_CPU > 16000000 24# if F_CPU > 16000000
25# define TIMER_PRESCALER 256 25# define TIMER_PRESCALER 256
26# elif F_CPU >= 4000000 26# elif F_CPU > 2000000
27# define TIMER_PRESCALER 64 27# define TIMER_PRESCALER 64
28# else 28# elif F_CPU > 250000
29# define TIMER_PRESCALER 8 29# define TIMER_PRESCALER 8
30# else
31# define TIMER_PRESCALER 1
30# endif 32# endif
31#endif 33#endif
32#define TIMER_RAW_FREQ (F_CPU/TIMER_PRESCALER) 34#define TIMER_RAW_FREQ (F_CPU/TIMER_PRESCALER)
@@ -42,6 +44,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
42#define TIMER_DIFF_MS(a, b) TIMER_DIFF(a, b, UINT16_MAX) 44#define TIMER_DIFF_MS(a, b) TIMER_DIFF(a, b, UINT16_MAX)
43 45
44 46
47#ifdef __cplusplus
48extern "C" {
49#endif
45extern volatile uint16_t timer_count; 50extern volatile uint16_t timer_count;
46 51
47 52
@@ -49,5 +54,8 @@ void timer_init(void);
49void timer_clear(void); 54void timer_clear(void);
50uint16_t timer_read(void); 55uint16_t timer_read(void);
51uint16_t timer_elapsed(uint16_t last); 56uint16_t timer_elapsed(uint16_t last);
57#ifdef __cplusplus
58}
59#endif
52 60
53#endif 61#endif