You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 335a499
Browse filesBrowse the repository at this point in the historyBrowse files
#defineTIMER_CHANNELS4// channel5 and channel 6 are not considered here has they don't have gpio output and they don't have interrupt
38
39
@@ -95,6 +96,25 @@ typedef enum {
95
96
} TimerCompareFormat_t;
96
97
97
98
typedefenum {
99
+
#if defined(USE_HALV2_DRIVER)
100
+
// Set with hal_tim_filter_t value
101
+
FILTER_NONE = HAL_TIM_FDIV1,
102
+
FILTER_CKINT_N2 = HAL_TIM_FDIV1_N2,
103
+
FILTER_CKINT_N4 = HAL_TIM_FDIV1_N4,
104
+
FILTER_CKINT_N8 = HAL_TIM_FDIV1_N8,
105
+
FILTER_DTS2_N6 = HAL_TIM_FDIV2_N6,
106
+
FILTER_DTS2_N8 = HAL_TIM_FDIV2_N8,
107
+
FILTER_DTS4_N6 = HAL_TIM_FDIV4_N6,
108
+
FILTER_DTS4_N8 = HAL_TIM_FDIV4_N8,
109
+
FILTER_DTS8_N6 = HAL_TIM_FDIV8_N6,
110
+
FILTER_DTS8_N8 = HAL_TIM_FDIV8_N8,
111
+
FILTER_DTS16_N5 = HAL_TIM_FDIV16_N5,
112
+
FILTER_DTS16_N6 = HAL_TIM_FDIV16_N6,
113
+
FILTER_DTS16_N8 = HAL_TIM_FDIV16_N8,
114
+
FILTER_DTS32_N5 = HAL_TIM_FDIV32_N5,
115
+
FILTER_DTS32_N6 = HAL_TIM_FDIV32_N6,
116
+
FILTER_DTS32_N8 = HAL_TIM_FDIV32_N8,
117
+
#else
98
118
FILTER_NONE = 0, // No filter
99
119
FILTER_CKINT_N2, // Sampling rate is same as clock interrupt, n=2 events
100
120
FILTER_CKINT_N4, // Sampling rate is same as clock interrupt, n=4 events
@@ -111,8 +131,17 @@ typedef enum {
111
131
FILTER_DTS32_N5, // Sampling rate is DTS/32, n=5 events
112
132
FILTER_DTS32_N6, // Sampling rate is DTS/32, n=6 events
113
133
FILTER_DTS32_N8, // Sampling rate is DTS/32, n=8 events
134
+
#endif
114
135
} ChannelInputFilter_t;
115
136
137
+
typedefenum {
138
+
DISABLE_IT, // default
139
+
ENABLE_IT,
140
+
CLEAR_IT,
141
+
CLEAR_AND_ENABLE_IT,
142
+
IS_ENABLE_IT,
143
+
} ChannelITConfig_t;
144
+
116
145
#ifdef __cplusplus
117
146
118
147
#include<functional>
@@ -171,19 +200,29 @@ class HardwareTimer {
171
200
172
201
uint32_tgetTimerClkFreq(); // return timer clock frequency in Hz.
173
202
203
+
#if defined(USE_HALV2_DRIVER)
204
+
staticvoidcaptureCompareCallback(hal_tim_handle_t *htim, hal_tim_channel_t hal_channel); // Generic Capture and Compare callback which will call user callback
205
+
staticvoidupdateCallback(hal_tim_handle_t *htim); // Generic Update (rollover) callback which will call user callback
206
+
#else
174
207
staticvoidcaptureCompareCallback(TIM_HandleTypeDef *htim); // Generic Capture and Compare callback which will call user callback
175
208
staticvoidupdateCallback(TIM_HandleTypeDef *htim); // Generic Update (rollover) callback which will call user callback
176
-
209
+
#endif
177
210
voidupdateRegistersIfNotRunning(TIM_TypeDef *TIMx); // Take into account registers update immediately if timer is not running,
178
211
179
212
boolisRunning(); // return true if HardwareTimer is running
180
213
boolisRunningChannel(uint32_t channel); // return true if channel is running
181
214
182
215
// The following function(s) are available for more advanced timer options
216
+
#if defined(USE_HALV2_DRIVER)
217
+
hal_tim_handle_t *getHandle(); // return the handle address for HAL related configuration
218
+
hal_tim_channel_tgetChannel(uint32_t channel);
219
+
#else
183
220
TIM_HandleTypeDef *getHandle(); // return the handle address for HAL related configuration
0 commit comments