hal_rtc.h
Go to the documentation of this file.
1 /**
2  ****************************************************************************************
3  *
4  * @file 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 HAL_RTC_H
52 #define HAL_RTC_H
53 
54 #ifdef __cplusplus
55 extern "C" {
56 #endif
57 
58 /* Includes ------------------------------------------------------------------*/
59 #include "ll_rtc.h"
60 #include "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, 0xFFFFFFFFU, 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 Wrap 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 Wrap 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 Wrap 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 Wrap 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
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 
253 }rtc_init_t;
254 
255 /**
256  * @brief tick handle params
257  */
258 typedef struct
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  __IO hal_rtc_state_t state; /*!< Time communication state */
294 
295  __IO uint32_t error_code; /**< RTC Error code */
296 
298 
299 /** @} */
300 
301 /** @addtogroup HAL_RTC_CALLBACK_STRUCTURES Callback Structures
302  * @{
303  */
304 
305 /** @defgroup RTC_Callback RTC Callback
306  * @{
307  */
308 
309 /**
310  * @brief HAL_RTC Callback function definition
311  */
312 
313 typedef struct _hal_rtc_callback
314 {
315  void (*rtc_alarm_callback)(rtc_handle_t *p_rtc); /**< RTC alarm count complete callback */
316  void (*rtc_tick_callback)(rtc_handle_t *p_rtc); /**< RTC tick count complete callback */
317  void (*rtc_overflow_callback)(rtc_handle_t *p_rtc); /**< RTC overflow callback */
319 
320 /** @} */
321 
322 /** @} */
323 
324 /* Exported functions --------------------------------------------------------*/
325 /** @addtogroup HAL_RTC_DRIVER_FUNCTIONS Functions
326  * @{
327  */
328 
329 /** @addtogroup RTC_Exported_Functions_Group1 Initialization and de-initialization Functions
330  * @brief Initialization and Configuration functions
331  * @{
332  */
333 
334 /**
335  ****************************************************************************************
336  * @brief Initialize the RTC according to the specified parameters in the
337  * rtc_init_t of associated handle.counter start after hal_rtc_init.
338  *
339  * @param[in] p_rtc: Pointer to a RTC handle which contains the configuration
340  * information for the specified RTC module.
341  *
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  */
349 
350 /**
351  ****************************************************************************************
352  * @brief DeInitialize the RTC according to the specified parameters in the
353  * rtc_init_t of associated handle.counter stop after hal_rtc_deinit.
354  *
355  * @param[in] p_rtc: Pointer to a RTC handle which contains the configuration
356  * information for the specified RTC module.
357  *
358  * @retval ::HAL_OK: Operation is OK.
359  * @retval ::HAL_ERROR: Parameter error or operation not supported.
360  * @retval ::HAL_BUSY: Driver is busy.
361  * @retval ::HAL_TIMEOUT: Timeout occurred.
362  ****************************************************************************************
363  */
365 
366 /**
367  ****************************************************************************************
368  * @brief Start counting down for tick module
369  *
370  * @param[in] p_rtc: Pointer to a RTC handle which contains the configuration
371  * information for the specified RTC module.
372  * @param[in] mode: ONE_TIME/AUTO_RELOAD
373  * @param[in] value: the tick start which start counting down
374  *
375  * @retval ::HAL_OK: Operation is OK.
376  * @retval ::HAL_ERROR: Parameter error or operation not supported.
377  * @retval ::HAL_BUSY: Driver is busy.
378  * @retval ::HAL_TIMEOUT: Timeout occurred.
379  ****************************************************************************************
380  */
381 hal_status_t hal_rtc_set_tick_and_start(rtc_handle_t *p_rtc, uint8_t mode,uint32_t value);
382 
383 /**
384  ****************************************************************************************
385  * @brief Stop counting down for tick module
386  *
387  * @param[in] p_rtc: Pointer to a RTC handle which contains the configuration
388  * information for the specified RTC module.
389  *
390  * @retval ::HAL_OK: Operation is OK.
391  * @retval ::HAL_ERROR: Parameter error or operation not supported.
392  * @retval ::HAL_BUSY: Driver is busy.
393  * @retval ::HAL_TIMEOUT: Timeout occurred.
394  ****************************************************************************************
395  */
397 
398 /**
399  ****************************************************************************************
400  * @brief Restart tick module and continue run with the previous settings.
401  * This function need be called after hal_rtc_stop_tick
402  *
403  * @param[in] p_rtc: Pointer to a RTC handle which contains the configuration
404  * information for the specified RTC module.
405  *
406  * @retval ::HAL_OK: Operation is OK.
407  * @retval ::HAL_ERROR: Parameter error or operation not supported.
408  * @retval ::HAL_BUSY: Driver is busy.
409  * @retval ::HAL_TIMEOUT: Timeout occurred.
410  ****************************************************************************************
411  */
413 /**
414  ****************************************************************************************
415  * @brief Compare counter with alarm_value for alarm module
416  *
417  * @param[in] p_rtc: Pointer to a RTC handle which contains the configuration
418  * information for the specified RTC module.
419  * @param[in] value: set alarm_value
420  *
421  * @retval ::HAL_OK: Operation is OK.
422  * @retval ::HAL_ERROR: Parameter error or operation not supported.
423  * @retval ::HAL_BUSY: Driver is busy.
424  * @retval ::HAL_TIMEOUT: Timeout occurred.
425  ****************************************************************************************
426  */
428 
429 /**
430  ****************************************************************************************
431  * @brief Stop counting up and compare with alarm_value for alarm module
432  *
433  * @param[in] p_rtc: Pointer to a RTC handle which contains the configuration
434  * information for the specified RTC module.
435  *
436  * @retval ::HAL_OK: Operation is OK.
437  * @retval ::HAL_ERROR: Parameter error or operation not supported.
438  * @retval ::HAL_BUSY: Driver is busy.
439  * @retval ::HAL_TIMEOUT: Timeout occurred.
440  ****************************************************************************************
441  */
443 
444 /**
445  ****************************************************************************************
446  * @brief Clear wrap count
447  *
448  * @param[in] p_rtc: Pointer to a RTC handle which contains the configuration
449  * information for the specified RTC module.
450  *
451  * @retval ::HAL_OK: Operation is OK.
452  * @retval ::HAL_ERROR: Parameter error or operation not supported.
453  * @retval ::HAL_BUSY: Driver is busy.
454  * @retval ::HAL_TIMEOUT: Timeout occurred.
455  ****************************************************************************************
456  */
458 
459 /**
460  ****************************************************************************************
461  * @brief Get the times of overflow
462  *
463  * @param[in] p_rtc: Pointer to a RTC handle which contains the configuration
464  * information for the specified RTC module.
465  *
466  * @retval ::uint32_t
467  ****************************************************************************************
468  */
469 uint32_t hal_rtc_get_wrap_count(const rtc_handle_t *p_rtc);
470 
471 /**
472  ****************************************************************************************
473  * @brief Get_cur_count_value
474  *
475  * @param[in] p_rtc: Pointer to a RTC handle which contains the configuration
476  * information for the specified RTC module.
477  *
478  * @retval ::uint32_t
479  ****************************************************************************************
480  */
481 uint32_t hal_rtc_get_cur_count(const rtc_handle_t* p_rtc);
482 
483 /**
484  ****************************************************************************************
485  * @brief Get_cur_tick_value
486  *
487  * @param[in] p_rtc: Pointer to a RTC handle which contains the configuration
488  * information for the specified RTC module.
489  *
490  * @retval ::uint32_t
491  ****************************************************************************************
492  */
493 uint32_t hal_rtc_get_cur_tick(const rtc_handle_t* p_rtc);
494 
495 /**
496  ****************************************************************************************
497  * @brief Get_alarm_value
498  *
499  * @param[in] p_rtc: Pointer to a RTC handle which contains the configuration
500  * information for the specified RTC module.
501  *
502  * @retval ::uint32_t
503  ****************************************************************************************
504  */
505 uint32_t hal_rtc_get_alarm_value(const rtc_handle_t *p_rtc);
506 
507 /**
508  ****************************************************************************************
509  * @brief Get_cur_rtc_state
510  *
511  * @param[in] p_rtc: Pointer to a RTC handle which contains the configuration
512  * information for the specified RTC module.
513  *
514  * @retval ::HAL_OK: Operation is OK.
515  * @retval ::HAL_ERROR: Parameter error or operation not supported.
516  * @retval ::HAL_BUSY: Driver is busy.
517  * @retval ::HAL_TIMEOUT: Timeout occurred.
518  ****************************************************************************************
519  */
521 
522 /** @} */
523 
524 /** @addtogroup RTC_IRQ_Handler_and_Callbacks IRQ Handler and Callbacks
525  * @brief IRQ Handler and Callbacks functions
526  * @{
527  */
528 
529 /**
530  ****************************************************************************************
531  * @brief RTC_IRQHandler
532  *
533  * @param[in] p_rtc: Pointer to a RTC handle which contains the configuration
534  * information for the specified RTC module.
535  ****************************************************************************************
536  */
538 
539 /**
540  ****************************************************************************************
541  * @brief alarm_callback
542  *
543  * @param[in] p_rtc: Pointer to a RTC handle which contains the configuration
544  * information for the specified RTC module.
545  ****************************************************************************************
546  */
548 
549 /**
550  ****************************************************************************************
551  * @brief overflow_callback
552  *
553  * @param[in] p_rtc: Pointer to a RTC handle which contains the configuration
554  * information for the specified RTC module.
555  ****************************************************************************************
556  */
558 
559 /**
560  ****************************************************************************************
561  * @brief tick_callback
562  *
563  * @param[in] p_rtc: Pointer to a RTC handle which contains the configuration
564  * information for the specified RTC module.
565  ****************************************************************************************
566  */
568 
569 /** @} */
570 
571 /** @} */
572 
573 #ifdef __cplusplus
574 }
575 #endif
576 
577 #endif
578 
579 /** @} */
580 
581 /** @} */
582 
583 /** @} */
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: hal_rtc.h:287
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....
_alarm_handle_t::state
__IO rtc_alarm_state_t state
Definition: hal_rtc.h:275
tick_handle_t::mode
uint8_t mode
Definition: hal_rtc.h:260
hal_rtc_alarm_callback
void hal_rtc_alarm_callback(rtc_handle_t *p_rtc)
alarm_callback
rtc_init_t
rtc init params
Definition: hal_rtc.h:245
HAL_RTC_RUNNING
@ HAL_RTC_RUNNING
Definition: hal_rtc.h:201
hal_rtc_tick_callback
void hal_rtc_tick_callback(rtc_handle_t *p_rtc)
tick_callback
HAL_RTC_RESET
@ HAL_RTC_RESET
Definition: hal_rtc.h:200
tick_handle_t::state
__IO rtc_tick_state_t state
Definition: hal_rtc.h:264
HAL_RTC_ERROR
@ HAL_RTC_ERROR
Definition: hal_rtc.h:202
_alarm_handle_t::value
uint32_t value
Definition: hal_rtc.h:273
tick_handle_t
tick handle params
Definition: hal_rtc.h:259
hal_rtc_get_state
hal_rtc_state_t hal_rtc_get_state(const rtc_handle_t *p_rtc)
Get_cur_rtc_state.
hal_rtc_get_wrap_count
uint32_t hal_rtc_get_wrap_count(const rtc_handle_t *p_rtc)
Get the times of overflow.
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: hal_rtc.h:220
hal_rtc_get_cur_tick
uint32_t hal_rtc_get_cur_tick(const rtc_handle_t *p_rtc)
Get_cur_tick_value.
hal_rtc_state_t
hal_rtc_state_t
hal_rtc_state definition
Definition: hal_rtc.h:198
_hal_rtc_callback
HAL_RTC Callback function definition.
Definition: hal_rtc.h:314
_alarm_handle_t
alarm handle params
Definition: hal_rtc.h:272
HAL_RTC_READY
@ HAL_RTC_READY
Definition: 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: hal_rtc.h:284
_rtc_handle_t::alarm
alarm_handle_t alarm
Definition: hal_rtc.h:291
OPENED
@ OPENED
Definition: hal_rtc.h:231
ll_rtc.h
Header file containing functions prototypes of RTC LL library.
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: hal_rtc.h:316
_hal_rtc_callback::rtc_alarm_callback
void(* rtc_alarm_callback)(rtc_handle_t *p_rtc)
Definition: hal_rtc.h:315
rtc_alarm_state_t
rtc_alarm_state_t
rtc_alarm_state definition
Definition: hal_rtc.h:219
ALARM_RUNNING
@ ALARM_RUNNING
Definition: hal_rtc.h:221
_rtc_handle_t::state
__IO hal_rtc_state_t state
Definition: hal_rtc.h:293
_rtc_handle_t::tick
tick_handle_t tick
Definition: hal_rtc.h:289
hal_rtc_clear_wrap
hal_status_t hal_rtc_clear_wrap(rtc_handle_t *p_rtc)
Clear wrap count.
TICK_READY
@ TICK_READY
Definition: hal_rtc.h:210
CLOSED
@ CLOSED
Definition: 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: hal_rtc.h:212
TICK_RUNNING
@ TICK_RUNNING
Definition: 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: hal_rtc.h:295
hal_status_t
hal_status_t
HAL Status structures definition.
Definition: gr_common.h:140
hal_def.h
This file contains HAL common definitions, enumeration, macros and structures definitions.
rtc_init_t::overflow_det_state
overflow_det_t overflow_det_state
Definition: hal_rtc.h:251
_hal_rtc_callback::rtc_overflow_callback
void(* rtc_overflow_callback)(rtc_handle_t *p_rtc)
Definition: hal_rtc.h:317
overflow_det_t
overflow_det_t
overflow config
Definition: hal_rtc.h:229
rtc_init_t::prescaler_div
uint32_t prescaler_div
Definition: hal_rtc.h:249
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....
rtc_init_t::start_value
uint32_t start_value
Definition: hal_rtc.h:247
hal_rtc_get_alarm_value
uint32_t hal_rtc_get_alarm_value(const rtc_handle_t *p_rtc)
Get_alarm_value.
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: hal_rtc.h:222
rtc_tick_state_t
rtc_tick_state_t
rtc_tick_state definition
Definition: hal_rtc.h:209
hal_rtc_overflow_callback
void hal_rtc_overflow_callback(rtc_handle_t *p_rtc)
overflow_callback
hal_rtc_get_cur_count
uint32_t hal_rtc_get_cur_count(const rtc_handle_t *p_rtc)
Get_cur_count_value.
_rtc_handle_t::p_instance
rtc_regs_t * p_instance
Definition: hal_rtc.h:285
tick_handle_t::value
uint32_t value
Definition: hal_rtc.h:262