gr533x_hal_rtc.h
Go to the documentation of this file.
1 /**
2  ****************************************************************************************
3  *
4  * @file gr533x_hal_rtc.h
5  * @author BLE Driver Team
6  * @brief Header file containing functions prototypes of RTC 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_RTC RTC
47  * @brief RTC HAL module driver.
48  * @{
49  */
50 
51 #ifndef __GR533x_HAL_RTC_H__
52 #define __GR533x_HAL_RTC_H__
53 
54 #ifdef __cplusplus
55 extern "C" {
56 #endif
57 
58 /* Includes ------------------------------------------------------------------*/
59 #include "gr533x_ll_rtc.h"
60 #include "gr533x_hal_def.h"
61 
62 /**
63  * @defgroup HAL_RTC_MACRO Defines
64  * @{
65  */
66 
67 /* Exported constants --------------------------------------------------------*/
68 /** @defgroup RTC_Exported_Constants RTC Exported Constants
69  * @{
70  */
71 
72 /** @defgroup RTC_INTERRUPT_STATUS RTC Interrupt Status
73  * @{
74  */
75 #define RTC_FLAG_ALARM RTC_INT_STAT_ALARM /**< Alarm interrupt flag */
76 #define RTC_FLAG_WRAP RTC_INT_STAT_WRAP /**< Wrap interrupt flag */
77 #define RTC_FLAG_TICK RTC_INT_STAT_TICK /**< Tick interrupt flag */
78 /** @} */
79 
80 /** @defgroup RTC_INTERRUPT_ENABLE RTC Interrupt Enable
81  * @{
82  */
83 #define RTC_IT_ALARM RTC_INT_EN_ALARM /**< Alarm interrupt */
84 #define RTC_IT_WRAP RTC_INT_EN_WRAP /**< Wrap interrupt */
85 #define RTC_IT_TICK RTC_INT_EN_TICK /**< Tick interrupt */
86 /** @} */
87 
88 /** @defgroup RTC_Error_Code_definition RTC Error Code definition
89  * @{
90  */
91 #define HAL_RTC_ERROR_NONE (0x00000000U) /**< No error */
92 #define HAL_RTC_ERROR_INVALID_PARAM (0x00000001U) /**< Invalid parameter error */
93 #define HAL_RTC_ERROR_TIMEOUT (0x00000002U) /**< Timeout error */
94 /** @} */
95 
96 /** @defgroup RTC_CLOCK_DIV Clock divider
97  * @{
98  */
99 #define RTC_DIV_NONE LL_RTC_DIV_NONE /**< Select SLP_CLK */
100 #define RTC_DIV_2 LL_RTC_DIV_2 /**< Select 1/32 divider */
101 #define RTC_DIV_4 LL_RTC_DIV_4 /**< Select 1/32 divider */
102 #define RTC_DIV_8 LL_RTC_DIV_8 /**< Select 1/32 divider */
103 #define RTC_DIV_16 LL_RTC_DIV_16 /**< Select 1/32 divider */
104 #define RTC_DIV_32 LL_RTC_DIV_32 /**< Select 1/64 divider */
105 #define RTC_DIV_64 LL_RTC_DIV_64 /**< Select 1/128 divider */
106 #define RTC_DIV_128 LL_RTC_DIV_128 /**< Select 1/256 divider */
107 /** @} */
108 
109 /** @defgroup RTC_TICK relaod mode
110  * @{
111  */
112 #define ONE_TIME LL_RTC_TIMER_TICK_TYPE_SINGLE /**< Select periodic alarm one-time */
113 #define AUTO_RELOAD LL_RTC_TIMER_TICK_TYPE_AUTO /**< Select periodic alarm auto-reload */
114 /** @} */
115 
116 /** @} */
117 
118 /* Private macros ------------------------------------------------------------*/
119 /** @defgroup RTC_Private_Macro RTC Private Macros
120  * @{
121  */
122 
123 /** @brief Disable the specified RTC peripheral.
124  * @param RTCx RTC instance.
125  * @retval None
126  */
127 #define __HAL_RTC_DISABLE(RTCx) MODIFY_REG(RTCx->CFG0, 0xFFFFFFFF, RTC_CFG0_CFG);
128 
129 /** @brief Enable the specified RTC peripheral.
130  * @param RTCx RTC instance.
131  * @retval None
132  */
133 #define __HAL_RTC_ENABLE(RTCx) WRITE_REG(RTCx->CFG0, RTC_CFG0_CFG | RTC_CFG0_EN);
134 
135 /** @brief Get the specified RTC peripheral busy flag.
136  * @param RTCx RTC instance.
137  * @retval The new state of __BUSY__ (TRUE or FALSE).
138  */
139 #define __HAL_RTC_BUSY_FLAG(RTCx) ((READ_BITS(RTCx->STAT, RTC_STAT_BUSY) == RTC_STAT_BUSY))
140 
141 /** @brief Clear the specified RTC flag.
142  * @param RTCx RTC instance.
143  * @param __FLAG__ Specifies the flag to clear.
144  * This parameter can be one of the following values:
145  * @arg @ref RTC_FLAG_ALARM Alarm Interrupt event
146  * @arg @ref RTC_FLAG_WRAP Warp Interrupt event
147  * @arg @ref RTC_FLAG_TICK Tick Interrupt event
148  * @retval None
149  */
150 #define __HAL_RTC_CLEAR_FLAG(RTCx, __FLAG__) WRITE_REG(RTCx->INT_STAT, (__FLAG__))
151 
152 /** @brief Enable the specified RTC interrupts.
153  * @param RTCx RTC instance.
154  * @param __INTERRUPT__ Specifies the interrupt source to enable.
155  * This parameter can be one of the following values:
156  * @arg @ref RTC_IT_ALARM Alarm Interrupt
157  * @arg @ref RTC_IT_WRAP Warp Interrupt
158  * @arg @ref RTC_IT_TICK Tick Interrupt
159  * @retval None
160  */
161 #define __HAL_RTC_ENABLE_IT(RTCx, __INTERRUPT__) SET_BITS(RTCx->INT_EN, (__INTERRUPT__))
162 
163 /** @brief Disable the specified RTC interrupts.
164  * @param RTCx RTC instance.
165  * @param __INTERRUPT__ Specifies the interrupt source to disable.
166  * This parameter can be one of the following values:
167  * @arg @ref RTC_IT_ALARM Alarm Interrupt
168  * @arg @ref RTC_IT_WRAP Warp Interrupt
169  * @arg @ref RTC_IT_TICK Tick Interrupt
170  * @retval None
171  */
172 #define __HAL_RTC_DISABLE_IT(RTCx, __INTERRUPT__) CLEAR_BITS(RTCx->INT_EN, (__INTERRUPT__))
173 
174 /** @brief Check whether the specified RTC interrupt flag is set or not.
175  * @param RTCx RTC instance.
176  * @param __FLAG__ Specifies the interrupt source to check.
177  * This parameter can be one of the following values:
178  * @arg @ref RTC_FLAG_ALARM Alarm Interrupt event
179  * @arg @ref RTC_FLAG_WRAP Warp Interrupt event
180  * @arg @ref RTC_FLAG_TICK Tick Interrupt event
181  * @retval The new state of __IT__ (TRUE or FALSE).
182  */
183 #define __HAL_RTC_GET_IT_SOURCE(RTCx, __FLAG__) (READ_BITS(RTCx->INT_STAT, (__FLAG__)) == (__FLAG__))
184 
185 /** @} */
186 
187 /** @} */
188 
189 /* Exported types ------------------------------------------------------------*/
190 /** @addtogroup HAL_RTC_ENUMERATIONS Enumerations
191  * @{
192  */
193 
194 /**
195  * @brief hal_rtc_state definition
196  */
197 typedef enum
198 {
199  HAL_RTC_READY = 0x00U,
204 
205 /**
206  * @brief rtc_tick_state definition
207  */
208 typedef enum
209 {
210  TICK_READY = 0x00U,
212  TICK_ERROR
214 
215 /**
216  * @brief rtc_alarm_state definition
217  */
218 typedef enum
219 {
220  ALARM_READY = 0x00U,
224 
225 /**
226  * @brief overflow config
227  */
228 typedef enum
229 {
230  CLOSED = 0x00U,
231  OPENED = !CLOSED
233 
234 /** @} */
235 
236 /** @addtogroup HAL_RTC_STRUCTURES Structures
237  * @{
238  */
239 
240 /**
241  * @brief rtc init params
242  * @attention count up from zero if not set start_value.
243  */
244 typedef struct _rtc_init_t
245 {
246 
247  uint32_t start_value; /**< RTC init start value */
248 
249  uint32_t prescaler_div; /**< RTC init prescaler div */
250 
251  overflow_det_t overflow_det_state; /**< RTC init overflow det state */
252 
254 
255 /**
256  * @brief tick handle params
257  */
258 typedef struct _tick_handle_t
259 {
260  uint8_t mode; /**< RTC tickmode */
261 
262  uint32_t value; /**< RTC tick value */
263 
264  __IO rtc_tick_state_t state; /**< RTC tick state */
265 
267 
268 /**
269  * @brief alarm handle params
270  */
271 typedef struct _alarm_handle_t
272 {
273  uint32_t value; /**< RTC alarm value */
274 
275  __IO rtc_alarm_state_t state; /**< RTC alarm state */
276 
278 
279 
280 /**
281  * @brief rtc handle definition
282  */
283 typedef struct _rtc_handle_t
284 {
285  rtc_regs_t *p_instance; /*!< Register base address */
286 
287  rtc_init_t init; /*!< RTC required parameters */
288 
289  tick_handle_t tick; /*!< tick_handle */
290 
291  alarm_handle_t alarm; /*!< alarm_handle */
292 
293  hal_lock_t lock; /*!< RTC locking object */
294 
295  __IO hal_rtc_state_t state; /*!< Time communication state */
296 
297  __IO uint32_t error_code; /**< RTC Error code */
298 
300 
301 /** @} */
302 
303 /** @addtogroup HAL_RTC_CALLBACK_STRUCTURES Callback Structures
304  * @{
305  */
306 
307 /** @defgroup RTC_Callback RTC Callback
308  * @{
309  */
310 
311 /**
312  * @brief HAL_RTC Callback function definition
313  */
314 
315 typedef struct _hal_rtc_callback
316 {
317  void (*rtc_alarm_callback)(rtc_handle_t *p_rtc); /**< RTC alarm count complete callback */
318  void (*rtc_tick_callback)(rtc_handle_t *p_rtc); /**< RTC tick count complete callback */
319  void (*rtc_overflow_callback)(rtc_handle_t *p_rtc); /**< RTC overflow callback */
321 
322 /** @} */
323 
324 /** @} */
325 
326 /* Exported functions --------------------------------------------------------*/
327 /** @addtogroup HAL_RTC_DRIVER_FUNCTIONS Functions
328  * @{
329  */
330 
331 /** @addtogroup RTC_Exported_Functions_Group1 Initialization and de-initialization Functions
332  * @brief Initialization and Configuration functions
333  * @{
334  */
335 
336 /**
337  ****************************************************************************************
338  * @brief Initialize the RTC according to the specified parameters in the
339  * rtc_init_t of associated handle.counter start after hal_rtc_init.
340  *
341  * @param[in] p_rtc: Pointer to a RTC handle which contains the configuration
342  * information for the specified RTC module.
343  *
344  * @retval ::HAL_OK: Operation is OK.
345  * @retval ::HAL_ERROR: Parameter error or operation not supported.
346  * @retval ::HAL_BUSY: Driver is busy.
347  * @retval ::HAL_TIMEOUT: Timeout occurred.
348  ****************************************************************************************
349  */
351 
352 /**
353  ****************************************************************************************
354  * @brief DeInitialize the RTC according to the specified parameters in the
355  * rtc_init_t of associated handle.counter stop after hal_rtc_deinit.
356  *
357  * @param[in] p_rtc: Pointer to a RTC handle which contains the configuration
358  * information for the specified RTC module.
359  *
360  * @retval ::HAL_OK: Operation is OK.
361  * @retval ::HAL_ERROR: Parameter error or operation not supported.
362  * @retval ::HAL_BUSY: Driver is busy.
363  * @retval ::HAL_TIMEOUT: Timeout occurred.
364  ****************************************************************************************
365  */
367 
368 /**
369  ****************************************************************************************
370  * @brief Start counting down for tick module
371  *
372  * @param[in] p_rtc: Pointer to a RTC handle which contains the configuration
373  * information for the specified RTC module.
374  * @param[in] mode: ONE_TIME/AUTO_RELOAD
375  * @param[in] value: the tick start which start counting down
376  *
377  * @retval ::HAL_OK: Operation is OK.
378  * @retval ::HAL_ERROR: Parameter error or operation not supported.
379  * @retval ::HAL_BUSY: Driver is busy.
380  * @retval ::HAL_TIMEOUT: Timeout occurred.
381  ****************************************************************************************
382  */
383 hal_status_t hal_rtc_set_tick_and_start(rtc_handle_t *p_rtc, uint8_t mode,uint32_t value);
384 
385 /**
386  ****************************************************************************************
387  * @brief Stop counting down for tick module
388  *
389  * @param[in] p_rtc: Pointer to a RTC handle which contains the configuration
390  * information for the specified RTC module.
391  *
392  * @retval ::HAL_OK: Operation is OK.
393  * @retval ::HAL_ERROR: Parameter error or operation not supported.
394  * @retval ::HAL_BUSY: Driver is busy.
395  * @retval ::HAL_TIMEOUT: Timeout occurred.
396  ****************************************************************************************
397  */
399 
400 /**
401  ****************************************************************************************
402  * @brief Restart tick module and continue run with the previous settings.
403  * This function need be called after hal_rtc_stop_tick
404  *
405  * @param[in] p_rtc: Pointer to a RTC handle which contains the configuration
406  * information for the specified RTC module.
407  *
408  * @retval ::HAL_OK: Operation is OK.
409  * @retval ::HAL_ERROR: Parameter error or operation not supported.
410  * @retval ::HAL_BUSY: Driver is busy.
411  * @retval ::HAL_TIMEOUT: Timeout occurred.
412  ****************************************************************************************
413  */
415 /**
416  ****************************************************************************************
417  * @brief Compare counter with alarm_value for alarm module
418  *
419  * @param[in] p_rtc: Pointer to a RTC handle which contains the configuration
420  * information for the specified RTC module.
421  * @param[in] value: set alarm_value
422  *
423  * @retval ::HAL_OK: Operation is OK.
424  * @retval ::HAL_ERROR: Parameter error or operation not supported.
425  * @retval ::HAL_BUSY: Driver is busy.
426  * @retval ::HAL_TIMEOUT: Timeout occurred.
427  ****************************************************************************************
428  */
430 
431 /**
432  ****************************************************************************************
433  * @brief Stop counting up and compare with alarm_value for alarm module
434  *
435  * @param[in] p_rtc: Pointer to a RTC handle which contains the configuration
436  * information for the specified RTC module.
437  *
438  * @retval ::HAL_OK: Operation is OK.
439  * @retval ::HAL_ERROR: Parameter error or operation not supported.
440  * @retval ::HAL_BUSY: Driver is busy.
441  * @retval ::HAL_TIMEOUT: Timeout occurred.
442  ****************************************************************************************
443  */
445 
446 /**
447  ****************************************************************************************
448  * @brief Clear wrap count
449  *
450  * @param[in] p_rtc: Pointer to a RTC handle which contains the configuration
451  * information for the specified RTC module.
452  *
453  * @retval ::HAL_OK: Operation is OK.
454  * @retval ::HAL_ERROR: Parameter error or operation not supported.
455  * @retval ::HAL_BUSY: Driver is busy.
456  * @retval ::HAL_TIMEOUT: Timeout occurred.
457  ****************************************************************************************
458  */
460 
461 /**
462  ****************************************************************************************
463  * @brief Get the times of overflow
464  *
465  * @param[in] p_rtc: Pointer to a RTC handle which contains the configuration
466  * information for the specified RTC module.
467  *
468  * @retval ::uint32_t
469  ****************************************************************************************
470  */
472 
473 /**
474  ****************************************************************************************
475  * @brief Get_cur_count_value
476  *
477  * @param[in] p_rtc: Pointer to a RTC handle which contains the configuration
478  * information for the specified RTC module.
479  *
480  * @retval ::uint32_t
481  ****************************************************************************************
482  */
484 
485 /**
486  ****************************************************************************************
487  * @brief Get_cur_tick_value
488  *
489  * @param[in] p_rtc: Pointer to a RTC handle which contains the configuration
490  * information for the specified RTC module.
491  *
492  * @retval ::uint32_t
493  ****************************************************************************************
494  */
496 
497 /**
498  ****************************************************************************************
499  * @brief Get_alarm_value
500  *
501  * @param[in] p_rtc: Pointer to a RTC handle which contains the configuration
502  * information for the specified RTC module.
503  *
504  * @retval ::uint32_t
505  ****************************************************************************************
506  */
508 
509 /**
510  ****************************************************************************************
511  * @brief Get_cur_rtc_state
512  *
513  * @param[in] p_rtc: Pointer to a RTC handle which contains the configuration
514  * information for the specified RTC module.
515  *
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  */
523 
524 /** @} */
525 
526 /** @addtogroup RTC_IRQ_Handler_and_Callbacks IRQ Handler and Callbacks
527  * @brief IRQ Handler and Callbacks functions
528  * @{
529  */
530 
531 /**
532  ****************************************************************************************
533  * @brief RTC_IRQHandler
534  *
535  * @param[in] p_rtc: Pointer to a RTC handle which contains the configuration
536  * information for the specified RTC module.
537  ****************************************************************************************
538  */
540 
541 /**
542  ****************************************************************************************
543  * @brief alarm_callback
544  *
545  * @param[in] p_rtc: Pointer to a RTC handle which contains the configuration
546  * information for the specified RTC module.
547  ****************************************************************************************
548  */
550 
551 /**
552  ****************************************************************************************
553  * @brief overflow_callback
554  *
555  * @param[in] p_rtc: Pointer to a RTC handle which contains the configuration
556  * information for the specified RTC module.
557  ****************************************************************************************
558  */
560 
561 /**
562  ****************************************************************************************
563  * @brief tick_callback
564  *
565  * @param[in] p_rtc: Pointer to a RTC handle which contains the configuration
566  * information for the specified RTC module.
567  ****************************************************************************************
568  */
570 
571 /** @} */
572 
573 /** @} */
574 
575 #ifdef __cplusplus
576 }
577 #endif
578 
579 #endif
580 
581 /** @} */
582 
583 /** @} */
584 
585 /** @} */
hal_rtc_restart_tick
hal_status_t hal_rtc_restart_tick(rtc_handle_t *p_rtc)
Restart tick module and continue run with the previous settings. This function need be called after h...
_rtc_handle_t::init
rtc_init_t init
Definition: gr533x_hal_rtc.h:287
hal_lock_t
hal_lock_t
HAL Lock structures definition.
Definition: gr533x_hal_def.h:81
hal_rtc_deinit
hal_status_t hal_rtc_deinit(rtc_handle_t *p_rtc)
DeInitialize the RTC according to the specified parameters in the rtc_init_t of associated handle....
hal_rtc_get_cur_count
uint32_t hal_rtc_get_cur_count(rtc_handle_t *p_rtc)
Get_cur_count_value.
_alarm_handle_t::state
__IO rtc_alarm_state_t state
Definition: gr533x_hal_rtc.h:275
hal_rtc_alarm_callback
void hal_rtc_alarm_callback(rtc_handle_t *p_rtc)
alarm_callback
_rtc_init_t::prescaler_div
uint32_t prescaler_div
Definition: gr533x_hal_rtc.h:249
HAL_RTC_RUNNING
@ HAL_RTC_RUNNING
Definition: gr533x_hal_rtc.h:201
_rtc_init_t
rtc init params
Definition: gr533x_hal_rtc.h:245
hal_rtc_tick_callback
void hal_rtc_tick_callback(rtc_handle_t *p_rtc)
tick_callback
HAL_RTC_RESET
@ HAL_RTC_RESET
Definition: gr533x_hal_rtc.h:200
_tick_handle_t::state
__IO rtc_tick_state_t state
Definition: gr533x_hal_rtc.h:264
HAL_RTC_ERROR
@ HAL_RTC_ERROR
Definition: gr533x_hal_rtc.h:202
_rtc_handle_t::lock
hal_lock_t lock
Definition: gr533x_hal_rtc.h:293
hal_rtc_get_state
hal_rtc_state_t hal_rtc_get_state(rtc_handle_t *p_rtc)
Get_cur_rtc_state.
_alarm_handle_t::value
uint32_t value
Definition: gr533x_hal_rtc.h:273
tick_handle_t
struct _tick_handle_t tick_handle_t
tick handle params
_rtc_init_t::overflow_det_state
overflow_det_t overflow_det_state
Definition: gr533x_hal_rtc.h:251
hal_rtc_stop_alarm
hal_status_t hal_rtc_stop_alarm(rtc_handle_t *p_rtc)
Stop counting up and compare with alarm_value for alarm module.
ALARM_READY
@ ALARM_READY
Definition: gr533x_hal_rtc.h:220
hal_rtc_state_t
hal_rtc_state_t
hal_rtc_state definition
Definition: gr533x_hal_rtc.h:198
_hal_rtc_callback
HAL_RTC Callback function definition.
Definition: gr533x_hal_rtc.h:316
_alarm_handle_t
alarm handle params
Definition: gr533x_hal_rtc.h:272
HAL_RTC_READY
@ HAL_RTC_READY
Definition: gr533x_hal_rtc.h:199
hal_rtc_irq_handler
void hal_rtc_irq_handler(rtc_handle_t *p_rtc)
RTC_IRQHandler.
_rtc_handle_t
rtc handle definition
Definition: gr533x_hal_rtc.h:284
_rtc_handle_t::alarm
alarm_handle_t alarm
Definition: gr533x_hal_rtc.h:291
OPENED
@ OPENED
Definition: gr533x_hal_rtc.h:231
hal_rtc_get_cur_tick
uint32_t hal_rtc_get_cur_tick(rtc_handle_t *p_rtc)
Get_cur_tick_value.
_tick_handle_t
tick handle params
Definition: gr533x_hal_rtc.h:259
rtc_handle_t
struct _rtc_handle_t rtc_handle_t
rtc handle definition
hal_rtc_stop_tick
hal_status_t hal_rtc_stop_tick(rtc_handle_t *p_rtc)
Stop counting down for tick module.
_hal_rtc_callback::rtc_tick_callback
void(* rtc_tick_callback)(rtc_handle_t *p_rtc)
Definition: gr533x_hal_rtc.h:318
_hal_rtc_callback::rtc_alarm_callback
void(* rtc_alarm_callback)(rtc_handle_t *p_rtc)
Definition: gr533x_hal_rtc.h:317
rtc_alarm_state_t
rtc_alarm_state_t
rtc_alarm_state definition
Definition: gr533x_hal_rtc.h:219
ALARM_RUNNING
@ ALARM_RUNNING
Definition: gr533x_hal_rtc.h:221
_rtc_handle_t::state
__IO hal_rtc_state_t state
Definition: gr533x_hal_rtc.h:295
_rtc_handle_t::tick
tick_handle_t tick
Definition: gr533x_hal_rtc.h:289
hal_rtc_clear_wrap
hal_status_t hal_rtc_clear_wrap(rtc_handle_t *p_rtc)
Clear wrap count.
gr533x_ll_rtc.h
Header file containing functions prototypes of RTC LL library.
TICK_READY
@ TICK_READY
Definition: gr533x_hal_rtc.h:210
hal_rtc_get_alarm_value
uint32_t hal_rtc_get_alarm_value(rtc_handle_t *p_rtc)
Get_alarm_value.
hal_rtc_get_wrap_count
uint32_t hal_rtc_get_wrap_count(rtc_handle_t *p_rtc)
Get the times of overflow.
CLOSED
@ CLOSED
Definition: gr533x_hal_rtc.h:230
hal_rtc_set_alarm
hal_status_t hal_rtc_set_alarm(rtc_handle_t *p_rtc, uint32_t value)
Compare counter with alarm_value for alarm module.
TICK_ERROR
@ TICK_ERROR
Definition: gr533x_hal_rtc.h:212
TICK_RUNNING
@ TICK_RUNNING
Definition: gr533x_hal_rtc.h:211
alarm_handle_t
struct _alarm_handle_t alarm_handle_t
alarm handle params
_rtc_handle_t::error_code
__IO uint32_t error_code
Definition: gr533x_hal_rtc.h:297
_tick_handle_t::mode
uint8_t mode
Definition: gr533x_hal_rtc.h:260
_hal_rtc_callback::rtc_overflow_callback
void(* rtc_overflow_callback)(rtc_handle_t *p_rtc)
Definition: gr533x_hal_rtc.h:319
hal_status_t
hal_status_t
HAL Status structures definition.
Definition: gr533x_hal_def.h:70
overflow_det_t
overflow_det_t
overflow config
Definition: gr533x_hal_rtc.h:229
hal_rtc_callback_t
struct _hal_rtc_callback hal_rtc_callback_t
HAL_RTC Callback function definition.
hal_rtc_init
hal_status_t hal_rtc_init(rtc_handle_t *p_rtc)
Initialize the RTC according to the specified parameters in the rtc_init_t of associated handle....
_tick_handle_t::value
uint32_t value
Definition: gr533x_hal_rtc.h:262
rtc_init_t
struct _rtc_init_t rtc_init_t
rtc init params
hal_rtc_set_tick_and_start
hal_status_t hal_rtc_set_tick_and_start(rtc_handle_t *p_rtc, uint8_t mode, uint32_t value)
Start counting down for tick module.
ALARM_ERROR
@ ALARM_ERROR
Definition: gr533x_hal_rtc.h:222
rtc_tick_state_t
rtc_tick_state_t
rtc_tick_state definition
Definition: gr533x_hal_rtc.h:209
hal_rtc_overflow_callback
void hal_rtc_overflow_callback(rtc_handle_t *p_rtc)
overflow_callback
gr533x_hal_def.h
This file contains HAL common definitions, enumeration, macros and structures definitions.
_rtc_init_t::start_value
uint32_t start_value
Definition: gr533x_hal_rtc.h:247
_rtc_handle_t::p_instance
rtc_regs_t * p_instance
Definition: gr533x_hal_rtc.h:285