-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtimer_config_example.h
More file actions
108 lines (98 loc) · 3.07 KB
/
Copy pathtimer_config_example.h
File metadata and controls
108 lines (98 loc) · 3.07 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
/**
* ----------------------------------------------------------------------------
*
* "THE ANY BEVERAGE-WARE LICENSE" (Revision 42 - based on beer-ware license):
* <dev@layer128.net> wrote this file. As long as you retain this notice you
* can do whatever you want with this stuff. If we meet some day, and you think
* this stuff is worth it, you can buy me a be(ve)er(age) in return. (I don't
* like beer much.)
*
* Matthias Kleemann
*
* ----------------------------------------------------------------------------
*
* \file timer_config_example.h
*
* We are using an ATmega8 right now - values for other AVRs might differ.
*
* \date Created: 28.11.2011 18:17:28
* \author Matthias Kleemann
**/
#ifndef TIMER_CONFIG_H_
#define TIMER_CONFIG_H_
/**
* \def TIMER0_PRESCALER
* \brief TIMER0 prescaler settings
*
* \code
* CS02 CS01 CS00 Description
* 0 0 0 No clock source (Timer/Counter stopped)
* 0 0 1 clkI/O/(No prescaling)
* 0 1 0 clkI/O/8 (From prescaler)
* 0 1 1 clkI/O/64 (From prescaler)
* 1 0 0 clkI/O/256 (From prescaler)
* 1 0 1 clkI/O/1024 (From prescaler)
* 1 1 0 External clock source on T0 pin. Clock on falling edge
* 1 1 1 External clock source on T0 pin. Clock on rising edge
* \endcode
*
* Example sets TIMER0 with prescaler clkI/O/1024
*/
#ifdef __DOXYGEN__
#define TIMER0_PRESCALER (1 << CS02) | (1 << CS00)
#else
//#define TIMER0_PRESCALER (1 << CS02) | (1 << CS00)
#endif
/**
* \def TIMER1_PRESCALER
* \brief TIMER1 prescaler settings
*
* \code
* CS12 CS11 CS10 Description
* 0 0 0 No clock source (Timer/Counter stopped)
* 0 0 1 clkI/O/(No prescaling)
* 0 1 0 clkI/O/8 (From prescaler)
* 0 1 1 clkI/O/64 (From prescaler)
* 1 0 0 clkI/O/256 (From prescaler)
* 1 0 1 clkI/O/1024 (From prescaler)
* 1 1 0 External clock source on T1 pin. Clock on falling edge
* 1 1 1 External clock source on T1 pin. Clock on rising edge
* \endcode
*
* TIMER1 with prescaler clkI/O/1024
*/
#define TIMER1_PRESCALER (1 << CS12) | (1 << CS10)
/**
* @brief Timer 1 Output Compare Value
*
* The value given calculates to approx. 15s (4MHz@1024 prescale value).
*/
#define TIMER1_COMPARE_VALUE 0xE4E1
/**
* \def TIMER2_PRESCALER
* \brief TIMER2 prescaler settings
*
* \code
* CS22 CS21 CS20 Description
* 0 0 0 No clock source (Timer/Counter stopped)
* 0 0 1 clkT2S/(No prescaling)
* 0 1 0 clkT2S/8 (From prescaler)
* 0 1 1 clkT2S/32 (From prescaler)
* 1 0 0 clkT2S/64 (From prescaler)
* 1 0 1 clkT2S/128 (From prescaler)
* 1 1 0 clkT2S/256 (From prescaler)
* 1 1 1 clkT2S/1024 (From prescaler)
* \endcode
*
* TIMER2 with prescaler clkI/O/1024
*/
#define TIMER2_PRESCALER (1 << CS22) | (1 << CS21) | (1 << CS20)
/**
* @brief Timer 2 Output Compare Value
*
* The value given calculates to approx. 25ms (4MHz@1024 prescale factor).
*
* Default value should be set to MAX (0xFF)
*/
#define TIMER2_COMPARE_VALUE 99
#endif