hal_tim.h
Go to the documentation of this file.
1 /**
2 ****************************************************************************************
3 *
4 * @file hal_tim.h
5 * @author BLE Driver Team
6 * @brief Header file containing functions prototypes of TIMER HAL library.
7 *
8 ****************************************************************************************
9 * @attention
10 #####Copyright (c) 2019 GOODIX
11 All rights reserved.
12
13 Redistribution and use in source and binary forms, with or without
14 modification, are permitted provided that the following conditions are met:
15 * Redistributions of source code must retain the above copyright
16 notice, this list of conditions and the following disclaimer.
17 * Redistributions in binary form must reproduce the above copyright
18 notice, this list of conditions and the following disclaimer in the
19 documentation and/or other materials provided with the distribution.
20 * Neither the name of GOODIX nor the names of its contributors may be used
21 to endorse or promote products derived from this software without
22 specific prior written permission.
23
24 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE
28 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
32 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34 POSSIBILITY OF SUCH DAMAGE.
35 ****************************************************************************************
36 */
37
38 /** @addtogroup PERIPHERAL Peripheral Driver
39 * @{
40 */
41
42 /** @addtogroup HAL_DRIVER HAL Driver
43 * @{
44 */
45
46 /** @defgroup HAL_TIMER TIMER
47 * @brief TIM HAL module driver.
48 * @{
49 */
50
51 /* Define to prevent recursive inclusion -------------------------------------*/
52 #ifndef HAL_TIM_H
53 #define HAL_TIM_H
54
55 #ifdef __cplusplus
56 extern "C" {
57 #endif
58
59 /* Includes ------------------------------------------------------------------*/
60 #include "hal_def.h"
61 #include "ll_tim.h"
62
63 /* Exported types ------------------------------------------------------------*/
64 /** @addtogroup HAL_TIMER_ENUMERATIONS Enumerations
65 * @{
66 */
67
68 /** @defgroup HAL_TIMER_state HAL TIMER state
69 * @{
70 */
71
72 /**
73 * @brief HAL TIMER State Enumerations definition
74 */
75 typedef enum
76 {
77 HAL_TIMER_STATE_RESET = 0x00, /**< Peripheral not yet initialized or disabled */
78 HAL_TIMER_STATE_READY = 0x01, /**< Peripheral Initialized and ready for use */
79 HAL_TIMER_STATE_BUSY = 0x02, /**< An internal process is ongoing */
80 HAL_TIMER_STATE_ERROR = 0x04 /**< Reception process is ongoing */
81 } hal_timer_state_t;
82
83 /**
84 * @brief HAL TIMER capture type Enumerations definition
85 */
86 typedef enum
87 {
88 HAL_TIMER_CAPTURE_NONE = 0x00, /**< Set timer capture NONE */
89 HAL_TIMER_CAPTURE_FALLING = 0x01, /**< Set timer capture io falling edge */
90 HAL_TIMER_CAPTURE_RISING = 0x02, /**< Set timer capture io rising edge */
91 HAL_TIMER_CAPTURE_BOTH = 0x03, /**< Set timer capture io both edge */
92 } hal_timer_capture_type_t;
93
94 /**
95 * @brief HAL TIMER capture pin Enumerations definition
96 */
97 typedef enum
98 {
99 HAL_TIMER_CAPTURE_GPIO_PIN_0 = 0x00, /**< capture GPIO_PIN_0 */
100 HAL_TIMER_CAPTURE_GPIO_PIN_1 = 0x01, /**< capture GPIO_PIN_1 */
101 HAL_TIMER_CAPTURE_GPIO_PIN_2 = 0x02, /**< capture GPIO_PIN_2 */
102 HAL_TIMER_CAPTURE_GPIO_PIN_3 = 0x03, /**< capture GPIO_PIN_3 */
103 HAL_TIMER_CAPTURE_GPIO_PIN_4 = 0x04, /**< capture GPIO_PIN_4 */
104 HAL_TIMER_CAPTURE_GPIO_PIN_5 = 0x05, /**< capture GPIO_PIN_5 */
105 HAL_TIMER_CAPTURE_GPIO_PIN_6 = 0x06, /**< capture GPIO_PIN_6 */
106 HAL_TIMER_CAPTURE_GPIO_PIN_7 = 0x07, /**< capture GPIO_PIN_7 */
107 HAL_TIMER_CAPTURE_GPIO_PIN_8 = 0x08, /**< capture GPIO_PIN_8 */
108 HAL_TIMER_CAPTURE_GPIO_PIN_9 = 0x09, /**< capture GPIO_PIN_9 */
109 HAL_TIMER_CAPTURE_GPIO_PIN_10 = 0x0A, /**< capture GPIO_PIN_10 */
110 HAL_TIMER_CAPTURE_GPIO_PIN_11 = 0x0B, /**< capture GPIO_PIN_11 */
111 HAL_TIMER_CAPTURE_GPIO_PIN_12 = 0x0C, /**< capture GPIO_PIN_12 */
112 HAL_TIMER_CAPTURE_GPIO_PIN_13 = 0x0D, /**< capture GPIO_PIN_13 */
113 HAL_TIMER_CAPTURE_AON_GPIO_PIN_0 = 0x0E, /**< capture AON_GPIO_PIN_0 */
114 HAL_TIMER_CAPTURE_AON_GPIO_PIN_1 = 0x0F, /**< capture AON_GPIO_PIN_1 */
115 HAL_TIMER_CAPTURE_AON_GPIO_PIN_2 = 0x10, /**< capture AON_GPIO_PIN_2 */
116 HAL_TIMER_CAPTURE_AON_GPIO_PIN_3 = 0x11, /**< capture AON_GPIO_PIN_3 */
117 HAL_TIMER_CAPTURE_AON_GPIO_PIN_4 = 0x12, /**< capture AON_GPIO_PIN_4 */
118 HAL_TIMER_CAPTURE_AON_GPIO_PIN_5 = 0x13, /**< capture AON_GPIO_PIN_5 */
119 HAL_TIMER_CAPTURE_AON_GPIO_PIN_6 = 0x14, /**< capture AON_GPIO_PIN_6 */
120 HAL_TIMER_CAPTURE_AON_GPIO_PIN_7 = 0x15, /**< capture AON_GPIO_PIN_7 */
121 HAL_TIMER_CAPTURE_MSIO_PIN_0 = 0x16, /**< capture MSIO_PIN_0 */
122 HAL_TIMER_CAPTURE_MSIO_PIN_1 = 0x17, /**< capture MSIO_PIN_1 */
123 HAL_TIMER_CAPTURE_MSIO_PIN_2 = 0x18, /**< capture MSIO_PIN_2 */
124 HAL_TIMER_CAPTURE_MSIO_PIN_3 = 0x19, /**< capture MSIO_PIN_3 */
125 HAL_TIMER_CAPTURE_MSIO_PIN_4 = 0x1A, /**< capture MSIO_PIN_4 */
126 HAL_TIMER_CAPTURE_MSIO_PIN_5 = 0x1B, /**< capture MSIO_PIN_5 */
127 HAL_TIMER_CAPTURE_MSIO_PIN_6 = 0x1C, /**< capture MSIO_PIN_6 */
128 HAL_TIMER_CAPTURE_MSIO_PIN_7 = 0x1D, /**< capture MSIO_PIN_7 */
129 HAL_TIMER_CAPTURE_MSIO_PIN_8 = 0x1E, /**< capture MSIO_PIN_8 */
130 HAL_TIMER_CAPTURE_MSIO_PIN_9 = 0x1F, /**< capture MSIO_PIN_9 */
131 } hal_timer_capture_pin_t;
132
133 /** @} */
134
135 /** @} */
136
137 /** @addtogroup HAL_TIMER_STRUCTURES Structures
138 * @{
139 */
140
141 /** @defgroup TIMER_Configuration TIMER Configuration
142 * @{
143 */
144
145 /**
146 * @brief TIMER capture channel Structure definition
147 */
148 typedef struct _hal_timer_capture_channel_init
149 {
150 hal_timer_capture_type_t edge_capture; /**< Specifies the edge caputre type. */
151 hal_timer_capture_pin_t capture_pin; /**< Soecufies the capture io pin. */
152 } hal_timer_capture_channel_init_t;
153
154 /**
155 * @brief TIMER init Structure definition
156 */
157 typedef struct _timer_init
158 {
159 uint32_t auto_reload; /**< Specifies the auto-reload value. */
160 hal_timer_capture_channel_init_t capture_channel0; /**< Capture channel0 config. */
161 hal_timer_capture_channel_init_t capture_channel1; /**< Capture channel1 config. */
162 hal_timer_capture_channel_init_t capture_channel2; /**< Capture channel2 config. */
163 hal_timer_capture_channel_init_t capture_channel3; /**< Capture channel3 config. */
164 } timer_init_t;
165
166 /** @} */
167
168 /** @defgroup TIMER_handle TIMER handle
169 * @{
170 */
171
172 /**
173 * @brief TIMER handle Structure definition
174 */
175 typedef struct _timer_handle
176 {
177 timer_regs_t *p_instance; /**< Register base address */
178
179 timer_init_t init; /**< TIMER Base required parameters */
180
181 __IO hal_timer_state_t state; /**< TIMER operation state */
182
183 } timer_handle_t;
184 /** @} */
185
186 /** @} */
187
188 /** @addtogroup HAL_TIMER_CALLBACK_STRUCTURES Callback Structures
189 * @{
190 */
191
192 /** @defgroup HAL_TIMER_Callback Callback
193 * @{
194 */
195
196 /**
197 * @brief HAL_TIMER Callback function definition
198 */
199
200 typedef struct _hal_timer_base_callback
201 {
202 void (*timer_msp_init)(timer_handle_t *p_timer); /**< TIMER init MSP callback */
203 void (*timer_msp_deinit)(timer_handle_t *p_timer); /**< TIMER de-init MSP callback */
204 void (*timer_period_elapsed_callback)(timer_handle_t *p_timer); /**< TIMER period elapsed callback */
205 } hal_timer_base_callback_t;
206
207 /** @} */
208
209 /** @} */
210
211 /**
212 * @defgroup HAL_TIMER_MACRO Defines
213 * @{
214 */
215
216 /* Exported macro ------------------------------------------------------------*/
217 /** @defgroup TIMER_Exported_Macros TIMER Exported Macros
218 * @{
219 */
220
221 /** @brief Reset TIMER handle states.
222 * @param __HANDLE__ TIMER handle.
223 * @retval None
224 */
225 #define __HAL_TIMER_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->state = HAL_TIMER_STATE_RESET)
226
227 /** @brief Enable the specified TIMER peripheral.
228 * @param __HANDLE__ Specifies the TIMER Handle.
229 * @retval None
230 */
231 #define __HAL_TIMER_ENABLE(__HANDLE__) SET_BITS((__HANDLE__)->p_instance->CTRL, TIMER_CTRL_EN)
232
233 /** @brief Disable the specified TIMER peripheral.
234 * @param __HANDLE__ Specifies the TIMER Handle.
235 * @retval None
236 */
237 #define __HAL_TIMER_DISABLE(__HANDLE__) CLEAR_BITS((__HANDLE__)->p_instance->CTRL, TIMER_CTRL_EN)
238
239 /** @brief Enable the TIMER all interrupt.
240 * @param __HANDLE__ Specifies the TIMER Handle.
241 * @retval None
242 */
243 #define __HAL_TIMER_ENABLE_ALL_IT(__HANDLE__) ll_timer_enable_all_it((__HANDLE__)->p_instance)
244
245 /** @brief Disable the TIMER all interrupt.
246 * @param __HANDLE__ Specifies the TIMER Handle.
247 * @retval None
248 */
249 #define __HAL_TIMER_DISABLE_ALL_IT(__HANDLE__) ll_timer_disable_all_it((__HANDLE__)->p_instance)
250
251 /** @brief Check whether the TIMER interrupt has occurred or not.
252 * @param __HANDLE__ Specifies the TIMER Handle.
253 * @retval The new state of TIMER interrupt (SET or RESET).
254 */
255 #define __HAL_TIMER_GET_FLAG_IT(__HANDLE__) ll_timer_is_active_flag_it(__HANDLE__->p_instance)
256
257 /** @} */
258
259 /** @} */
260
261 /* Exported functions --------------------------------------------------------*/
262 /** @addtogroup HAL_TIMER_DRIVER_FUNCTIONS Functions
263 * @{
264 */
265
266 /** @addtogroup TIMER_Exported_Functions_Group1 Initialization and de-initialization functions
267 * @brief Initialization and de-initialization functions
268 *
269 * @verbatim
270 ===============================================================================
271 ##### Initialization and de-initialization functions #####
272 ===============================================================================
273 [..]
274 This section provides functions allowing to:
275 (+) Initialize and configure the TIMER.
276 (+) De-initialize the TIMER.
277 (+) Start the Timer.
278 (+) Stop the Timer.
279 (+) Start the Timer and enable interrupt.
280 (+) Stop the Timer and disable interrupt.
281
282 @endverbatim
283 * @{
284 */
285
286 /**
287 ****************************************************************************************
288 * @brief Initialize the TIMER according to the specified parameters
289 * in the timer_init_t and initialize the associated handle.
290 * @param[in] p_timer: Pointer to a TIMER handle which contains the configuration
291 * information for the specified TIMER module.
292 * @retval ::HAL_OK: Operation is OK.
293 * @retval ::HAL_ERROR: Parameter error or operation not supported.
294 * @retval ::HAL_BUSY: Driver is busy.
295 * @retval ::HAL_TIMEOUT: Timeout occurred.
296 ****************************************************************************************
297 */
298 hal_status_t hal_timer_init(timer_handle_t *p_timer);
299
300 /**
301 ****************************************************************************************
302 * @brief De-initialize the TIMER peripheral.
303 * @param[in] p_timer: Pointer to a TIMER handle which contains the configuration
304 * information for the specified TIMER module.
305 * @retval ::HAL_OK: Operation is OK.
306 * @retval ::HAL_ERROR: Parameter error or operation not supported.
307 * @retval ::HAL_BUSY: Driver is busy.
308 * @retval ::HAL_TIMEOUT: Timeout occurred.
309 ****************************************************************************************
310 */
311 hal_status_t hal_timer_deinit(timer_handle_t *p_timer);
312
313 /**
314 ****************************************************************************************
315 * @brief Initialize the TIMER MSP.
316 * @note This function should not be modified. When the callback is needed,
317 * the hal_timer_base_msp_init could be implemented in the user file.
318 * @param[in] p_timer: Pointer to a TIMER handle which contains the configuration
319 * information for the specified TIMER module.
320 ****************************************************************************************
321 */
322 void hal_timer_msp_init(timer_handle_t *p_timer);
323
324 /**
325 ****************************************************************************************
326 * @brief De-initialize the TIMER MSP.
327 * @note This function should not be modified. When the callback is needed,
328 * the hal_timer_base_msp_deinit could be implemented in the user file.
329 * @param[in] p_timer: Pointer to a TIM handle which contains the configuration
330 * information for the specified TIMER module.
331 ****************************************************************************************
332 */
333 void hal_timer_msp_deinit(timer_handle_t *p_timer);
334
335 /**
336 ****************************************************************************************
337 * @brief Starts the TIMER counter.
338 * @param[in] p_timer: Pointer to a TIMER handle which contains the configuration
339 * information for the specified TIMER module.
340 * @retval ::HAL_OK: Operation is OK.
341 * @retval ::HAL_ERROR: Parameter error or operation not supported.
342 * @retval ::HAL_BUSY: Driver is busy.
343 * @retval ::HAL_TIMEOUT: Timeout occurred.
344 ****************************************************************************************
345 */
346 hal_status_t hal_timer_start(timer_handle_t *p_timer);
347
348 /**
349 ****************************************************************************************
350 * @brief Stops the TIMER counter.
351 * @param[in] p_timer: Pointer to a TIMER handle which contains the configuration
352 * information for the specified TIMER module.
353 * @retval ::HAL_OK: Operation is OK.
354 * @retval ::HAL_ERROR: Parameter error or operation not supported.
355 * @retval ::HAL_BUSY: Driver is busy.
356 * @retval ::HAL_TIMEOUT: Timeout occurred.
357 ****************************************************************************************
358 */
359 hal_status_t hal_timer_stop(timer_handle_t *p_timer);
360
361 /**
362 ****************************************************************************************
363 * @brief Starts the TIMER counter in interrupt mode.
364 * @param[in] p_timer: Pointer to a TIMER handle which contains the configuration
365 * information for the specified TIMER module.
366 * @retval ::HAL_OK: Operation is OK.
367 * @retval ::HAL_ERROR: Parameter error or operation not supported.
368 * @retval ::HAL_BUSY: Driver is busy.
369 * @retval ::HAL_TIMEOUT: Timeout occurred.
370 ****************************************************************************************
371 */
372 hal_status_t hal_timer_start_it(timer_handle_t *p_timer);
373
374 /**
375 ****************************************************************************************
376 * @brief Stops the TIMER counter in interrupt mode.
377 * @param[in] p_timer: Pointer to a TIMER handle which contains the configuration
378 * information for the specified TIMER module.
379 * @retval ::HAL_OK: Operation is OK.
380 * @retval ::HAL_ERROR: Parameter error or operation not supported.
381 * @retval ::HAL_BUSY: Driver is busy.
382 * @retval ::HAL_TIMEOUT: Timeout occurred.
383 ****************************************************************************************
384 */
385 hal_status_t hal_timer_stop_it(timer_handle_t *p_timer);
386
387 /** @} */
388
389 /** @addtogroup TIMER_IRQ_Handler_and_Callbacks IRQ Handler and Callbacks
390 * @brief IRQ Handler and Callbacks functions
391 * @{
392 */
393
394 /**
395 ****************************************************************************************
396 * @brief Handle TIMER interrupt request.
397 * @param[in] p_timer: TIMER handle.
398 ****************************************************************************************
399 */
400 void hal_timer_irq_handler(timer_handle_t *p_timer);
401
402 /**
403 ****************************************************************************************
404 * @brief Period elapsed callback in non-blocking mode.
405 * @note This function should not be modified. When the callback is needed,
406 the hal_timer_period_elapsed_callback can be implemented in the user file.
407 * @param[in] p_timer: Pointer to a TIMER handle which contains the configuration
408 * information for the specified TIMER module.
409 ****************************************************************************************
410 */
411 void hal_timer_period_elapsed_callback(timer_handle_t *p_timer);
412
413 /**
414 ****************************************************************************************
415 * @brief channel0 event callback in non-blocking mode.
416 * @note This function should not be modified. When the callback is needed,
417 the hal_timer_channel0_event_callback can be implemented in the user file.
418 * @param[in] p_timer: Pointer to a TIMER handle which contains the configuration
419 * information for the specified TIMER module.
420 ****************************************************************************************
421 */
422 void hal_timer_channel0_event_callback(timer_handle_t *p_timer);
423
424 /**
425 ****************************************************************************************
426 * @brief channel1 event callback in non-blocking mode.
427 * @note This function should not be modified. When the callback is needed,
428 the hal_timer_channel1_event_callback can be implemented in the user file.
429 * @param[in] p_timer: Pointer to a TIMER handle which contains the configuration
430 * information for the specified TIMER module.
431 ****************************************************************************************
432 */
433 void hal_timer_channel1_event_callback(timer_handle_t *p_timer);
434
435 /**
436 ****************************************************************************************
437 * @brief channel2 event callback in non-blocking mode.
438 * @note This function should not be modified. When the callback is needed,
439 the hal_timer_channel2_event_callback can be implemented in the user file.
440 * @param[in] p_timer: Pointer to a TIMER handle which contains the configuration
441 * information for the specified TIMER module.
442 ****************************************************************************************
443 */
444 void hal_timer_channel2_event_callback(timer_handle_t *p_timer);
445
446 /**
447 ****************************************************************************************
448 * @brief channel3 event callback in non-blocking mode.
449 * @note This function should not be modified. When the callback is needed,
450 the hal_timer_channel3_event_callback can be implemented in the user file.
451 * @param[in] p_timer: Pointer to a TIMER handle which contains the configuration
452 * information for the specified TIMER module.
453 ****************************************************************************************
454 */
455 void hal_timer_channel3_event_callback(timer_handle_t *p_timer);
456
457 /**
458 ****************************************************************************************
459 * @brief ble pulse 1 event callback in non-blocking mode.
460 * @note This function should not be modified. When the callback is needed,
461 the hal_timer_channel3_event_callback can be implemented in the user file.
462 * @param[in] p_timer: Pointer to a TIMER handle which contains the configuration
463 * information for the specified TIMER module.
464 ****************************************************************************************
465 */
466 void hal_timer_blepulse1_event_callback(timer_handle_t *p_timer);
467
468 /**
469 ****************************************************************************************
470 * @brief ble pulse 2 event callback in non-blocking mode.
471 * @note This function should not be modified. When the callback is needed,
472 the hal_timer_channel3_event_callback can be implemented in the user file.
473 * @param[in] p_timer: Pointer to a TIMER handle which contains the configuration
474 * information for the specified TIMER module.
475 ****************************************************************************************
476 */
477 void hal_timer_blepulse2_event_callback(timer_handle_t *p_timer);
478
479 /** @} */
480
481 /** @addtogroup TIMER_Exported_Functions_Group2 Peripheral Control and State functions
482 * @brief TIMER Peripheral State functions
483 *
484 @verbatim
485 ==============================================================================
486 ##### Peripheral Control and State functions #####
487 ==============================================================================
488 [..]
489 This subsection provides functions allowing to :
490 (+) Return the TIMER handle state.
491 (+) Configure the TIMER.
492
493 @endverbatim
494 * @{
495 */
496
497 /**
498 ****************************************************************************************
499 * @brief Return the TIMER handle state.
500 * @param[in] p_timer: Pointer to a TIMER handle which contains the configuration
501 * information for the specified TIMER module.
502 * @retval ::HAL_TIMER_STATE_RESET: Peripheral not yet initialized or disabled.
503 * @retval ::HAL_TIMER_STATE_READY: Peripheral Initialized and ready for use.
504 * @retval ::HAL_TIMER_STATE_BUSY: An internal process is ongoing.
505 * @retval ::HAL_TIMER_STATE_ERROR: Reception process is ongoing.
506 ****************************************************************************************
507 */
508 hal_timer_state_t hal_timer_get_state(const timer_handle_t *p_timer);
509
510 /**
511 ****************************************************************************************
512 * @brief TIMER configuration
513 * @param[in] p_timer: Pointer to a TIMER handle which contains the configuration
514 * information for the specified TIMER module.
515 * @param[in] p_structure: The TIMER configuration structure
516 * @retval ::HAL_OK: Operation is OK.
517 * @retval ::HAL_ERROR: Parameter error or operation not supported.
518 * @retval ::HAL_BUSY: Driver is busy.
519 * @retval ::HAL_TIMEOUT: Timeout occurred.
520 ****************************************************************************************
521 */
522 hal_status_t hal_timer_set_config(const timer_handle_t *p_timer, const timer_init_t *p_structure);
523
524 /**
525 ****************************************************************************************
526 * @brief Get current value of channel0.
527 * @param[in] p_timer: Pointer to a TIMER handle which contains the configuration
528 * information for the specified TIMER module.
529 * @retval ::Current timer value
530 ****************************************************************************************
531 */
532 uint32_t hal_timer_get_channel0_val(const timer_handle_t *p_timer);
533
534 /**
535 ****************************************************************************************
536 * @brief Get current value of channel1.
537 * @param[in] p_timer: Pointer to a TIMER handle which contains the configuration
538 * information for the specified TIMER module.
539 * @retval ::Current timer value
540 ****************************************************************************************
541 */
542 uint32_t hal_timer_get_channel1_val(const timer_handle_t *p_timer);
543
544 /**
545 ****************************************************************************************
546 * @brief Get current value of channel2.
547 * @param[in] p_timer: Pointer to a TIMER handle which contains the configuration
548 * information for the specified TIMER module.
549 * @retval ::Current timer value
550 ****************************************************************************************
551 */
552 uint32_t hal_timer_get_channel2_val(const timer_handle_t *p_timer);
553
554 /**
555 ****************************************************************************************
556 * @brief Get current value of channel3.
557 * @param[in] p_timer: Pointer to a TIMER handle which contains the configuration
558 * information for the specified TIMER module.
559 * @retval ::Current timer value
560 ****************************************************************************************
561 */
562 uint32_t hal_timer_get_channel3_val(const timer_handle_t *p_timer);
563
564 /** @} */
565
566 /** @} */
567
568 #ifdef __cplusplus
569 }
570 #endif
571
572 #endif /* HAL_TIM_H */
573
574 /** @} */
575
576 /** @} */
577
578 /** @} */
HAL_TIMER_CAPTURE_GPIO_PIN_5
@ HAL_TIMER_CAPTURE_GPIO_PIN_5
Definition: hal_tim.h:104
HAL_TIMER_CAPTURE_GPIO_PIN_4
@ HAL_TIMER_CAPTURE_GPIO_PIN_4
Definition: hal_tim.h:103
hal_timer_blepulse1_event_callback
void hal_timer_blepulse1_event_callback(timer_handle_t *p_timer)
ble pulse 1 event callback in non-blocking mode.
HAL_TIMER_CAPTURE_MSIO_PIN_5
@ HAL_TIMER_CAPTURE_MSIO_PIN_5
Definition: hal_tim.h:126
HAL_TIMER_CAPTURE_MSIO_PIN_2
@ HAL_TIMER_CAPTURE_MSIO_PIN_2
Definition: hal_tim.h:123
hal_timer_stop
hal_status_t hal_timer_stop(timer_handle_t *p_timer)
Stops the TIMER counter.
HAL_TIMER_CAPTURE_MSIO_PIN_7
@ HAL_TIMER_CAPTURE_MSIO_PIN_7
Definition: hal_tim.h:128
HAL_TIMER_CAPTURE_GPIO_PIN_1
@ HAL_TIMER_CAPTURE_GPIO_PIN_1
Definition: hal_tim.h:100
HAL_TIMER_CAPTURE_GPIO_PIN_2
@ HAL_TIMER_CAPTURE_GPIO_PIN_2
Definition: hal_tim.h:101
timer_handle_t
struct _timer_handle timer_handle_t
TIMER handle Structure definition.
HAL_TIMER_CAPTURE_NONE
@ HAL_TIMER_CAPTURE_NONE
Definition: hal_tim.h:88
HAL_TIMER_CAPTURE_MSIO_PIN_1
@ HAL_TIMER_CAPTURE_MSIO_PIN_1
Definition: hal_tim.h:122
HAL_TIMER_CAPTURE_AON_GPIO_PIN_7
@ HAL_TIMER_CAPTURE_AON_GPIO_PIN_7
Definition: hal_tim.h:120
HAL_TIMER_STATE_BUSY
@ HAL_TIMER_STATE_BUSY
Definition: hal_tim.h:79
HAL_TIMER_CAPTURE_GPIO_PIN_9
@ HAL_TIMER_CAPTURE_GPIO_PIN_9
Definition: hal_tim.h:108
HAL_TIMER_CAPTURE_GPIO_PIN_7
@ HAL_TIMER_CAPTURE_GPIO_PIN_7
Definition: hal_tim.h:106
HAL_TIMER_CAPTURE_RISING
@ HAL_TIMER_CAPTURE_RISING
Definition: hal_tim.h:90
_timer_handle::p_instance
timer_regs_t * p_instance
Definition: hal_tim.h:177
hal_timer_stop_it
hal_status_t hal_timer_stop_it(timer_handle_t *p_timer)
Stops the TIMER counter in interrupt mode.
hal_timer_get_channel1_val
uint32_t hal_timer_get_channel1_val(const timer_handle_t *p_timer)
Get current value of channel1.
HAL_TIMER_CAPTURE_MSIO_PIN_6
@ HAL_TIMER_CAPTURE_MSIO_PIN_6
Definition: hal_tim.h:127
HAL_TIMER_CAPTURE_AON_GPIO_PIN_3
@ HAL_TIMER_CAPTURE_AON_GPIO_PIN_3
Definition: hal_tim.h:116
hal_timer_channel3_event_callback
void hal_timer_channel3_event_callback(timer_handle_t *p_timer)
channel3 event callback in non-blocking mode.
_timer_init::capture_channel3
hal_timer_capture_channel_init_t capture_channel3
Definition: hal_tim.h:163
hal_timer_capture_channel_init_t
struct _hal_timer_capture_channel_init hal_timer_capture_channel_init_t
TIMER capture channel Structure definition.
hal_timer_channel2_event_callback
void hal_timer_channel2_event_callback(timer_handle_t *p_timer)
channel2 event callback in non-blocking mode.
HAL_TIMER_CAPTURE_FALLING
@ HAL_TIMER_CAPTURE_FALLING
Definition: hal_tim.h:89
hal_timer_capture_type_t
hal_timer_capture_type_t
HAL TIMER capture type Enumerations definition.
Definition: hal_tim.h:87
HAL_TIMER_CAPTURE_MSIO_PIN_8
@ HAL_TIMER_CAPTURE_MSIO_PIN_8
Definition: hal_tim.h:129
HAL_TIMER_STATE_RESET
@ HAL_TIMER_STATE_RESET
Definition: hal_tim.h:77
HAL_TIMER_CAPTURE_AON_GPIO_PIN_6
@ HAL_TIMER_CAPTURE_AON_GPIO_PIN_6
Definition: hal_tim.h:119
_hal_timer_capture_channel_init::capture_pin
hal_timer_capture_pin_t capture_pin
Definition: hal_tim.h:151
HAL_TIMER_STATE_READY
@ HAL_TIMER_STATE_READY
Definition: hal_tim.h:78
_timer_init::capture_channel1
hal_timer_capture_channel_init_t capture_channel1
Definition: hal_tim.h:161
_hal_timer_base_callback
HAL_TIMER Callback function definition.
Definition: hal_tim.h:201
_hal_timer_capture_channel_init::edge_capture
hal_timer_capture_type_t edge_capture
Definition: hal_tim.h:150
hal_timer_get_channel2_val
uint32_t hal_timer_get_channel2_val(const timer_handle_t *p_timer)
Get current value of channel2.
_timer_handle::state
__IO hal_timer_state_t state
Definition: hal_tim.h:181
HAL_TIMER_CAPTURE_GPIO_PIN_13
@ HAL_TIMER_CAPTURE_GPIO_PIN_13
Definition: hal_tim.h:112
hal_timer_channel0_event_callback
void hal_timer_channel0_event_callback(timer_handle_t *p_timer)
channel0 event callback in non-blocking mode.
HAL_TIMER_CAPTURE_GPIO_PIN_3
@ HAL_TIMER_CAPTURE_GPIO_PIN_3
Definition: hal_tim.h:102
_hal_timer_capture_channel_init
TIMER capture channel Structure definition.
Definition: hal_tim.h:149
hal_timer_set_config
hal_status_t hal_timer_set_config(const timer_handle_t *p_timer, const timer_init_t *p_structure)
TIMER configuration.
HAL_TIMER_CAPTURE_AON_GPIO_PIN_2
@ HAL_TIMER_CAPTURE_AON_GPIO_PIN_2
Definition: hal_tim.h:115
_timer_init
TIMER init Structure definition.
Definition: hal_tim.h:158
ll_tim.h
Header file containing functions prototypes of TIMER LL library.
HAL_TIMER_CAPTURE_MSIO_PIN_0
@ HAL_TIMER_CAPTURE_MSIO_PIN_0
Definition: hal_tim.h:121
_timer_init::auto_reload
uint32_t auto_reload
Definition: hal_tim.h:159
HAL_TIMER_CAPTURE_MSIO_PIN_4
@ HAL_TIMER_CAPTURE_MSIO_PIN_4
Definition: hal_tim.h:125
hal_timer_blepulse2_event_callback
void hal_timer_blepulse2_event_callback(timer_handle_t *p_timer)
ble pulse 2 event callback in non-blocking mode.
hal_timer_base_callback_t
struct _hal_timer_base_callback hal_timer_base_callback_t
HAL_TIMER Callback function definition.
hal_timer_get_state
hal_timer_state_t hal_timer_get_state(const timer_handle_t *p_timer)
Return the TIMER handle state.
hal_timer_channel1_event_callback
void hal_timer_channel1_event_callback(timer_handle_t *p_timer)
channel1 event callback in non-blocking mode.
HAL_TIMER_CAPTURE_AON_GPIO_PIN_5
@ HAL_TIMER_CAPTURE_AON_GPIO_PIN_5
Definition: hal_tim.h:118
HAL_TIMER_CAPTURE_GPIO_PIN_10
@ HAL_TIMER_CAPTURE_GPIO_PIN_10
Definition: hal_tim.h:109
HAL_TIMER_CAPTURE_AON_GPIO_PIN_1
@ HAL_TIMER_CAPTURE_AON_GPIO_PIN_1
Definition: hal_tim.h:114
HAL_TIMER_CAPTURE_GPIO_PIN_12
@ HAL_TIMER_CAPTURE_GPIO_PIN_12
Definition: hal_tim.h:111
HAL_TIMER_STATE_ERROR
@ HAL_TIMER_STATE_ERROR
Definition: hal_tim.h:80
_hal_timer_base_callback::timer_msp_deinit
void(* timer_msp_deinit)(timer_handle_t *p_timer)
Definition: hal_tim.h:203
HAL_TIMER_CAPTURE_GPIO_PIN_11
@ HAL_TIMER_CAPTURE_GPIO_PIN_11
Definition: hal_tim.h:110
_hal_timer_base_callback::timer_period_elapsed_callback
void(* timer_period_elapsed_callback)(timer_handle_t *p_timer)
Definition: hal_tim.h:204
hal_status_t
hal_status_t
HAL Status structures definition.
Definition: gr_common.h:140
HAL_TIMER_CAPTURE_GPIO_PIN_0
@ HAL_TIMER_CAPTURE_GPIO_PIN_0
Definition: hal_tim.h:99
HAL_TIMER_CAPTURE_MSIO_PIN_9
@ HAL_TIMER_CAPTURE_MSIO_PIN_9
Definition: hal_tim.h:130
_timer_handle::init
timer_init_t init
Definition: hal_tim.h:179
hal_timer_get_channel0_val
uint32_t hal_timer_get_channel0_val(const timer_handle_t *p_timer)
Get current value of channel0.
hal_def.h
This file contains HAL common definitions, enumeration, macros and structures definitions.
hal_timer_deinit
hal_status_t hal_timer_deinit(timer_handle_t *p_timer)
De-initialize the TIMER peripheral.
HAL_TIMER_CAPTURE_AON_GPIO_PIN_4
@ HAL_TIMER_CAPTURE_AON_GPIO_PIN_4
Definition: hal_tim.h:117
hal_timer_irq_handler
void hal_timer_irq_handler(timer_handle_t *p_timer)
Handle TIMER interrupt request.
_timer_handle
TIMER handle Structure definition.
Definition: hal_tim.h:176
hal_timer_period_elapsed_callback
void hal_timer_period_elapsed_callback(timer_handle_t *p_timer)
Period elapsed callback in non-blocking mode.
HAL_TIMER_CAPTURE_AON_GPIO_PIN_0
@ HAL_TIMER_CAPTURE_AON_GPIO_PIN_0
Definition: hal_tim.h:113
_timer_init::capture_channel0
hal_timer_capture_channel_init_t capture_channel0
Definition: hal_tim.h:160
hal_timer_start
hal_status_t hal_timer_start(timer_handle_t *p_timer)
Starts the TIMER counter.
HAL_TIMER_CAPTURE_GPIO_PIN_8
@ HAL_TIMER_CAPTURE_GPIO_PIN_8
Definition: hal_tim.h:107
hal_timer_start_it
hal_status_t hal_timer_start_it(timer_handle_t *p_timer)
Starts the TIMER counter in interrupt mode.
timer_init_t
struct _timer_init timer_init_t
TIMER init Structure definition.
hal_timer_capture_pin_t
hal_timer_capture_pin_t
HAL TIMER capture pin Enumerations definition.
Definition: hal_tim.h:98
hal_timer_msp_init
void hal_timer_msp_init(timer_handle_t *p_timer)
Initialize the TIMER MSP.
hal_timer_msp_deinit
void hal_timer_msp_deinit(timer_handle_t *p_timer)
De-initialize the TIMER MSP.
hal_timer_state_t
hal_timer_state_t
HAL TIMER State Enumerations definition.
Definition: hal_tim.h:76
HAL_TIMER_CAPTURE_MSIO_PIN_3
@ HAL_TIMER_CAPTURE_MSIO_PIN_3
Definition: hal_tim.h:124
_hal_timer_base_callback::timer_msp_init
void(* timer_msp_init)(timer_handle_t *p_timer)
Definition: hal_tim.h:202
_timer_init::capture_channel2
hal_timer_capture_channel_init_t capture_channel2
Definition: hal_tim.h:162
hal_timer_get_channel3_val
uint32_t hal_timer_get_channel3_val(const timer_handle_t *p_timer)
Get current value of channel3.
hal_timer_init
hal_status_t hal_timer_init(timer_handle_t *p_timer)
Initialize the TIMER according to the specified parameters in the timer_init_t and initialize the ass...
HAL_TIMER_CAPTURE_BOTH
@ HAL_TIMER_CAPTURE_BOTH
Definition: hal_tim.h:91
HAL_TIMER_CAPTURE_GPIO_PIN_6
@ HAL_TIMER_CAPTURE_GPIO_PIN_6
Definition: hal_tim.h:105