gr533x_hal_dual_tim.h
Go to the documentation of this file.
1 /**
2  ****************************************************************************************
3  *
4  * @file gr533x_hal_dual_tim.h
5  * @author BLE Driver Team
6  * @brief Header file containing functions prototypes of DUAL 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_DUAL_TIMER DUAL TIMER
47  * @brief DUAL TIM HAL module driver.
48  * @{
49  */
50 
51 /* Define to prevent recursive inclusion -------------------------------------*/
52 #ifndef __GR533x_HAL_DUAL_TIMER_H__
53 #define __GR533x_HAL_DUAL_TIMER_H__
54 
55 #ifdef __cplusplus
56 extern "C" {
57 #endif
58 
59 /* Includes ------------------------------------------------------------------*/
60 #include "gr533x_hal_def.h"
61 #include "gr533x_ll_dual_tim.h"
62 
63 /* Exported types ------------------------------------------------------------*/
64 /** @addtogroup HAL_DUAL_TIMER_ENUMERATIONS Enumerations
65  * @{
66  */
67 
68 /** @defgroup HAL_DUAL_TIMER_state HAL DUAL TIM state
69  * @{
70  */
71 
72 /**
73  * @brief HAL DUAL TIMER State Enumerations definition
74  */
75 typedef enum
76 {
77  HAL_DUAL_TIMER_STATE_RESET = 0x00, /**< Peripheral not yet initialized or disabled */
78  HAL_DUAL_TIMER_STATE_READY = 0x01, /**< Peripheral Initialized and ready for use */
79  HAL_DUAL_TIMER_STATE_BUSY = 0x02, /**< An internal process is ongoing */
80  HAL_DUAL_TIMER_STATE_ERROR = 0x04 /**< Reception process is ongoing */
82 /** @} */
83 
84 /** @defgroup HAL_DUAL_TIMER_channel HAL DUAL TIM channel
85  * @{
86  */
87 
88 /**
89  * @brief HAL DUAL TIMER Channel Enumerations definition
90  */
91 typedef enum
92 {
93  HAL_DUAL_TIMER_CHANNEL_A = 0x00, /**< Channel A */
94  HAL_DUAL_TIMER_CHANNEL_B = 0x01, /**< Channel B */
95  HAL_DUAL_TIMER_CHANNEL_C = 0x02, /**< Channel C */
97 /** @} */
98 
99 /** @} */
100 
101 /** @addtogroup HAL_DUAL_TIMER_STRUCTURES Structures
102  * @{
103  */
104 
105 /** @defgroup DUAL_TIMER_Configuration DUAL TIMER Configuration
106  * @{
107  */
108 
109 /**
110  * @brief DUAL TIMER init Structure definition
111  */
112 typedef struct _dual_timer_init
113 {
114  uint32_t prescaler; /**< Specifies the prescaler value used to divide the DUAL_TIMER clock.
115  This parameter can be a value of @ref DUAL_TIMER_Prescaler_Div */
116 
117  uint32_t counter_mode; /**< Specifies the counter mode.
118  This parameter can be a value of @ref DUAL_TIMER_Counter_Mode */
119 
120  uint32_t auto_reload; /**< Specifies the auto-reload value. */
121 
123 
124 /**
125  * @brief DUAL TIMER io crtl config Structure definition
126  */
128 {
129  hal_dual_timer_channel_t channel; /**< Specifies the channel.
130  This parameter can be a value of @ref HAL_DUAL_TIMER_channel */
131  uint32_t count1_value; /**< Specifies the count1 value.
132  The value is set to 0 to not use this count function */
133  uint32_t count2_value; /**< Specifies the count2 value.
134  The value is set to 0 to not use this count function */
135  uint32_t io_init_state; /**< Specifies the io initial state.
136  This parameter can be a value of @ref DUAL_TIMER_IO_Init_State */
137  uint32_t start_act_mode; /**< Specifies the start action mode.
138  This parameter can be a value of @ref DUAL_TIMER_IO_Act_Mode */
139  uint32_t period_act_mode; /**< Specifies the period action mode.
140  This parameter can be a value of @ref DUAL_TIMER_IO_Act_Mode */
141  uint32_t stop_act_mode; /**< Specifies the stop action mode.
142  This parameter can be a value of @ref DUAL_TIMER_IO_Act_Mode */
143  uint32_t count1_act_mode; /**< Specifies the count1 action mode.
144  This parameter can be a value of @ref DUAL_TIMER_IO_Act_Mode */
145  uint32_t count2_act_mode; /**< Specifies the count2 action mode.
146  This parameter can be a value of @ref DUAL_TIMER_IO_Act_Mode */
147  uint32_t start_act_it; /**< Specifies the start action interrupt config. */
148  uint32_t period_act_it; /**< Specifies the period action interrupt config. */
149  uint32_t stop_act_it; /**< Specifies the stop action interrupt config. */
150  uint32_t count1_act_it; /**< Specifies the count1 action interrupt config. */
151  uint32_t count2_act_it; /**< Specifies the count2 action interrupt config. */
153 
154 /** @} */
155 
156 /** @defgroup DUAL_TIMER_handle DUAL TIMER handle
157  * @{
158  */
159 
160 /**
161  * @brief DUAL_TIMER handle Structure definition
162  */
163 typedef struct _dual_timer_handle
164 {
165  dual_timer_regs_t *p_instance; /**< Register base address */
166 
167  dual_timer_init_t init; /**< DUAL_TIMER Base required parameters */
168 
169  dual_timer_io_ctrl_cfg_t io_crtl_cfg; /**< DUAL_TIMER io crtl required parameters. */
170 
171  __IO hal_lock_t lock; /**< Locking object */
172 
173  __IO hal_dual_timer_state_t state; /**< DUAL_TIMER operation state */
174 
176 /** @} */
177 
178 /** @} */
179 
180 /** @addtogroup HAL_DUAL_TIMER_CALLBACK_STRUCTURES Callback Structures
181  * @{
182  */
183 
184 /** @defgroup HAL_DUAL_TIMER_Callback Callback
185  * @{
186  */
187 
188 /**
189  * @brief HAL_DUAL_TIMER Callback function definition
190  */
191 
193 {
194  void (*dual_timer_msp_init)(dual_timer_handle_t *p_dual_timer); /**< DUAL_TIMER init MSP callback */
195  void (*dual_timer_msp_deinit)(dual_timer_handle_t *p_dual_timer); /**< DUAL_TIMER de-init MSP callback */
196  void (*dual_timer_period_elapsed_callback)(dual_timer_handle_t *p_dual_timer); /**< DUAL_TIMER period elapsed callback */
198 /** @} */
199 
200 /** @} */
201 
202 /**
203  * @defgroup HAL_DUAL_TIMER_MACRO Defines
204  * @{
205  */
206 
207 /* Exported constants --------------------------------------------------------*/
208 /** @defgroup DUAL_TIMER_Exported_Constants DUAL TIMER Exported Constants
209  * @{
210  */
211 
212 /** @defgroup DUAL_TIMER_Prescaler_Div DUAL TIMER Prescaler Division
213  * @{
214  */
215 #define DUAL_TIMER_PRESCALER_DIV0 LL_DUAL_TIMER_PRESCALER_DIV0 /**< 0 stage of prescale, clock is divided by 1. */
216 #define DUAL_TIMER_PRESCALER_DIV16 LL_DUAL_TIMER_PRESCALER_DIV16 /**< 4 stages of prescale, clock is divided by 16. */
217 #define DUAL_TIMER_PRESCALER_DIV256 LL_DUAL_TIMER_PRESCALER_DIV256 /**< 8 stages of prescale, clock is divided by 256. */
218 /** @} */
219 
220 /** @defgroup DUAL_TIMER_Counter_Mode DUAL TIMER Counter Mode
221  * @{
222  */
223 #define DUAL_TIMER_COUNTERMODE_LOOP 0x00000000U /**< DUAL TIMER Loop mode.*/
224 #define DUAL_TIMER_COUNTERMODE_ONESHOT DUAL_TIMER_CTRL_ONESHOT /**< DUAL TIMER One-shot mode. */
225 /** @} */
226 
227 /** @defgroup DUAL_TIMER_IO_Init_State DUAL TIMER IO Initial State
228  * @{
229  */
230 #define DUAL_TIMER_IO_INIT_RESET LL_DUAL_TIMER_IO_INIT_RESET /**< io init reset */
231 #define DUAL_TIMER_IO_INIT_SET LL_DUAL_TIMER_IO_INIT_SET /**< io init set */
232 /** @} */
233 
234 /** @defgroup DUAL_TIMER_IO_Act_Mode DUAL TIMER IO Action Mode
235  * @{
236  */
237 #define DUAL_TIMER_IO_ACTION_NONE LL_DUAL_TIMER_IO_ACTION_NONE /**< io action: do noting */
238 #define DUAL_TIMER_IO_ACTION_SET LL_DUAL_TIMER_IO_ACTION_SET /**< io action: set */
239 #define DUAL_TIMER_IO_ACTION_RESET LL_DUAL_TIMER_IO_ACTION_RESET /**< io action: reset */
240 #define DUAL_TIMER_IO_ACTION_TOGGLE LL_DUAL_TIMER_IO_ACTION_TOGGLE /**< io action: toggle */
241 /** @} */
242 
243 /** @} */
244 
245 /* Exported macro ------------------------------------------------------------*/
246 /** @defgroup DUAL_TIMER_Exported_Macros DUAL TIMER Exported Macros
247  * @{
248  */
249 
250 /** @brief Reset DUAL TIMER handle states.
251  * @param __HANDLE__ DUAL TIMER handle.
252  * @retval None
253  */
254 #define __HAL_DUAL_TIMER_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->state = HAL_DUAL_TIMER_STATE_RESET)
255 
256 /** @brief Enable the specified DUAL TIMER peripheral.
257  * @param __HANDLE__ Specifies the DUAL TIMER Handle.
258  * @retval None
259  */
260 #define __HAL_DUAL_TIMER_ENABLE(__HANDLE__) SET_BITS((__HANDLE__)->p_instance->CTRL, DUAL_TIMER_CTRL_EN)
261 
262 /** @brief Disable the specified DUAL TIMER peripheral.
263  * @param __HANDLE__ Specifies the DUAL TIMER Handle.
264  * @retval None
265  */
266 #define __HAL_DUAL_TIMER_DISABLE(__HANDLE__) CLEAR_BITS((__HANDLE__)->p_instance->CTRL, DUAL_TIMER_CTRL_EN)
267 
268 /** @brief Enable the DUAL TIMER interrupt.
269  * @param __HANDLE__ Specifies the DUAL TIM Handle.
270  * @retval None
271  */
272 #define __HAL_DUAL_TIMER_ENABLE_IT(__HANDLE__) SET_BITS((__HANDLE__)->p_instance->CTRL, DUAL_TIMER_CTRL_INTEN)
273 
274 /** @brief Disable the DUAL TIMER interrupt.
275  * @param __HANDLE__ Specifies the DUAL TIM Handle.
276  * @retval None
277  */
278 #define __HAL_DUAL_TIMER_DISABLE_IT(__HANDLE__) CLEAR_BITS((__HANDLE__)->p_instance->CTRL, DUAL_TIMER_CTRL_INTEN)
279 
280 /** @brief Check whether the DUAL TIMER interrupt has occurred or not.
281  * @param __HANDLE__ Specifies the DUAL TIMER Handle.
282  * @retval The new state of DUAL TIMER interrupt (SET or RESET).
283  */
284 #define __HAL_DUAL_TIMER_GET_FLAG_IT(__HANDLE__) ll_dual_timer_is_active_flag_it(__HANDLE__->p_instance)
285 
286 /** @brief Clear the DUAL TIMER interrupt flag.
287  * @param __HANDLE__ Specifies the DUAL TIMER Handle.
288  * @retval None.
289  */
290 #define __HAL_DUAL_TIMER_CLEAR_FLAG_IT(__HANDLE__) ll_dual_timer_clear_flag_it(__HANDLE__->p_instance)
291 
292 /** @} */
293 
294 /* Private macros ------------------------------------------------------------*/
295 /** @defgroup DUAL_TIMER_Private_Macros DUAL TIMER Private Macros
296  * @{
297  */
298 
299 /** @brief Check if DUAL TIMER prescaler is valid.
300  * @param __PRESCALER__ DUAL TIMER prescaler.
301  * @retval SET (__PRESCALER__ is valid) or RESET (__PRESCALER__ is invalid)
302  */
303 #define IS_DUAL_TIMER_PRESCALER(__PRESCALER__) (((__PRESCALER__) == DUAL_TIMER_PRESCALER_DIV0) || \
304  ((__PRESCALER__) == DUAL_TIMER_PRESCALER_DIV16) || \
305  ((__PRESCALER__) == DUAL_TIMER_PRESCALER_DIV256))
306 
307 /** @brief Check if DUAL TIMER counter mode is valid.
308  * @param __MODE__ DUAL TIMER counter mode.
309  * @retval SET (__MODE__ is valid) or RESET (__MODE__ is invalid)
310  */
311 #define IS_DUAL_TIMER_COUNTERMODE(__MODE__) (((__MODE__) == DUAL_TIMER_COUNTERMODE_LOOP) || \
312  ((__MODE__) == DUAL_TIMER_COUNTERMODE_ONESHOT))
313 
314 /** @brief Check if DUAL TIMER io initial state is valid.
315  * @param __MODE__ DUAL TIMER io initial state.
316  * @retval SET (__MODE__ is valid) or RESET (__MODE__ is invalid)
317  */
318 #define IS_DUAL_TIMER_IO_INIT_STATE(__MODE__) (((__MODE__) == DUAL_TIMER_IO_INIT_RESET) || \
319  ((__MODE__) == DUAL_TIMER_IO_INIT_SET))
320 
321 /** @brief Check if DUAL TIMER io action mode is valid.
322  * @param __MODE__ DUAL TIMER io action mode.
323  * @retval SET (__MODE__ is valid) or RESET (__MODE__ is invalid)
324  */
325 #define IS_DUAL_TIMER_IO_ACT_MODE(__MODE__) (((__MODE__) == DUAL_TIMER_IO_ACTION_NONE) || \
326  ((__MODE__) == DUAL_TIMER_IO_ACTION_SET)) || \
327  ((__MODE__) == DUAL_TIMER_IO_ACTION_RESET)) || \
328  ((__MODE__) == DUAL_TIMER_IO_ACTION_TOGGLE))
329 
330 /** @} */
331 
332 /** @} */
333 
334 /* Exported functions --------------------------------------------------------*/
335 /** @addtogroup HAL_DUAL_TIMER_DRIVER_FUNCTIONS Functions
336  * @{
337  */
338 
339 /** @addtogroup DUAL_TIMER_Exported_Functions_Group1 Initialization and de-initialization functions
340  * @brief Initialization and de-initialization functions
341  *
342  * @verbatim
343 ===============================================================================
344  ##### Initialization and de-initialization functions #####
345  ===============================================================================
346  [..]
347  This section provides functions allowing to:
348  (+) Initialize and configure the DUAL TIMER.
349  (+) De-initialize the DUAL TIMER.
350  (+) Start the Timer.
351  (+) Stop the Timer.
352  (+) Start the Timer and enable interrupt.
353  (+) Stop the Timer and disable interrupt.
354 
355 @endverbatim
356  * @{
357  */
358 
359 /**
360  ****************************************************************************************
361  * @brief Initialize the DUAL TIMER according to the specified parameters
362  * in the dual_timer_init_t and initialize the associated handle.
363  *
364  * @param[in] p_dual_timer: Pointer to a DUAL_TIMER handle which contains the configuration information for the specified DUAL TIMER.
365  *
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  */
373 
374 /**
375  ****************************************************************************************
376  * @brief De-initialize the DUAL TIMER peripheral.
377  *
378  * @param[in] p_dual_timer: Pointer to a DUAL_TIM handle which contains the configuration information for the specified DUAL TIMER.
379  *
380  * @retval ::HAL_OK: Operation is OK.
381  * @retval ::HAL_ERROR: Parameter error or operation not supported.
382  * @retval ::HAL_BUSY: Driver is busy.
383  * @retval ::HAL_TIMEOUT: Timeout occurred.
384  ****************************************************************************************
385  */
387 
388 /**
389  ****************************************************************************************
390  * @brief Initialize the DUAL TIMER MSP.
391  *
392  * @note This function should not be modified. When the callback is needed,
393  * the hal_dual_timer_base_msp_init could be implemented in the user file
394  *
395  * @param[in] p_dual_timer: Pointer to a DUAL_TIMER handle which contains the configuration information for the specified DUAL TIMER.
396  ****************************************************************************************
397  */
399 
400 /**
401  ****************************************************************************************
402  * @brief De-initialize the DUAL TIMER MSP.
403  *
404  * @note This function should not be modified. When the callback is needed,
405  * the hal_dual_timer_base_msp_deinit could be implemented in the user file
406  *
407  * @param[in] p_dual_timer: Pointer to a DUAL_TIM handle which contains the configuration information for the specified DUAL TIMER.
408  ****************************************************************************************
409  */
411 
412 /**
413  ****************************************************************************************
414  * @brief Starts the DUAL TIMER counter.
415  *
416  * @param[in] p_dual_timer: Pointer to a DUAL_TIMER handle which contains the configuration information for the specified DUAL TIMER.
417  *
418  * @retval ::HAL_OK: Operation is OK.
419  * @retval ::HAL_ERROR: Parameter error or operation not supported.
420  * @retval ::HAL_BUSY: Driver is busy.
421  * @retval ::HAL_TIMEOUT: Timeout occurred.
422  ****************************************************************************************
423  */
425 
426 /**
427  ****************************************************************************************
428  * @brief Stops the DUAL TIMER counter.
429  *
430  * @param[in] p_dual_timer: Pointer to a DUAL_TIM handle which contains the configuration information for the specified DUAL TIMER.
431  *
432  * @retval ::HAL_OK: Operation is OK.
433  * @retval ::HAL_ERROR: Parameter error or operation not supported.
434  * @retval ::HAL_BUSY: Driver is busy.
435  * @retval ::HAL_TIMEOUT: Timeout occurred.
436  ****************************************************************************************
437  */
439 
440 /**
441  ****************************************************************************************
442  * @brief Starts the DUAL TIMER counter in interrupt mode.
443  *
444  * @param[in] p_dual_timer: Pointer to a DUAL_TIM handle which contains the configuration information for the specified DUAL TIMER.
445  *
446  * @retval ::HAL_OK: Operation is OK.
447  * @retval ::HAL_ERROR: Parameter error or operation not supported.
448  * @retval ::HAL_BUSY: Driver is busy.
449  * @retval ::HAL_TIMEOUT: Timeout occurred.
450  ****************************************************************************************
451  */
453 
454 /**
455  ****************************************************************************************
456  * @brief Stops the DUAL TIMER counter in interrupt mode.
457  *
458  * @param[in] p_dual_timer: Pointer to a DUAL_TIMER handle which contains the configuration information for the specified DUAL TIMER.
459  *
460  * @retval ::HAL_OK: Operation is OK.
461  * @retval ::HAL_ERROR: Parameter error or operation not supported.
462  * @retval ::HAL_BUSY: Driver is busy.
463  * @retval ::HAL_TIMEOUT: Timeout occurred.
464  ****************************************************************************************
465  */
467 
468 /** @} */
469 
470 /** @addtogroup DUAL_TIMER_IRQ_Handler_and_Callbacks IRQ Handler and Callbacks
471  * @brief IRQ Handler and Callbacks functions
472  * @{
473  */
474 
475 /**
476  ****************************************************************************************
477  * @brief Handle DUAL TIMER interrupt request.
478  *
479  * @param[in] p_dual_timer: Pointer to a DUAL_TIMER handle which contains the configuration information for the specified DUAL TIMER.
480  ****************************************************************************************
481  */
483 
484 /**
485  ****************************************************************************************
486  * @brief Period elapsed callback in non-blocking mode.
487  *
488  * @note This function should not be modified. When the callback is needed,
489  * the hal_dual_timer_period_elapsed_callback can be implemented in the user file.
490  *
491  * @param[in] p_dual_timer: Pointer to a DUAL_TIMER handle which contains the configuration information for the specified DUAL TIMER.
492  ****************************************************************************************
493  */
495 
496 /**
497  ****************************************************************************************
498  * @brief Action when timer start callback in non-blocking mode.
499  *
500  * @note This function should not be modified. When the callback is needed,
501  * the hal_dual_timer_act_start_event_callback can be implemented in the user file.
502  *
503  * @param[in] p_dual_timer: Pointer to a DUAL_TIMER handle which contains the configuration information for the specified DUAL TIMER.
504  ****************************************************************************************
505  */
507 
508 /**
509  ****************************************************************************************
510  * @brief Action when timer value meets to COUNT_A1IO callback in non-blocking mode.
511  *
512  * @note This function should not be modified. When the callback is needed,
513  * the hal_dual_timer_ioa_act_c1_event_callback can be implemented in the user file.
514  *
515  * @param[in] p_dual_timer: Pointer to a DUAL_TIMER handle which contains the configuration information for the specified DUAL TIMER.
516  ****************************************************************************************
517  */
519 
520 /**
521  ****************************************************************************************
522  * @brief Action when timer value meets to COUNT_A2IO callback in non-blocking mode.
523  *
524  * @note This function should not be modified. When the callback is needed,
525  * the hal_dual_timer_ioa_act_c1_event_callback can be implemented in the user file.
526  *
527  * @param[in] p_dual_timer: Pointer to a DUAL_TIMER handle which contains the configuration information for the specified DUAL TIMER.
528  ****************************************************************************************
529  */
531 
532 /**
533  ****************************************************************************************
534  * @brief Action when timer value meets to 0 callback in non-blocking mode.
535  *
536  * @note This function should not be modified. When the callback is needed,
537  * the hal_dual_timer_act_period_event_callback can be implemented in the user file.
538  *
539  * @param[in] p_dual_timer: Pointer to a DUAL_TIMER handle which contains the configuration information for the specified DUAL TIMER.
540  ****************************************************************************************
541  */
543 
544 /**
545  ****************************************************************************************
546  * @brief Action when timer stop callback in non-blocking mode.
547  *
548  * @note This function should not be modified. When the callback is needed,
549  * the hal_dual_timer_act_stop_event_callback can be implemented in the user file.
550  *
551  * @param[in] p_dual_timer: Pointer to a DUAL_TIMER handle which contains the configuration information for the specified DUAL TIMER.
552  ****************************************************************************************
553  */
555 
556 /**
557  ****************************************************************************************
558  * @brief Action when timer value meets to COUNT_B1IO callback in non-blocking mode.
559  *
560  * @note This function should not be modified. When the callback is needed,
561  * the hal_dual_timer_iob_act_c1_event_callback can be implemented in the user file.
562  *
563  * @param[in] p_dual_timer: Pointer to a DUAL_TIMER handle which contains the configuration information for the specified DUAL TIMER.
564  ****************************************************************************************
565  */
567 
568 /**
569  ****************************************************************************************
570  * @brief Action when timer value meets to COUNT_B2IO callback in non-blocking mode.
571  *
572  * @note This function should not be modified. When the callback is needed,
573  * the hal_dual_timer_iob_act_c1_event_callback can be implemented in the user file.
574  *
575  * @param[in] p_dual_timer: Pointer to a DUAL_TIMER handle which contains the configuration information for the specified DUAL TIMER.
576  ****************************************************************************************
577  */
579 
580 /**
581  ****************************************************************************************
582  * @brief Action when timer value meets to COUNT_C1IO callback in non-blocking mode.
583  *
584  * @note This function should not be modified. When the callback is needed,
585  * the hal_dual_timer_ioc_act_c1_event_callback can be implemented in the user file.
586  *
587  * @param[in] p_dual_timer: Pointer to a DUAL_TIMER handle which contains the configuration information for the specified DUAL TIMER.
588  ****************************************************************************************
589  */
591 
592 /**
593  ****************************************************************************************
594  * @brief Action when timer value meets to COUNT_C2IO callback in non-blocking mode.
595  *
596  * @note This function should not be modified. When the callback is needed,
597  * the hal_dual_timer_ioc_act_c1_event_callback can be implemented in the user file.
598  *
599  * @param[in] p_dual_timer: Pointer to a DUAL_TIMER handle which contains the configuration information for the specified DUAL TIMER.
600  ****************************************************************************************
601  */
603 
604 /**
605  ****************************************************************************************
606  * @brief Action when timer value meets to BLE_COUNT1 callback in non-blocking mode.
607  *
608  * @note This function should not be modified. When the callback is needed,
609  * the hal_dual_timer_ioc_act_c1_event_callback can be implemented in the user file.
610  *
611  * @param[in] p_dual_timer: Pointer to a DUAL_TIMER handle which contains the configuration information for the specified DUAL TIMER.
612  ****************************************************************************************
613  */
615 
616 /**
617  ****************************************************************************************
618  * @brief Action when timer value meets to BLE_COUNT2 callback in non-blocking mode.
619  *
620  * @note This function should not be modified. When the callback is needed,
621  * the hal_dual_timer_ioc_act_c1_event_callback can be implemented in the user file.
622  *
623  * @param[in] p_dual_timer: Pointer to a DUAL_TIMER handle which contains the configuration information for the specified DUAL TIMER.
624  ****************************************************************************************
625  */
627 
628 /** @} */
629 
630 /** @addtogroup DUAL_TIMER_Exported_Functions_Group2 Peripheral Control and State functions
631  * @brief DUAL TIMER Peripheral State functions
632  *
633 @verbatim
634  ==============================================================================
635  ##### Peripheral Control and State functions #####
636  ==============================================================================
637  [..]
638  This subsection provides functions allowing to :
639  (+) Return the DUAL TIMER handle state.
640  (+) Configure the DUAL TIMER.
641 
642 @endverbatim
643  * @{
644  */
645 
646 /**
647  ****************************************************************************************
648  * @brief Return the DUAL TIMER handle state.
649  *
650  * @param[in] p_dual_timer: Pointer to a DUAL_TIMER handle which contains the configuration information for the specified DUAL TIMER.
651  *
652  * @retval ::HAL_DUAL_TIMER_STATE_RESET: Peripheral not yet initialized or disabled.
653  * @retval ::HAL_DUAL_TIMER_STATE_READY: Peripheral Initialized and ready for use.
654  * @retval ::HAL_DUAL_TIMER_STATE_BUSY: An internal process is ongoing.
655  * @retval ::HAL_DUAL_TIMER_STATE_ERROR: Reception process is ongoing.
656  ****************************************************************************************
657  */
659 
660 /**
661  ****************************************************************************************
662  * @brief DUAL TIMER configuration
663  *
664  * @param[in] p_dual_timer: Pointer to a DUAL_TIMER handle which contains the configuration information for the specified DUAL TIMER.
665  * @param[in] p_structure: The DUAL TIMER configuration structure
666  *
667  * @retval ::HAL_OK: Operation is OK.
668  * @retval ::HAL_ERROR: Parameter error or operation not supported.
669  * @retval ::HAL_BUSY: Driver is busy.
670  * @retval ::HAL_TIMEOUT: Timeout occurred.
671  ****************************************************************************************
672  */
674 
675 /**
676  ****************************************************************************************
677  * @brief DUAL TIMER set background reload value
678  * The background reload value contains the value from which the counter is to decrement.
679  * This is the value used to reload the counter when Periodic mode is enabled, and the current count reaches 0.
680  * The difference is that writes to background reload value do not cause the counter to immediately restart from the new value.
681  * @param[in] p_dual_timer: Pointer to a DUAL_TIMER handle which contains the configuration information for the specified DUAL TIMER.
682  * @param[in] reload_value: Background reload value
683  *
684  * @retval ::HAL_OK: Operation is OK.
685  * @retval ::HAL_ERROR: Parameter error or operation not supported.
686  * @retval ::HAL_BUSY: Driver is busy.
687  ****************************************************************************************
688  */
690 
691 /**
692  ****************************************************************************************
693  * @brief DUAL TIMER set one-time reload value
694  * The one-time reload value contains the value from which the counter is to decrement.
695  * This is the value used to reload the counter when Periodic mode is enabled, and the current count reaches 0.
696  * The difference is that writes to one-time reload value do not cause the counter to immediately restart from the new value.
697  * The one-time reload value only takes effect in the next cycle. It has higher priority than background reload.
698  * @param[in] p_dual_timer: Pointer to a DUAL_TIMER handle which contains the configuration information for the specified DUAL TIMER.
699  * @param[in] reload_value: One-time reload value
700  *
701  * @retval ::HAL_OK: Operation is OK.
702  * @retval ::HAL_ERROR: Parameter error or operation not supported.
703  * @retval ::HAL_BUSY: Driver is busy.
704  ****************************************************************************************
705  */
707 
708 /**
709  ****************************************************************************************
710  * @brief DUAL TIMER set period count value
711  * The value is valid when the value is greater than 1. This fucntion is only avaliable in Period/Loop mode with IO control.
712  * This function call must be after hal_dual_timer_io_crtl_config.
713  * This function will force the stop action interrupt to be turned on.
714  * If the current count value of the dual timer is not the period value, it may cause the first period to be shortened.
715  * @param[in] p_dual_timer: Pointer to a DUAL_TIMER handle which contains the configuration information for the specified DUAL TIMER.
716  * @param[in] count_value: period count value
717  *
718  * @retval ::HAL_OK: Operation is OK.
719  * @retval ::HAL_ERROR: Parameter error or operation not supported.
720  * @retval ::HAL_BUSY: Driver is busy.
721  ****************************************************************************************
722  */
724 
725 /**
726  ****************************************************************************************
727  * @brief DUAL TIMER io ctrl configuration
728  * This function call must be after hal_dual_timer_base_init.
729  *
730  * @param[in] p_dual_timer: Pointer to a DUAL_TIMER handle which contains the configuration information for the specified DUAL TIMER.
731  * @param[in] p_structure: The DUAL TIMER io crtl configuration structure
732  *
733  * @retval ::HAL_OK: Operation is OK.
734  * @retval ::HAL_ERROR: Parameter error or operation not supported.
735  * @retval ::HAL_BUSY: Driver is busy.
736  * @retval ::HAL_TIMEOUT: Timeout occurred.
737  ****************************************************************************************
738  */
740 
741 /** @} */
742 
743 /** @} */
744 
745 #ifdef __cplusplus
746 }
747 #endif
748 
749 #endif /* __GR533x_HAL_DUAL_TIMER_H__ */
750 
751 /** @} */
752 
753 /** @} */
754 
755 /** @} */
hal_dual_timer_callback_t
struct _hal_dual_timer_callback hal_dual_timer_callback_t
HAL_DUAL_TIMER Callback function definition.
hal_dual_timer_act_stop_event_callback
void hal_dual_timer_act_stop_event_callback(dual_timer_handle_t *p_dual_timer)
Action when timer stop callback in non-blocking mode.
hal_lock_t
hal_lock_t
HAL Lock structures definition.
Definition: gr533x_hal_def.h:81
_dual_timer_io_ctrl_cfg::period_act_it
uint32_t period_act_it
Definition: gr533x_hal_dual_tim.h:148
_hal_dual_timer_callback
HAL_DUAL_TIMER Callback function definition.
Definition: gr533x_hal_dual_tim.h:193
hal_dual_timer_base_deinit
hal_status_t hal_dual_timer_base_deinit(dual_timer_handle_t *p_dual_timer)
De-initialize the DUAL TIMER peripheral.
hal_dual_timer_get_state
hal_dual_timer_state_t hal_dual_timer_get_state(dual_timer_handle_t *p_dual_timer)
Return the DUAL TIMER handle state.
hal_dual_timer_set_period_count
hal_status_t hal_dual_timer_set_period_count(dual_timer_handle_t *p_dual_timer, uint32_t count_value)
DUAL TIMER set period count value The value is valid when the value is greater than 1....
HAL_DUAL_TIMER_STATE_RESET
@ HAL_DUAL_TIMER_STATE_RESET
Definition: gr533x_hal_dual_tim.h:77
HAL_DUAL_TIMER_STATE_BUSY
@ HAL_DUAL_TIMER_STATE_BUSY
Definition: gr533x_hal_dual_tim.h:79
dual_timer_io_ctrl_cfg_t
struct _dual_timer_io_ctrl_cfg dual_timer_io_ctrl_cfg_t
DUAL TIMER io crtl config Structure definition.
HAL_DUAL_TIMER_STATE_READY
@ HAL_DUAL_TIMER_STATE_READY
Definition: gr533x_hal_dual_tim.h:78
_dual_timer_io_ctrl_cfg::io_init_state
uint32_t io_init_state
Definition: gr533x_hal_dual_tim.h:135
_dual_timer_io_ctrl_cfg::period_act_mode
uint32_t period_act_mode
Definition: gr533x_hal_dual_tim.h:139
_hal_dual_timer_callback::dual_timer_msp_init
void(* dual_timer_msp_init)(dual_timer_handle_t *p_dual_timer)
Definition: gr533x_hal_dual_tim.h:194
_dual_timer_io_ctrl_cfg::stop_act_mode
uint32_t stop_act_mode
Definition: gr533x_hal_dual_tim.h:141
hal_dual_timer_channel_t
hal_dual_timer_channel_t
HAL DUAL TIMER Channel Enumerations definition.
Definition: gr533x_hal_dual_tim.h:92
HAL_DUAL_TIMER_STATE_ERROR
@ HAL_DUAL_TIMER_STATE_ERROR
Definition: gr533x_hal_dual_tim.h:80
_dual_timer_handle::io_crtl_cfg
dual_timer_io_ctrl_cfg_t io_crtl_cfg
Definition: gr533x_hal_dual_tim.h:169
hal_dual_timer_set_background_reload
hal_status_t hal_dual_timer_set_background_reload(dual_timer_handle_t *p_dual_timer, uint32_t reload_value)
DUAL TIMER set background reload value The background reload value contains the value from which the ...
HAL_DUAL_TIMER_CHANNEL_B
@ HAL_DUAL_TIMER_CHANNEL_B
Definition: gr533x_hal_dual_tim.h:94
_dual_timer_io_ctrl_cfg::stop_act_it
uint32_t stop_act_it
Definition: gr533x_hal_dual_tim.h:149
_dual_timer_handle
DUAL_TIMER handle Structure definition.
Definition: gr533x_hal_dual_tim.h:164
hal_dual_timer_base_stop
hal_status_t hal_dual_timer_base_stop(dual_timer_handle_t *p_dual_timer)
Stops the DUAL TIMER counter.
hal_dual_timer_act_period_event_callback
void hal_dual_timer_act_period_event_callback(dual_timer_handle_t *p_dual_timer)
Action when timer value meets to 0 callback in non-blocking mode.
_dual_timer_init::auto_reload
uint32_t auto_reload
Definition: gr533x_hal_dual_tim.h:120
_dual_timer_io_ctrl_cfg::count1_act_mode
uint32_t count1_act_mode
Definition: gr533x_hal_dual_tim.h:143
_dual_timer_io_ctrl_cfg::start_act_mode
uint32_t start_act_mode
Definition: gr533x_hal_dual_tim.h:137
_dual_timer_io_ctrl_cfg
DUAL TIMER io crtl config Structure definition.
Definition: gr533x_hal_dual_tim.h:128
hal_dual_timer_ble_pulse2_event_callback
void hal_dual_timer_ble_pulse2_event_callback(dual_timer_handle_t *p_dual_timer)
Action when timer value meets to BLE_COUNT2 callback in non-blocking mode.
_dual_timer_handle::p_instance
dual_timer_regs_t * p_instance
Definition: gr533x_hal_dual_tim.h:165
_hal_dual_timer_callback::dual_timer_msp_deinit
void(* dual_timer_msp_deinit)(dual_timer_handle_t *p_dual_timer)
Definition: gr533x_hal_dual_tim.h:195
gr533x_ll_dual_tim.h
Header file containing functions prototypes of DUAL TIMER LL library.
hal_dual_timer_iob_act_c2_event_callback
void hal_dual_timer_iob_act_c2_event_callback(dual_timer_handle_t *p_dual_timer)
Action when timer value meets to COUNT_B2IO callback in non-blocking mode.
_dual_timer_io_ctrl_cfg::count2_value
uint32_t count2_value
Definition: gr533x_hal_dual_tim.h:133
HAL_DUAL_TIMER_CHANNEL_A
@ HAL_DUAL_TIMER_CHANNEL_A
Definition: gr533x_hal_dual_tim.h:93
_dual_timer_io_ctrl_cfg::start_act_it
uint32_t start_act_it
Definition: gr533x_hal_dual_tim.h:147
_dual_timer_init
DUAL TIMER init Structure definition.
Definition: gr533x_hal_dual_tim.h:113
hal_dual_timer_base_start
hal_status_t hal_dual_timer_base_start(dual_timer_handle_t *p_dual_timer)
Starts the DUAL TIMER counter.
hal_dual_timer_ioc_act_c2_event_callback
void hal_dual_timer_ioc_act_c2_event_callback(dual_timer_handle_t *p_dual_timer)
Action when timer value meets to COUNT_C2IO callback in non-blocking mode.
hal_dual_timer_base_msp_deinit
void hal_dual_timer_base_msp_deinit(dual_timer_handle_t *p_dual_timer)
De-initialize the DUAL TIMER MSP.
hal_dual_timer_base_start_it
hal_status_t hal_dual_timer_base_start_it(dual_timer_handle_t *p_dual_timer)
Starts the DUAL TIMER counter in interrupt mode.
hal_dual_timer_state_t
hal_dual_timer_state_t
HAL DUAL TIMER State Enumerations definition.
Definition: gr533x_hal_dual_tim.h:76
hal_dual_timer_ioc_act_c1_event_callback
void hal_dual_timer_ioc_act_c1_event_callback(dual_timer_handle_t *p_dual_timer)
Action when timer value meets to COUNT_C1IO callback in non-blocking mode.
dual_timer_handle_t
struct _dual_timer_handle dual_timer_handle_t
DUAL_TIMER handle Structure definition.
hal_dual_timer_io_crtl_config
hal_status_t hal_dual_timer_io_crtl_config(dual_timer_handle_t *p_dual_timer, dual_timer_io_ctrl_cfg_t *p_structure)
DUAL TIMER io ctrl configuration This function call must be after hal_dual_timer_base_init.
hal_status_t
hal_status_t
HAL Status structures definition.
Definition: gr533x_hal_def.h:70
_dual_timer_io_ctrl_cfg::channel
hal_dual_timer_channel_t channel
Definition: gr533x_hal_dual_tim.h:129
_dual_timer_init::counter_mode
uint32_t counter_mode
Definition: gr533x_hal_dual_tim.h:117
hal_dual_timer_ioa_act_c1_event_callback
void hal_dual_timer_ioa_act_c1_event_callback(dual_timer_handle_t *p_dual_timer)
Action when timer value meets to COUNT_A1IO callback in non-blocking mode.
hal_dual_timer_iob_act_c1_event_callback
void hal_dual_timer_iob_act_c1_event_callback(dual_timer_handle_t *p_dual_timer)
Action when timer value meets to COUNT_B1IO callback in non-blocking mode.
_dual_timer_io_ctrl_cfg::count1_act_it
uint32_t count1_act_it
Definition: gr533x_hal_dual_tim.h:150
hal_dual_timer_set_onetime_reload
hal_status_t hal_dual_timer_set_onetime_reload(dual_timer_handle_t *p_dual_timer, uint32_t reload_value)
DUAL TIMER set one-time reload value The one-time reload value contains the value from which the coun...
hal_dual_timer_base_init
hal_status_t hal_dual_timer_base_init(dual_timer_handle_t *p_dual_timer)
Initialize the DUAL TIMER according to the specified parameters in the dual_timer_init_t and initiali...
_dual_timer_init::prescaler
uint32_t prescaler
Definition: gr533x_hal_dual_tim.h:114
dual_timer_init_t
struct _dual_timer_init dual_timer_init_t
DUAL TIMER init Structure definition.
hal_dual_timer_irq_handler
void hal_dual_timer_irq_handler(dual_timer_handle_t *p_dual_timer)
Handle DUAL TIMER interrupt request.
_dual_timer_handle::state
__IO hal_dual_timer_state_t state
Definition: gr533x_hal_dual_tim.h:173
hal_dual_timer_ioa_act_c2_event_callback
void hal_dual_timer_ioa_act_c2_event_callback(dual_timer_handle_t *p_dual_timer)
Action when timer value meets to COUNT_A2IO callback in non-blocking mode.
hal_dual_timer_period_elapsed_callback
void hal_dual_timer_period_elapsed_callback(dual_timer_handle_t *p_dual_timer)
Period elapsed callback in non-blocking mode.
_hal_dual_timer_callback::dual_timer_period_elapsed_callback
void(* dual_timer_period_elapsed_callback)(dual_timer_handle_t *p_dual_timer)
Definition: gr533x_hal_dual_tim.h:196
hal_dual_timer_base_stop_it
hal_status_t hal_dual_timer_base_stop_it(dual_timer_handle_t *p_dual_timer)
Stops the DUAL TIMER counter in interrupt mode.
hal_dual_timer_act_start_event_callback
void hal_dual_timer_act_start_event_callback(dual_timer_handle_t *p_dual_timer)
Action when timer start callback in non-blocking mode.
hal_dual_timer_set_config
hal_status_t hal_dual_timer_set_config(dual_timer_handle_t *p_dual_timer, dual_timer_init_t *p_structure)
DUAL TIMER configuration.
HAL_DUAL_TIMER_CHANNEL_C
@ HAL_DUAL_TIMER_CHANNEL_C
Definition: gr533x_hal_dual_tim.h:95
_dual_timer_handle::init
dual_timer_init_t init
Definition: gr533x_hal_dual_tim.h:167
_dual_timer_io_ctrl_cfg::count1_value
uint32_t count1_value
Definition: gr533x_hal_dual_tim.h:131
_dual_timer_handle::lock
__IO hal_lock_t lock
Definition: gr533x_hal_dual_tim.h:171
_dual_timer_io_ctrl_cfg::count2_act_mode
uint32_t count2_act_mode
Definition: gr533x_hal_dual_tim.h:145
gr533x_hal_def.h
This file contains HAL common definitions, enumeration, macros and structures definitions.
hal_dual_timer_base_msp_init
void hal_dual_timer_base_msp_init(dual_timer_handle_t *p_dual_timer)
Initialize the DUAL TIMER MSP.
hal_dual_timer_ble_pulse1_event_callback
void hal_dual_timer_ble_pulse1_event_callback(dual_timer_handle_t *p_dual_timer)
Action when timer value meets to BLE_COUNT1 callback in non-blocking mode.
_dual_timer_io_ctrl_cfg::count2_act_it
uint32_t count2_act_it
Definition: gr533x_hal_dual_tim.h:151