-
Notifications
You must be signed in to change notification settings - Fork 0
/
TIMER1_private.h
160 lines (130 loc) · 7.34 KB
/
TIMER1_private.h
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
/*
* TIMER1_private.h
*
* Created on: Nov 18, 2022
* Author: Mohamed Hashim Attiya Said
*/
#ifndef TIMER1_PRIVATE_H_
#define TIMER1_PRIVATE_H_
/************* Timer1 Operation Mode *************/
/* ======================
* Timer1 Operation Mode
* ======================
* 1. TIMER_COUNTER_MODE
* 2. ICU_MODE
*/
#define TIMER_COUNTER_MODE 44
#define ICU_MODE 45
/********** Wave Generation Mode Select **********/
/* Wave Generation Mode Select
* 0. TIMER1_NORMAL__TOP_VAL_0XFFFF
* 1. TIMER1_PWM_PHASE_CORRECT_8_BIT__TOP_VAL_0X00FF
* 2. TIMER1_PWM_PHASE_CORRECT_9_BIT__TOP_VAL_0X01FF
* 3. TIMER1_PWM_PHASE_CORRECT_10_BIT__TOP_VAL_0X03FF
* 4. TIMER1_CTC__TOP_VAL_OCR1A
* 5. TIMER1_FAST_PWM_8_BIT__TOP_VAL_0X00FF
* 6. TIMER1_FAST_PWM_9_BIT__TOP_VAL_0X01FF
* 7. TIMER1_FAST_PWM_10_BIT__TOP_VAL_0X03FF
* 8. TIMER1_PWM_PHASE_AND_FREQUENCY_CORRECT__TOP_VAL_ICR1
* 9. TIMER1_PWM_PHASE_AND_FREQUENCY_CORRECT__TOP_VAL_OCR1A
* 10. TIMER1_PWM_PHASE_CORRECT__TOP_VAL_ICR1
* 11. TIMER1_PWM_PHASE_CORRECT__TOP_VAL_OCR1A
* 12. TIMER1_CTC__TOP_VAL_ICR1
* 13. TIMER1_RESERVED
* 14. TIMER1_FAST_PWM__TOP_VAL_ICR1
* 15. TIMER1_FAST_PWM__TOP_VAL_OCR1A
*/
#define TIMER1_NORMAL__TOP_VAL_0XFFFF 0
#define TIMER1_PWM_PHASE_CORRECT_8_BIT__TOP_VAL_0X00FF 1
#define TIMER1_PWM_PHASE_CORRECT_9_BIT__TOP_VAL_0X01FF 2
#define TIMER1_PWM_PHASE_CORRECT_10_BIT__TOP_VAL_0X03FF 3
#define TIMER1_CTC__TOP_VAL_OCR1A 4
#define TIMER1_FAST_PWM_8_BIT__TOP_VAL_0X00FF 5
#define TIMER1_FAST_PWM_9_BIT__TOP_VAL_0X01FF 6
#define TIMER1_FAST_PWM_10_BIT__TOP_VAL_0X03FF 7
#define TIMER1_PWM_PHASE_AND_FREQUENCY_CORRECT__TOP_VAL_ICR1 8
#define TIMER1_PWM_PHASE_AND_FREQUENCY_CORRECT__TOP_VAL_OCR1A 9
#define TIMER1_PWM_PHASE_CORRECT__TOP_VAL_ICR1 10
#define TIMER1_PWM_PHASE_CORRECT__TOP_VAL_OCR1A 11
#define TIMER1_CTC__TOP_VAL_ICR1 12
#define TIMER1_RESERVED 13
#define TIMER1_FAST_PWM__TOP_VAL_ICR1 14
#define TIMER1_FAST_PWM__TOP_VAL_OCR1A 15
/********** Compare Match Output OC1A PinD5 Mode *********/
/* Compare Output Mode, non-PWM Mode (Normal Mode or CTC Mode)
* 1. TIMER1_NORMAL_PORT_OPERATION_OC1A_PIND5_DISCONNECTED
* 2. TIMER1_TOGGLE_OC1A_PIND5_ON_COMPARE_MATCH
* 3. TIMER1_CLEAR_OC1A_PIND5_ON_COMPARE_MATCH__SET_OUTPUT_TO_LOW_LEVEL
* 4. TIMER1_SET_OC1A_PIND5_ON_COMPARE_MATCH__SET_OUTPUT_TO_HIGH_LEVEL
*/
#define TIMER1_NORMAL_PORT_OPERATION_OC1A_PIND5_DISCONNECTED 16
#define TIMER1_TOGGLE_OC1A_PIND5_ON_COMPARE_MATCH 17
#define TIMER1_CLEAR_OC1A_PIND5_ON_COMPARE_MATCH__SET_OUTPUT_TO_LOW_LEVEL 18
#define TIMER1_SET_OC1A_PIND5_ON_COMPARE_MATCH__SET_OUTPUT_TO_HIGH_LEVEL 19
/* Compare Output Mode, Fast PWM Mode
* 1. TIMER1_NORMAL_PORT_OPERATION_OC1A_PIND5_DISCONNECTED
* 2. TIMER1_ACTION1A_ON_OC1A_PIND5_AND_OC1B_PIND4__DEPEND_ON_WAVE_GENERATION_MODE_SELECTION
* 3. TIMER1_CLEAR_OC1A_PIND5_ON_COMPARE_MATCH_SET_OC1A_PIND5_AT_TOP
* 4. TIMER1_SET_OC1A_PIND5_ON_COMPARE_MATCH_CLEAR_OC1A_PIND5_AT_TOP
*/
#define TIMER1_ACTION1A_ON_OC1A_PIND5_AND_OC1B_PIND4__DEPEND_ON_WAVE_GENERATION_MODE_SELECTION 20
#define TIMER1_CLEAR_OC1A_PIND5_ON_COMPARE_MATCH_SET_OC1A_PIND5_AT_TOP 21
#define TIMER1_SET_OC1A_PIND5_ON_COMPARE_MATCH_CLEAR_OC1A_PIND5_AT_TOP 22
/* Compare Output Mode, Phase Correct and Phase and Frequency Correct PWM
* 1. TIMER1_NORMAL_PORT_OPERATION_OC1A_PIND5_DISCONNECTED
* 2. TIMER1_ACTION2A_ON_OC1A_PIND5_AND_OC1B_PIND4__DEPEND_ON_WAVE_GENERATION_MODE_SELECTION
* 3. TIMER1_CLEAR_OC1A_PIND5_ON_COMPARE_MATCH_WHEN_UP_COUNTING_SET_OC1A_PIND5_ON_COMPARE_MATCH_WHEN_DOWNCOUNTING
* 4. TIMER1_SET_OC1A_PIND5_ON_COMPARE_MATCH_WHEN_UP_COUNTING_CLEAR_OC1A_PIND5_ON_COMPARE_MATCH_WHEN_DOWNCOUNTING
*/
#define TIMER1_ACTION2A_ON_OC1A_PIND5_AND_OC1B_PIND4__DEPEND_ON_WAVE_GENERATION_MODE_SELECTION 23
#define TIMER1_CLEAR_OC1A_PIND5_ON_COMPARE_MATCH_WHEN_UP_COUNTING_SET_OC1A_PIND5_ON_COMPARE_MATCH_WHEN_DOWNCOUNTING 24
#define TIMER1_SET_OC1A_PIND5_ON_COMPARE_MATCH_WHEN_UP_COUNTING_CLEAR_OC1A_PIND5_ON_COMPARE_MATCH_WHEN_DOWNCOUNTING 25
/********** Compare Match Output OC1B PinD4 Mode *********/
/* Compare Output Mode, non-PWM Mode (Normal Mode or CTC Mode)
* 1. TIMER1_NORMAL_PORT_OPERATION_OC1B_PIND4_DISCONNECTED
* 2. TIMER1_TOGGLE_OC1B_PIND4_ON_COMPARE_MATCH
* 3. TIMER1_CLEAR_OC1B_PIND4_ON_COMPARE_MATCH__SET_OUTPUT_TO_LOW_LEVEL
* 4. TIMER1_SET_OC1B_PIND4_ON_COMPARE_MATCH__SET_OUTPUT_TO_HIGH_LEVEL
*/
#define TIMER1_NORMAL_PORT_OPERATION_OC1B_PIND4_DISCONNECTED 26
#define TIMER1_TOGGLE_OC1B_PIND4_ON_COMPARE_MATCH 27
#define TIMER1_CLEAR_OC1B_PIND4_ON_COMPARE_MATCH__SET_OUTPUT_TO_LOW_LEVEL 28
#define TIMER1_SET_OC1B_PIND4_ON_COMPARE_MATCH__SET_OUTPUT_TO_HIGH_LEVEL 29
/* Compare Output Mode, Fast PWM Mode
* 1. TIMER1_NORMAL_PORT_OPERATION_OC1B_PIND4_DISCONNECTED
* 2. TIMER1_ACTION1B_ON_OC1A_PIND5_AND_OC1B_PIND4__DEPEND_ON_WAVE_GENERATION_MODE_SELECTION
* 3. TIMER1_CLEAR_OC1B_PIND4_ON_COMPARE_MATCH_SET_OC1B_PIND4_AT_TOP
* 4. TIMER1_SET_OC1B_PIND4_ON_COMPARE_MATCH_CLEAR_OC1B_PIND4_AT_TOP
*/
#define TIMER1_ACTION1B_ON_OC1A_PIND5_AND_OC1B_PIND4__DEPEND_ON_WAVE_GENERATION_MODE_SELECTION 30
#define TIMER1_CLEAR_OC1B_PIND4_ON_COMPARE_MATCH_SET_OC1B_PIND4_AT_TOP 31
#define TIMER1_SET_OC1B_PIND4_ON_COMPARE_MATCH_CLEAR_OC1B_PIND4_AT_TOP 32
/* Compare Output Mode, Phase Correct and Phase and Frequency Correct PWM
* 1. TIMER1_NORMAL_PORT_OPERATION_OC1B_PIND4_DISCONNECTED
* 2. TIMER1_ACTION2B_ON_OC1A_PIND5_AND_OC1B_PIND4__DEPEND_ON_WAVE_GENERATION_MODE_SELECTION
* 3. TIMER1_CLEAR_OC1B_PIND4_ON_COMPARE_MATCH_WHEN_UP_COUNTING_SET_OC1B_PIND4_ON_COMPARE_MATCH_WHEN_DOWNCOUNTING
* 4. TIMER1_SET_OC1B_PIND4_ON_COMPARE_MATCH_WHEN_UP_COUNTING_CLEAR_OC1B_PIND4_ON_COMPARE_MATCH_WHEN_DOWNCOUNTING
*/
#define TIMER1_ACTION2B_ON_OC1A_PIND5_AND_OC1B_PIND4__DEPEND_ON_WAVE_GENERATION_MODE_SELECTION 33
#define TIMER1_CLEAR_OC1B_PIND4_ON_COMPARE_MATCH_WHEN_UP_COUNTING_SET_OC1B_PIND4_ON_COMPARE_MATCH_WHEN_DOWNCOUNTING 34
#define TIMER1_SET_OC1B_PIND4_ON_COMPARE_MATCH_WHEN_UP_COUNTING_CLEAR_OC1B_PIND4_ON_COMPARE_MATCH_WHEN_DOWNCOUNTING 35
/************ Pre-scaler Clock Select ************/
/* Pre-scaler Clock Select
* 1. TIMER1_NO_CLOCK_SOURCE
* 2. TIMER1_NO_PRE_SCALING
* 3. TIMER1_PRE_SCALER_8
* 4. TIMER1_PRE_SCALER_64
* 5. TIMER1_PRE_SCALER_256
* 6. TIMER1_PRE_SCALER_1024
* 7. TIMER1_EXTERNAL_CLOCK_SOURCE_ON_T0_PIN_ON_FALLING_EDGE
* 8. TIMER1_EXTERNAL_CLOCK_SOURCE_ON_T0_PIN_ON_RISING_EDGE
*/
#define TIMER1_NO_CLOCK_SOURCE 36
#define TIMER1_NO_PRE_SCALING 37
#define TIMER1_PRE_SCALER_8 38
#define TIMER1_PRE_SCALER_64 39
#define TIMER1_PRE_SCALER_256 40
#define TIMER1_PRE_SCALER_1024 41
#define TIMER1_EXTERNAL_CLOCK_SOURCE_ON_T0_PIN_ON_FALLING_EDGE 42
#define TIMER1_EXTERNAL_CLOCK_SOURCE_ON_T0_PIN_ON_RISING_EDGE 43
#endif /* TIMER1_PRIVATE_H_ */