gr533x_hal_tim.h
Go to the documentation of this file.
1 /**
2 ****************************************************************************************
3 *
4 * @file gr533x_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 __GR533x_HAL_TIMER_H__
53 #define __GR533x_HAL_TIMER_H__
54
55 #ifdef __cplusplus
56 extern "C" {
57 #endif
58
59 /* Includes ------------------------------------------------------------------*/
60 #include "gr533x_hal_def.h"
61 #include "gr533x_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_lock_t lock; /**< Locking object */
182
183 __IO hal_timer_state_t state; /**< TIMER operation state */
184
185 } timer_handle_t;
186 /** @} */
187
188 /** @} */
189
190 /** @addtogroup HAL_TIMER_CALLBACK_STRUCTURES Callback Structures
191 * @{
192 */
193
194 /** @defgroup HAL_TIMER_Callback Callback
195 * @{
196 */
197
198 /**
199 * @brief HAL_TIMER Callback function definition
200 */
201
202 typedef struct _hal_timer_base_callback
203 {
204 void (*timer_msp_init)(timer_handle_t *p_timer); /**< TIMER init MSP callback */
205 void (*timer_msp_deinit)(timer_handle_t *p_timer); /**< TIMER de-init MSP callback */
206 void (*timer_period_elapsed_callback)(timer_handle_t *p_timer); /**< TIMER period elapsed callback */
207 } hal_timer_base_callback_t;
208
209 /** @} */
210
211 /** @} */
212
213 /**
214 * @defgroup HAL_TIMER_MACRO Defines
215 * @{
216 */
217
218 /* Exported macro ------------------------------------------------------------*/
219 /** @defgroup TIMER_Exported_Macros TIMER Exported Macros
220 * @{
221 */
222
223 /** @brief Reset TIMER handle states.
224 * @param __HANDLE__ TIMER handle.
225 * @retval None
226 */
227 #define __HAL_TIMER_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->state = HAL_TIMER_STATE_RESET)
228
229 /** @brief Enable the specified TIMER peripheral.
230 * @param __HANDLE__ Specifies the TIMER Handle.
231 * @retval None
232 */
233 #define __HAL_TIMER_ENABLE(__HANDLE__) SET_BITS((__HANDLE__)->p_instance->CTRL, TIMER_CTRL_EN)
234
235 /** @brief Disable the specified TIMER peripheral.
236 * @param __HANDLE__ Specifies the TIMER Handle.
237 * @retval None
238 */
239 #define __HAL_TIMER_DISABLE(__HANDLE__) CLEAR_BITS((__HANDLE__)->p_instance->CTRL, TIMER_CTRL_EN)
240
241 /** @brief Enable the TIMER all interrupt.
242 * @param __HANDLE__ Specifies the TIMER Handle.
243 * @retval None
244 */
245 #define __HAL_TIMER_ENABLE_ALL_IT(__HANDLE__) ll_timer_enable_all_it((__HANDLE__)->p_instance)
246
247 /** @brief Disable the TIMER all interrupt.
248 * @param __HANDLE__ Specifies the TIMER Handle.
249 * @retval None
250 */
251 #define __HAL_TIMER_DISABLE_ALL_IT(__HANDLE__) ll_timer_disable_all_it((__HANDLE__)->p_instance)
252
253 /** @brief Check whether the TIMER interrupt has occurred or not.
254 * @param __HANDLE__ Specifies the TIMER Handle.
255 * @retval The new state of TIMER interrupt (SET or RESET).
256 */
257 #define __HAL_TIMER_GET_FLAG_IT(__HANDLE__) ll_timer_is_active_flag_it(__HANDLE__->p_instance)
258
259 /** @} */
260
261 /** @} */
262
263 /* Exported functions --------------------------------------------------------*/
264 /** @addtogroup HAL_TIMER_DRIVER_FUNCTIONS Functions
265 * @{
266 */
267
268 /** @addtogroup TIMER_Exported_Functions_Group1 Initialization and de-initialization functions
269 * @brief Initialization and de-initialization functions
270 *
271 * @verbatim
272 ===============================================================================
273 ##### Initialization and de-initialization functions #####
274 ===============================================================================
275 [..]
276 This section provides functions allowing to:
277 (+) Initialize and configure the TIMER.
278 (+) De-initialize the TIMER.
279 (+) Start the Timer.
280 (+) Stop the Timer.
281 (+) Start the Timer and enable interrupt.
282 (+) Stop the Timer and disable interrupt.
283
284 @endverbatim
285 * @{
286 */
287
288 /**
289 ****************************************************************************************
290 * @brief Initialize the TIMER according to the specified parameters
291 * in the timer_init_t and initialize the associated handle.
292 * @param[in] p_timer: Pointer to a TIMER handle which contains the configuration
293 * information for the specified TIMER module.
294 * @retval ::HAL_OK: Operation is OK.
295 * @retval ::HAL_ERROR: Parameter error or operation not supported.
296 * @retval ::HAL_BUSY: Driver is busy.
297 * @retval ::HAL_TIMEOUT: Timeout occurred.
298 ****************************************************************************************
299 */
300 hal_status_t hal_timer_init(timer_handle_t *p_timer);
301
302 /**
303 ****************************************************************************************
304 * @brief De-initialize the TIMER peripheral.
305 * @param[in] p_timer: Pointer to a TIMER handle which contains the configuration
306 * information for the specified TIMER module.
307 * @retval ::HAL_OK: Operation is OK.
308 * @retval ::HAL_ERROR: Parameter error or operation not supported.
309 * @retval ::HAL_BUSY: Driver is busy.
310 * @retval ::HAL_TIMEOUT: Timeout occurred.
311 ****************************************************************************************
312 */
313 hal_status_t hal_timer_deinit(timer_handle_t *p_timer);
314
315 /**
316 ****************************************************************************************
317 * @brief Initialize the TIMER MSP.
318 * @note This function should not be modified. When the callback is needed,
319 * the hal_timer_base_msp_init could be implemented in the user file.
320 * @param[in] p_timer: Pointer to a TIMER handle which contains the configuration
321 * information for the specified TIMER module.
322 ****************************************************************************************
323 */
324 void hal_timer_msp_init(timer_handle_t *p_timer);
325
326 /**
327 ****************************************************************************************
328 * @brief De-initialize the TIMER MSP.
329 * @note This function should not be modified. When the callback is needed,
330 * the hal_timer_base_msp_deinit could be implemented in the user file.
331 * @param[in] p_timer: Pointer to a TIM handle which contains the configuration
332 * information for the specified TIMER module.
333 ****************************************************************************************
334 */
335 void hal_timer_msp_deinit(timer_handle_t *p_timer);
336
337 /**
338 ****************************************************************************************
339 * @brief Starts the TIMER counter.
340 * @param[in] p_timer: Pointer to a TIMER handle which contains the configuration
341 * information for the specified TIMER module.
342 * @retval ::HAL_OK: Operation is OK.
343 * @retval ::HAL_ERROR: Parameter error or operation not supported.
344 * @retval ::HAL_BUSY: Driver is busy.
345 * @retval ::HAL_TIMEOUT: Timeout occurred.
346 ****************************************************************************************
347 */
348 hal_status_t hal_timer_start(timer_handle_t *p_timer);
349
350 /**
351 ****************************************************************************************
352 * @brief Stops the TIMER counter.
353 * @param[in] p_timer: Pointer to a TIMER handle which contains the configuration
354 * information for the specified TIMER module.
355 * @retval ::HAL_OK: Operation is OK.
356 * @retval ::HAL_ERROR: Parameter error or operation not supported.
357 * @retval ::HAL_BUSY: Driver is busy.
358 * @retval ::HAL_TIMEOUT: Timeout occurred.
359 ****************************************************************************************
360 */
361 hal_status_t hal_timer_stop(timer_handle_t *p_timer);
362
363 /**
364 ****************************************************************************************
365 * @brief Starts the TIMER counter in interrupt mode.
366 * @param[in] p_timer: Pointer to a TIMER handle which contains the configuration
367 * information for the specified TIMER module.
368 * @retval ::HAL_OK: Operation is OK.
369 * @retval ::HAL_ERROR: Parameter error or operation not supported.
370 * @retval ::HAL_BUSY: Driver is busy.
371 * @retval ::HAL_TIMEOUT: Timeout occurred.
372 ****************************************************************************************
373 */
374 hal_status_t hal_timer_start_it(timer_handle_t *p_timer);
375
376 /**
377 ****************************************************************************************
378 * @brief Stops the TIMER counter in interrupt mode.
379 * @param[in] p_timer: Pointer to a TIMER handle which contains the configuration
380 * information for the specified TIMER module.
381 * @retval ::HAL_OK: Operation is OK.
382 * @retval ::HAL_ERROR: Parameter error or operation not supported.
383 * @retval ::HAL_BUSY: Driver is busy.
384 * @retval ::HAL_TIMEOUT: Timeout occurred.
385 ****************************************************************************************
386 */
387 hal_status_t hal_timer_stop_it(timer_handle_t *p_timer);
388
389 /** @} */
390
391 /** @addtogroup TIMER_IRQ_Handler_and_Callbacks IRQ Handler and Callbacks
392 * @brief IRQ Handler and Callbacks functions
393 * @{
394 */
395
396 /**
397 ****************************************************************************************
398 * @brief Handle TIMER interrupt request.
399 * @param[in] p_timer: TIMER handle.
400 ****************************************************************************************
401 */
402 void hal_timer_irq_handler(timer_handle_t *p_timer);
403
404 /**
405 ****************************************************************************************
406 * @brief Period elapsed callback in non-blocking mode.
407 * @note This function should not be modified. When the callback is needed,
408 the hal_timer_period_elapsed_callback can be implemented in the user file.
409 * @param[in] p_timer: Pointer to a TIMER handle which contains the configuration
410 * information for the specified TIMER module.
411 ****************************************************************************************
412 */
413 void hal_timer_period_elapsed_callback(timer_handle_t *p_timer);
414
415 /**
416 ****************************************************************************************
417 * @brief channel0 event callback in non-blocking mode.
418 * @note This function should not be modified. When the callback is needed,
419 the hal_timer_channel0_event_callback can be implemented in the user file.
420 * @param[in] p_timer: Pointer to a TIMER handle which contains the configuration
421 * information for the specified TIMER module.
422 ****************************************************************************************
423 */
424 void hal_timer_channel0_event_callback(timer_handle_t *p_timer);
425
426 /**
427 ****************************************************************************************
428 * @brief channel1 event callback in non-blocking mode.
429 * @note This function should not be modified. When the callback is needed,
430 the hal_timer_channel1_event_callback can be implemented in the user file.
431 * @param[in] p_timer: Pointer to a TIMER handle which contains the configuration
432 * information for the specified TIMER module.
433 ****************************************************************************************
434 */
435 void hal_timer_channel1_event_callback(timer_handle_t *p_timer);
436
437 /**
438 ****************************************************************************************
439 * @brief channel2 event callback in non-blocking mode.
440 * @note This function should not be modified. When the callback is needed,
441 the hal_timer_channel2_event_callback can be implemented in the user file.
442 * @param[in] p_timer: Pointer to a TIMER handle which contains the configuration
443 * information for the specified TIMER module.
444 ****************************************************************************************
445 */
446 void hal_timer_channel2_event_callback(timer_handle_t *p_timer);
447
448 /**
449 ****************************************************************************************
450 * @brief channel3 event callback in non-blocking mode.
451 * @note This function should not be modified. When the callback is needed,
452 the hal_timer_channel3_event_callback can be implemented in the user file.
453 * @param[in] p_timer: Pointer to a TIMER handle which contains the configuration
454 * information for the specified TIMER module.
455 ****************************************************************************************
456 */
457 void hal_timer_channel3_event_callback(timer_handle_t *p_timer);
458
459 /**
460 ****************************************************************************************
461 * @brief ble pulse 1 event callback in non-blocking mode.
462 * @note This function should not be modified. When the callback is needed,
463 the hal_timer_channel3_event_callback can be implemented in the user file.
464 * @param[in] p_timer: Pointer to a TIMER handle which contains the configuration
465 * information for the specified TIMER module.
466 ****************************************************************************************
467 */
468 void hal_timer_blepulse1_event_callback(timer_handle_t *p_timer);
469
470 /**
471 ****************************************************************************************
472 * @brief ble pulse 2 event callback in non-blocking mode.
473 * @note This function should not be modified. When the callback is needed,
474 the hal_timer_channel3_event_callback can be implemented in the user file.
475 * @param[in] p_timer: Pointer to a TIMER handle which contains the configuration
476 * information for the specified TIMER module.
477 ****************************************************************************************
478 */
479 void hal_timer_blepulse2_event_callback(timer_handle_t *p_timer);
480
481 /** @} */
482
483 /** @addtogroup TIMER_Exported_Functions_Group2 Peripheral Control and State functions
484 * @brief TIMER Peripheral State functions
485 *
486 @verbatim
487 ==============================================================================
488 ##### Peripheral Control and State functions #####
489 ==============================================================================
490 [..]
491 This subsection provides functions allowing to :
492 (+) Return the TIMER handle state.
493 (+) Configure the TIMER.
494
495 @endverbatim
496 * @{
497 */
498
499 /**
500 ****************************************************************************************
501 * @brief Return the TIMER handle state.
502 * @param[in] p_timer: Pointer to a TIMER handle which contains the configuration
503 * information for the specified TIMER module.
504 * @retval ::HAL_TIMER_STATE_RESET: Peripheral not yet initialized or disabled.
505 * @retval ::HAL_TIMER_STATE_READY: Peripheral Initialized and ready for use.
506 * @retval ::HAL_TIMER_STATE_BUSY: An internal process is ongoing.
507 * @retval ::HAL_TIMER_STATE_ERROR: Reception process is ongoing.
508 ****************************************************************************************
509 */
510 hal_timer_state_t hal_timer_get_state(timer_handle_t *p_timer);
511
512 /**
513 ****************************************************************************************
514 * @brief TIMER configuration
515 * @param[in] p_timer: Pointer to a TIMER handle which contains the configuration
516 * information for the specified TIMER module.
517 * @param[in] p_structure: The TIMER configuration structure
518 * @retval ::HAL_OK: Operation is OK.
519 * @retval ::HAL_ERROR: Parameter error or operation not supported.
520 * @retval ::HAL_BUSY: Driver is busy.
521 * @retval ::HAL_TIMEOUT: Timeout occurred.
522 ****************************************************************************************
523 */
524 hal_status_t hal_timer_set_config(timer_handle_t *p_timer, timer_init_t *p_structure);
525
526 /**
527 ****************************************************************************************
528 * @brief Get current value of channel0.
529 * @param[in] p_timer: Pointer to a TIMER handle which contains the configuration
530 * information for the specified TIMER module.
531 * @retval ::Current timer value
532 ****************************************************************************************
533 */
534 uint32_t hal_timer_get_channel0_val(timer_handle_t *p_timer);
535
536 /**
537 ****************************************************************************************
538 * @brief Get current value of channel1.
539 * @param[in] p_timer: Pointer to a TIMER handle which contains the configuration
540 * information for the specified TIMER module.
541 * @retval ::Current timer value
542 ****************************************************************************************
543 */
544 uint32_t hal_timer_get_channel1_val(timer_handle_t *p_timer);
545
546 /**
547 ****************************************************************************************
548 * @brief Get current value of channel2.
549 * @param[in] p_timer: Pointer to a TIMER handle which contains the configuration
550 * information for the specified TIMER module.
551 * @retval ::Current timer value
552 ****************************************************************************************
553 */
554 uint32_t hal_timer_get_channel2_val(timer_handle_t *p_timer);
555
556 /**
557 ****************************************************************************************
558 * @brief Get current value of channel3.
559 * @param[in] p_timer: Pointer to a TIMER handle which contains the configuration
560 * information for the specified TIMER module.
561 * @retval ::Current timer value
562 ****************************************************************************************
563 */
564 uint32_t hal_timer_get_channel3_val(timer_handle_t *p_timer);
565
566 /** @} */
567
568 /** @} */
569
570 #ifdef __cplusplus
571 }
572 #endif
573
574 #endif /* __GR533x_HAL_TIMER_H__ */
575
576 /** @} */
577
578 /** @} */
579
580 /** @} */
HAL_TIMER_CAPTURE_GPIO_PIN_5
@ HAL_TIMER_CAPTURE_GPIO_PIN_5
Definition: gr533x_hal_tim.h:104
HAL_TIMER_CAPTURE_GPIO_PIN_4
@ HAL_TIMER_CAPTURE_GPIO_PIN_4
Definition: gr533x_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: gr533x_hal_tim.h:126
HAL_TIMER_CAPTURE_MSIO_PIN_2
@ HAL_TIMER_CAPTURE_MSIO_PIN_2
Definition: gr533x_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: gr533x_hal_tim.h:128
HAL_TIMER_CAPTURE_GPIO_PIN_1
@ HAL_TIMER_CAPTURE_GPIO_PIN_1
Definition: gr533x_hal_tim.h:100
hal_lock_t
hal_lock_t
HAL Lock structures definition.
Definition: gr533x_hal_def.h:81
HAL_TIMER_CAPTURE_GPIO_PIN_2
@ HAL_TIMER_CAPTURE_GPIO_PIN_2
Definition: gr533x_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: gr533x_hal_tim.h:88
HAL_TIMER_CAPTURE_MSIO_PIN_1
@ HAL_TIMER_CAPTURE_MSIO_PIN_1
Definition: gr533x_hal_tim.h:122
HAL_TIMER_CAPTURE_AON_GPIO_PIN_7
@ HAL_TIMER_CAPTURE_AON_GPIO_PIN_7
Definition: gr533x_hal_tim.h:120
HAL_TIMER_STATE_BUSY
@ HAL_TIMER_STATE_BUSY
Definition: gr533x_hal_tim.h:79
HAL_TIMER_CAPTURE_GPIO_PIN_9
@ HAL_TIMER_CAPTURE_GPIO_PIN_9
Definition: gr533x_hal_tim.h:108
HAL_TIMER_CAPTURE_GPIO_PIN_7
@ HAL_TIMER_CAPTURE_GPIO_PIN_7
Definition: gr533x_hal_tim.h:106
HAL_TIMER_CAPTURE_RISING
@ HAL_TIMER_CAPTURE_RISING
Definition: gr533x_hal_tim.h:90
_timer_handle::p_instance
timer_regs_t * p_instance
Definition: gr533x_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_CAPTURE_MSIO_PIN_6
@ HAL_TIMER_CAPTURE_MSIO_PIN_6
Definition: gr533x_hal_tim.h:127
HAL_TIMER_CAPTURE_AON_GPIO_PIN_3
@ HAL_TIMER_CAPTURE_AON_GPIO_PIN_3
Definition: gr533x_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: gr533x_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: gr533x_hal_tim.h:89
hal_timer_capture_type_t
hal_timer_capture_type_t
HAL TIMER capture type Enumerations definition.
Definition: gr533x_hal_tim.h:87
HAL_TIMER_CAPTURE_MSIO_PIN_8
@ HAL_TIMER_CAPTURE_MSIO_PIN_8
Definition: gr533x_hal_tim.h:129
HAL_TIMER_STATE_RESET
@ HAL_TIMER_STATE_RESET
Definition: gr533x_hal_tim.h:77
HAL_TIMER_CAPTURE_AON_GPIO_PIN_6
@ HAL_TIMER_CAPTURE_AON_GPIO_PIN_6
Definition: gr533x_hal_tim.h:119
_hal_timer_capture_channel_init::capture_pin
hal_timer_capture_pin_t capture_pin
Definition: gr533x_hal_tim.h:151
HAL_TIMER_STATE_READY
@ HAL_TIMER_STATE_READY
Definition: gr533x_hal_tim.h:78
_timer_init::capture_channel1
hal_timer_capture_channel_init_t capture_channel1
Definition: gr533x_hal_tim.h:161
hal_timer_get_channel3_val
uint32_t hal_timer_get_channel3_val(timer_handle_t *p_timer)
Get current value of channel3.
_hal_timer_base_callback
HAL_TIMER Callback function definition.
Definition: gr533x_hal_tim.h:203
_hal_timer_capture_channel_init::edge_capture
hal_timer_capture_type_t edge_capture
Definition: gr533x_hal_tim.h:150
_timer_handle::state
__IO hal_timer_state_t state
Definition: gr533x_hal_tim.h:183
HAL_TIMER_CAPTURE_GPIO_PIN_13
@ HAL_TIMER_CAPTURE_GPIO_PIN_13
Definition: gr533x_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: gr533x_hal_tim.h:102
_hal_timer_capture_channel_init
TIMER capture channel Structure definition.
Definition: gr533x_hal_tim.h:149
HAL_TIMER_CAPTURE_AON_GPIO_PIN_2
@ HAL_TIMER_CAPTURE_AON_GPIO_PIN_2
Definition: gr533x_hal_tim.h:115
_timer_init
TIMER init Structure definition.
Definition: gr533x_hal_tim.h:158
HAL_TIMER_CAPTURE_MSIO_PIN_0
@ HAL_TIMER_CAPTURE_MSIO_PIN_0
Definition: gr533x_hal_tim.h:121
_timer_handle::lock
__IO hal_lock_t lock
Definition: gr533x_hal_tim.h:181
_timer_init::auto_reload
uint32_t auto_reload
Definition: gr533x_hal_tim.h:159
HAL_TIMER_CAPTURE_MSIO_PIN_4
@ HAL_TIMER_CAPTURE_MSIO_PIN_4
Definition: gr533x_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_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: gr533x_hal_tim.h:118
HAL_TIMER_CAPTURE_GPIO_PIN_10
@ HAL_TIMER_CAPTURE_GPIO_PIN_10
Definition: gr533x_hal_tim.h:109
HAL_TIMER_CAPTURE_AON_GPIO_PIN_1
@ HAL_TIMER_CAPTURE_AON_GPIO_PIN_1
Definition: gr533x_hal_tim.h:114
HAL_TIMER_CAPTURE_GPIO_PIN_12
@ HAL_TIMER_CAPTURE_GPIO_PIN_12
Definition: gr533x_hal_tim.h:111
HAL_TIMER_STATE_ERROR
@ HAL_TIMER_STATE_ERROR
Definition: gr533x_hal_tim.h:80
hal_timer_set_config
hal_status_t hal_timer_set_config(timer_handle_t *p_timer, timer_init_t *p_structure)
TIMER configuration.
_hal_timer_base_callback::timer_msp_deinit
void(* timer_msp_deinit)(timer_handle_t *p_timer)
Definition: gr533x_hal_tim.h:205
HAL_TIMER_CAPTURE_GPIO_PIN_11
@ HAL_TIMER_CAPTURE_GPIO_PIN_11
Definition: gr533x_hal_tim.h:110
_hal_timer_base_callback::timer_period_elapsed_callback
void(* timer_period_elapsed_callback)(timer_handle_t *p_timer)
Definition: gr533x_hal_tim.h:206
HAL_TIMER_CAPTURE_GPIO_PIN_0
@ HAL_TIMER_CAPTURE_GPIO_PIN_0
Definition: gr533x_hal_tim.h:99
HAL_TIMER_CAPTURE_MSIO_PIN_9
@ HAL_TIMER_CAPTURE_MSIO_PIN_9
Definition: gr533x_hal_tim.h:130
_timer_handle::init
timer_init_t init
Definition: gr533x_hal_tim.h:179
hal_status_t
hal_status_t
HAL Status structures definition.
Definition: gr533x_hal_def.h:70
hal_timer_deinit
hal_status_t hal_timer_deinit(timer_handle_t *p_timer)
De-initialize the TIMER peripheral.
hal_timer_get_channel2_val
uint32_t hal_timer_get_channel2_val(timer_handle_t *p_timer)
Get current value of channel2.
HAL_TIMER_CAPTURE_AON_GPIO_PIN_4
@ HAL_TIMER_CAPTURE_AON_GPIO_PIN_4
Definition: gr533x_hal_tim.h:117
hal_timer_irq_handler
void hal_timer_irq_handler(timer_handle_t *p_timer)
Handle TIMER interrupt request.
hal_timer_get_channel0_val
uint32_t hal_timer_get_channel0_val(timer_handle_t *p_timer)
Get current value of channel0.
_timer_handle
TIMER handle Structure definition.
Definition: gr533x_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: gr533x_hal_tim.h:113
_timer_init::capture_channel0
hal_timer_capture_channel_init_t capture_channel0
Definition: gr533x_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: gr533x_hal_tim.h:107
hal_timer_get_channel1_val
uint32_t hal_timer_get_channel1_val(timer_handle_t *p_timer)
Get current value of channel1.
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.
gr533x_ll_tim.h
Header file containing functions prototypes of TIMER LL library.
hal_timer_capture_pin_t
hal_timer_capture_pin_t
HAL TIMER capture pin Enumerations definition.
Definition: gr533x_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: gr533x_hal_tim.h:76
hal_timer_get_state
hal_timer_state_t hal_timer_get_state(timer_handle_t *p_timer)
Return the TIMER handle state.
HAL_TIMER_CAPTURE_MSIO_PIN_3
@ HAL_TIMER_CAPTURE_MSIO_PIN_3
Definition: gr533x_hal_tim.h:124
gr533x_hal_def.h
This file contains HAL common definitions, enumeration, macros and structures definitions.
_hal_timer_base_callback::timer_msp_init
void(* timer_msp_init)(timer_handle_t *p_timer)
Definition: gr533x_hal_tim.h:204
_timer_init::capture_channel2
hal_timer_capture_channel_init_t capture_channel2
Definition: gr533x_hal_tim.h:162
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: gr533x_hal_tim.h:91
HAL_TIMER_CAPTURE_GPIO_PIN_6
@ HAL_TIMER_CAPTURE_GPIO_PIN_6
Definition: gr533x_hal_tim.h:105