gr55xx_hal_calendar.h
Go to the documentation of this file.
1 /**
2  ****************************************************************************************
3  *
4  * @file gr55xx_hal_calendar.h
5  * @author BLE Driver Team
6  * @brief Header file containing functions prototypes of CALENDAR 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_CALENDAR CALENDAR
47  * @brief CALENDAR HAL module driver.
48  * @{
49  */
50 
51 /* Define to prevent recursive inclusion -------------------------------------*/
52 #ifndef __GR55xx_HAL_CALENDAR_H__
53 #define __GR55xx_HAL_CALENDAR_H__
54 
55 #ifdef __cplusplus
56 extern "C" {
57 #endif
58 
59 /* Includes ------------------------------------------------------------------*/
60 #include "gr55xx_ll_calendar.h"
61 #include "gr55xx_hal_def.h"
62 
63 /* Exported types ------------------------------------------------------------*/
64 /** @addtogroup HAL_CALENDAR_STRUCTURES Structures
65  * @{
66  */
67 
68 /** @defgroup CALENDAR_Time CALENDAR Time
69  * @{
70  */
71 
72 /**
73  * @brief CALENDAR_Time calendar time structure definition
74  */
75 typedef struct _calendar_time
76 {
77  uint8_t sec; /**< Specifies the Calendar time seconds.
78  This parameter must be a number between min_value = 0 and max_value = 59. */
79 
80  uint8_t min; /**< Specifies the Calendar time minutes.
81  This parameter must be a number between min_value = 0 and max_value = 59. */
82 
83  uint8_t hour; /**< Specifies the Calendar time hour.
84  This parameter must be a number between min_value = 0 and max_value = 23. */
85 
86  uint8_t date; /**< Specifies the Calendar date.
87  This parameter must be a number between min_value = 1 and max_value = 31. */
88 
89  uint8_t mon; /**< Specifies the Calendar month.
90  This parameter must be a number between min_value = 1 and max_value = 12. */
91 
92  uint8_t year; /**< Specifies the Calendar year which stars from 2010.
93  This parameter must be a number between min_value = 0 and max_value = 99. */
94 
95  uint8_t week; /**< Specifies the Calendar weekday.
96  This parameter must be a number between min_value = 0 and max_value = 6. */
97 
98  uint16_t ms; /**< Specifies the Calendar time milliseconds.
99  This parameter must be a number between min_value = 0 and max_value = 999. */
101 
102 /**
103  * @brief CALENDAR_Alarm calendar alarm structure definition
104  */
105 typedef struct _calendar_alarm
106 {
107  uint8_t min; /**< Specifies the alarm time minutes.
108  This parameter must be a number between min_value = 0 and max_value = 59. */
109 
110  uint8_t hour; /**< Specifies the alarm time hour.
111  This parameter must be a number between min_value = 0 and max_value = 23. */
112 
113  uint8_t alarm_sel; /**< Specifies the alarm is on date or weekday.
114  This parameter can be a value of @ref CALENDAR_ALARM_SEL. */
115 
116  uint8_t alarm_date_week_mask; /**< Specifies the alarm date/weekday.
117  If the alarm date is selected, this parameter must be set to a value in the 1 ~ 31 range.
118  If the alarm weekday is selected, this parameter must be a value of @ref CALENDAR_ALARM_WEEKDAY. */
119 
121 
122 /** @} */
123 
124 /** @defgroup CALENDAR_handle CALENDAR handle
125  * @{
126  */
127 
128 /**
129  * @brief CALENDAR handle Structure definition
130  */
131 typedef struct _calendar_handle
132 {
133  uint32_t utc; /**< The current UTC time of the system. */
134 
135  uint32_t pre_count; /**< The last register count value of the system. */
136 
137  calendar_alarm_t alarm; /**< Specifies the Calendar date alarm. */
138 
139  hal_lock_t lock; /**< Specifies the Calendar locking object. */
140 
141  uint32_t interval; /**< Specifies the Calendar milliseconds alarm. */
142 
143  uint8_t mode; /**< Specifies the Calendar alarm mode. */
144 
145  uint32_t clock_freq; /**< CALENDAR clock frequce. Uinit: Hz. */
147 
148 /** @} */
149 
150 /** @} */
151 
152 /** @addtogroup HAL_CALENDAR_CALLBACK_STRUCTURES Callback Structures
153  * @{
154  */
155 
156 /** @defgroup CALENDAR_Callback CALENDAR Callback
157  * @{
158  */
159 
160 /**
161  * @brief HAL_CALENDAR Callback function definition
162  */
163 typedef struct _calendar_callback
164 {
165  void (*calendar_alarm_callback)(calendar_handle_t *p_calendar); /**< CALENDAR date count complete callback */
166  void (*calendar_tick_callback)(calendar_handle_t *p_calendar); /**< CALENDAR tick count complete callback */
167  void (*calendar_overflow_callback)(calendar_handle_t *p_calendar); /**< CALENDAR overflow callback */
169 
170 /** @} */
171 
172 /** @} */
173 
174 /**
175  * @defgroup HAL_CALENDAR_MACRO Defines
176  * @{
177  */
178 
179 /* Exported constants --------------------------------------------------------*/
180 /** @defgroup CALENDAR_Exported_Constants CALENDAR Exported Constants
181  * @{
182  */
183 
184 /** @defgroup CALENDAR_Interrupts CALENDAR Interrupts
185  * @{
186  */
187 #define CALENDAR_IT_ALARM RTC_INT_EN_ALARM /**< Alarm interrupt */
188 #define CALENDAR_IT_WARP RTC_INT_EN_WRAP /**< Warp interrupt */
189 #define CALENDAR_IT_TICK RTC_INT_EN_TICK /**< Tick interrupt */
190 /** @} */
191 
192 /** @defgroup CALENDAR_Flags CALENDAR Flags
193  * @{
194  */
195 #define CALENDAR_FLAG_ALARM RTC_INT_STAT_ALARM /**< Alarm interrupt flag */
196 #define CALENDAR_FLAG_WARP RTC_INT_STAT_WRAP /**< Warp interrupt flag */
197 #define CALENDAR_FLAG_TICK RTC_INT_STAT_TICK /**< Tick interrupt flag */
198 /** @} */
199 
200 /** @defgroup CALENDAR_ALARM_SEL CALENDAR Alarm type select
201  * @{
202  */
203 #define CALENDAR_ALARM_SEL_DATE (0UL) /**< Alarm in date */
204 #define CALENDAR_ALARM_SEL_WEEKDAY (1UL) /**< Alarm in weekday */
205 /** @} */
206 
207 /** @defgroup CALENDAR_ALARM_WEEKDAY CALENDAR Alarm weekday
208  * @{
209  */
210 #define CALENDAR_ALARM_WEEKDAY_SUN (0x01ul) /**< Alarm weekday mask Sunday */
211 #define CALENDAR_ALARM_WEEKDAY_MON (0x02ul) /**< Alarm weekday mask Monday */
212 #define CALENDAR_ALARM_WEEKDAY_TUE (0x04ul) /**< Alarm weekday mask Tuesday */
213 #define CALENDAR_ALARM_WEEKDAY_WED (0x08ul) /**< Alarm weekday mask Wednesday */
214 #define CALENDAR_ALARM_WEEKDAY_THU (0x10ul) /**< Alarm weekday mask Thursday */
215 #define CALENDAR_ALARM_WEEKDAY_FRI (0x20ul) /**< Alarm weekday mask Friday */
216 #define CALENDAR_ALARM_WEEKDAY_SAT (0x40ul) /**< Alarm weekday mask Saturday */
217 /** @} */
218 
219 /** @defgroup CALENDAR_ALARM_DISABLE CALENDAR Alarm mdoe
220  * @{
221  */
222 #define CALENDAR_ALARM_DISABLE_DATE (1UL) /**< Disable date alarm */
223 #define CALENDAR_ALARM_DISABLE_TICK (2UL) /**< Disable tick 0 alarm */
224 #define CALENDAR_ALARM_DISABLE_ALL (CALENDAR_ALARM_DISABLE_DATE | CALENDAR_ALARM_DISABLE_TICK) /**< Disable all alarm */
225 /** @} */
226 
227 /** @defgroup CALENDAR_ALARM_DISABLE CALENDAR Alarm mdoe
228  * @{
229  */
230 #define CALENDAR_TICK_SINGLE LL_CLDR_TIMER_TICK_TYPE_SINGLE /**< Alarm tick reload single */
231 #define CALENDAR_TICK_AUTO LL_CLDR_TIMER_TICK_TYPE_AUTO /**< Alarm tick reload auto */
232 
233 /** @} */
234 
235 /** @} */
236 
237 /* Exported macro ------------------------------------------------------------*/
238 /** @defgroup CALENDAR_Exported_Macros CALENDAR Exported Macros
239  * @{
240  */
241 
242 /** @brief Enable the specified CALENDAR peripheral.
243  * @retval None
244  */
245 #define __HAL_CALENDAR_ENABLE() WRITE_REG(CALENDAR->CFG0, RTC_CFG0_CFG | RTC_CFG0_EN)
246 
247 /** @brief Disable the specified CALENDAR peripheral.
248  * @retval None
249  */
250 #define __HAL_CALENDAR_DISABLE() MODIFY_REG(CALENDAR->CFG0, 0xFFFFFFFF, RTC_CFG0_CFG);
251 
252 /** @brief Enable the specified CALENDAR interrupts.
253  * @param __INTERRUPT__ Specifies the interrupt source to enable.
254  * This parameter can be one of the following values:
255  * @arg @ref CALENDAR_IT_ALARM Alarm Interrupt
256  * @arg @ref CALENDAR_IT_WARP Warp Interrupt
257  * @arg @ref CALENDAR_IT_TICK Tick 0 Interrupt
258  * @arg @ref CALENDAR_IT_TICK TICK 1 Interrupt
259  * @retval None
260  */
261 #define __HAL_CALENDAR_ENABLE_IT(__INTERRUPT__) SET_BITS(CALENDAR->INT_EN, (__INTERRUPT__))
262 
263 /** @brief Disable the specified CALENDAR interrupts.
264  * @param __INTERRUPT__ Specifies the interrupt source to disable.
265  * This parameter can be one of the following values:
266  * @arg @ref CALENDAR_IT_ALARM Alarm Interrupt
267  * @arg @ref CALENDAR_IT_WARP Warp Interrupt
268  * @arg @ref CALENDAR_IT_TICK Tick 0 Interrupt
269  * @arg @ref CALENDAR_IT_TICK Tick 1 Interrupt
270  * @retval None
271  */
272 #define __HAL_CALENDAR_DISABLE_IT(__INTERRUPT__) CLEAR_BITS(CALENDAR->INT_EN, (__INTERRUPT__))
273 
274 /** @brief Check whether the specified CALENDAR interrupt flag is set or not.
275  * @param __FLAG__ Specifies the interrupt source to check.
276  * This parameter can be one of the following values:
277  * @arg @ref CALENDAR_FLAG_ALARM Alarm Interrupt event
278  * @arg @ref CALENDAR_FLAG_WARP Warp Interrupt event
279  * @arg @ref CALENDAR_FLAG_TICK Tick 0 Interrupt event
280  * @arg @ref CALENDAR_FLAG_TICK Tick 1 Interrupt event
281  * @retval The new state of __IT__ (TRUE or FALSE).
282  */
283 #define __HAL_CALENDAR_GET_IT_SOURCE(__FLAG__) (READ_BITS(CALENDAR->INT_STAT, (__FLAG__)) == (__FLAG__))
284 
285 /** @brief Clear the specified CALENDAR flag.
286  * @param __FLAG__ Specifies the flag to clear.
287  * This parameter can be one of the following values:
288  * @arg @ref CALENDAR_FLAG_ALARM Alarm Interrupt event
289  * @arg @ref CALENDAR_FLAG_WARP Warp Interrupt event
290  * @arg @ref CALENDAR_FLAG_TICK Tick 0 Interrupt event
291  * @arg @ref CALENDAR_FLAG_TICK Tick 1 Interrupt event
292  * @retval None
293  */
294 #define __HAL_CALENDAR_CLEAR_FLAG(__FLAG__) WRITE_REG(CALENDAR->INT_STAT, (__FLAG__))
295 
296 /** @brief Get the CALENDAR busy flag.
297  * @retval The new state of __BUSY__ (TRUE or FALSE).
298  */
299 #define __HAL_CALENDAR_BUSY_FLAG() ((READ_BITS(CALENDAR->STAT, RTC_STAT_BUSY) == RTC_STAT_BUSY))
300 
301 /** @} */
302 
303 /* Private macros ------------------------------------------------------------*/
304 /** @defgroup CALENDAR_Private_Macro CALENDAR Private Macros
305  * @{
306  */
307 
308 /** @brief Check if CALENDAR Alarm Type is valid.
309  * @param __TYPE__ CALENDAR Alarm Type.
310  * @retval SET (__TYPE__ is valid) or RESET (__TYPE__ is invalid)
311  */
312 #define IS_CALENDAR_ALARM_TYPE(__TYPE__) (((__TYPE__) == CALENDAR_ALARM_SEL_DATE) || \
313  ((__TYPE__) == CALENDAR_ALARM_SEL_WEEKDAY))
314 
315 /** @brief Check if CALENDAR Date is valid.
316  * @param __DATE__ CALENDAR Date.
317  * @retval SET (__DATE__ is valid) or RESET (__DATE__ is invalid)
318  */
319 #define IS_CALENDAR_DATE(__DATE__) (((__DATE__) > 0) && ((__DATE__) <= 31))
320 
321 /** @brief Check if CALENDAR Weekday is valid.
322  * @param __WEEKDAY__ CALENDAR Weekday.
323  * @retval SET (__WEEKDAY__ is valid) or RESET (__WEEKDAY__ is invalid)
324  */
325 #define IS_CALENDAR_WEEKDAY(__WEEKDAY__) (((__WEEKDAY__) >= 0) && ((__WEEKDAY__) <= 6))
326 
327 /** @brief Check if CALENDAR year is leap year.
328  * @param __YEAR__ CALENDAR Year.
329  * @retval SET (__YEAR__ is leap year) or RESET (__YEAR__ is nonleap year)
330  */
331 #define IS_CALENDAR_LEAP_YEAR(__YEAR__) ((((__YEAR__) % 4) == 0 && ((__YEAR__) % 100) != 0) || \
332  ((__YEAR__) % 400) == 0)
333 
334 /** @} */
335 
336 /** @} */
337 
338 /* Exported functions --------------------------------------------------------*/
339 /** @addtogroup HAL_CALENDAR_DRIVER_FUNCTIONS Functions
340  * @{
341  */
342 
343 /** @addtogroup CALENDAR_Exported_Functions_Group1 Initialization and de-initialization functions
344  * @brief Initialization and Configuration functions.
345  *
346 @verbatim
347  ==============================================================================
348  ##### Initialization and Configuration functions #####
349  ==============================================================================
350  [..]
351  This section provides functions allowing to:
352  (+) Initialize and start the CALENDAR according to the specified parameters
353  in the cslendar_init_t of associated handle.
354  (+) Initialize the CALENDAR MSP.
355 
356 @endverbatim
357  * @{
358  */
359 
360 /**
361  ****************************************************************************************
362  * @brief Initialize the CALENDAR according to the specified parameters in the
363  * calendar_init_t of associated handle.
364  *
365  * @param[in] p_calendar: Pointer to a CALENDAR handle which contains the configuration
366  * information for the specified CALENDAR module.
367  *
368  * @retval ::HAL_OK: Operation is OK.
369  * @retval ::HAL_ERROR: Parameter error or operation not supported.
370  * @retval ::HAL_BUSY: Driver is busy.
371  * @retval ::HAL_TIMEOUT: Timeout occurred.
372  ****************************************************************************************
373  */
375 
376 /**
377  ****************************************************************************************
378  * @brief De-initialize the CALENDAR peripheral.
379  *
380  * @param[in] p_calendar: CALENDAR handle.
381  *
382  * @retval ::HAL_OK: Operation is OK.
383  * @retval ::HAL_ERROR: Parameter error or operation not supported.
384  * @retval ::HAL_BUSY: Driver is busy.
385  * @retval ::HAL_TIMEOUT: Timeout occurred.
386  ****************************************************************************************
387  */
389 
390 /** @} */
391 
392 /** @addtogroup CALENDAR_Exported_Functions_Group2 IO operation functions
393  * @brief IO operation functions
394  *
395 @verbatim
396  ==============================================================================
397  ##### IO operation functions #####
398  ==============================================================================
399  [..]
400  This section provides functions allowing to:
401  (+) Init the CALENDAR time.
402  (+) Get the CALENDAR time.
403  (+) Set the CALENDAR alarm.
404  (+) Disable the CALENDAR alarm.
405  (+) Handle CALENDAR interrupt request and associated function callback.
406 
407 @endverbatim
408  * @{
409  */
410 
411 /**
412  ****************************************************************************************
413  * @brief Initialize the CALENDAR time.
414  *
415  * @param[in] p_calendar: Pointer to a CALENDAR handle which contains the configuration
416  * information for the specified CALENDAR module.
417  * @param[in] p_time: Pointer to a CALENDAR time struction.
418  *
419  * @retval ::HAL_OK: Operation is OK.
420  * @retval ::HAL_ERROR: Parameter error or operation not supported.
421  * @retval ::HAL_BUSY: Driver is busy.
422  * @retval ::HAL_TIMEOUT: Timeout occurred.
423  ****************************************************************************************
424  */
426 
427 /**
428  ****************************************************************************************
429  * @brief Get current CALENDAR time.
430  *
431  * @param[in] p_calendar: Pointer to a CALENDAR handle which contains the configuration
432  * information for the specified CALENDAR module.
433  * @param[in] p_time: Pointer to a CALENDAR time struction.
434  *
435  * @retval ::HAL_OK: Operation is OK.
436  * @retval ::HAL_ERROR: Parameter error or operation not supported.
437  * @retval ::HAL_BUSY: Driver is busy.
438  * @retval ::HAL_TIMEOUT: Timeout occurred.
439  ****************************************************************************************
440  */
442 
443 /**
444  ****************************************************************************************
445  * @brief Set a CALENDAR date alarm.
446  *
447  * @param[in] p_calendar: Pointer to a CALENDAR handle which contains the configuration
448  * information for the specified CALENDAR module.
449  * @param[in] p_alarm: After seconds will generate an date alarm interrupt.
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 Set a CALENDAR tick 0 alarm.
462  *
463  * @param[in] p_calendar: Pointer to a CALENDAR handle which contains the configuration
464  * information for the specified CALENDAR module.
465  * @param[in] interval: After milliseconds will generate an milliseconds alarm interrupt.
466  * The value of interval is greater than or equal to 0ms.
467  *
468  * @retval ::HAL_OK: Operation is OK.
469  * @retval ::HAL_ERROR: Parameter error or operation not supported.
470  * @retval ::HAL_BUSY: Driver is busy.
471  * @retval ::HAL_TIMEOUT: Timeout occurred.
472  ****************************************************************************************
473  */
474 hal_status_t hal_calendar_set_tick(calendar_handle_t *p_calendar, uint32_t interval);
475 
476 /**
477  ****************************************************************************************
478  * @brief Disable CALENDAR alarm event.
479  *
480  * @param[in] p_calendar: Pointer to a CALENDAR handle which contains the configuration
481  * information for the specified CALENDAR module.
482  * @param[in] disable_mode: Disable specified CALENDAR alarm mode.
483  * This parameter can be the following values:
484  * @arg @ref CALENDAR_ALARM_DISABLE_DATE
485  * @arg @ref CALENDAR_ALARM_DISABLE_TICK
486  * CALENDAR_ALARM_DISABLE_TICK_EXT
487  * @arg @ref CALENDAR_ALARM_DISABLE_ALL
488  *
489  * @retval ::HAL_OK: Operation is OK.
490  * @retval ::HAL_ERROR: Parameter error or operation not supported.
491  * @retval ::HAL_BUSY: Driver is busy.
492  * @retval ::HAL_TIMEOUT: Timeout occurred.
493  ****************************************************************************************
494  */
495 hal_status_t hal_calendar_disable_event(calendar_handle_t *p_calendar, uint32_t disable_mode);
496 
497 /**
498  ****************************************************************************************
499  * @brief Sync slow clock to calendar.
500  *
501  * @param[in] p_calendar: Pointer to a CALENDAR handle which contains the configuration
502  * information for the specified CALENDAR module.
503  * @param[in] SlowClockFreq: Number of slow clocks after calibration.
504  *
505  * @retval ::HAL_OK: Operation is OK.
506  * @retval ::HAL_ERROR: Parameter error or operation not supported.
507  * @retval ::HAL_BUSY: Driver is busy.
508  * @retval ::HAL_TIMEOUT: Timeout occurred.
509  ****************************************************************************************
510  */
511 hal_status_t hal_calendar_sync_time(calendar_handle_t *p_calendar, uint32_t SlowClockFreq);
512 /** @} */
513 
514 
515 /** @addtogroup CALENDAR_IRQ_Handler_and_Callbacks IRQ Handler and Callbacks
516  * @brief IRQ Handler and Callbacks functions
517  * @{
518  */
519 
520 /**
521  ****************************************************************************************
522  * @brief Handle CALENDAR interrupt request.
523  *
524  * @note When alarm is enabled, CALENDAR will generate an interrupt on conter match alarm value.
525  *
526  * @param[in] p_calendar: Pointer to a CALENDAR handle which contains the configuration
527  * information for the specified CALENDAR module.
528  ****************************************************************************************
529  */
531 
532 /**
533  ****************************************************************************************
534  * @brief CALENDAR date count complete (counter reaches to alarm) callback.
535  *
536  * @note This function should not be modified. when the callback is needed,
537  * the hal_calendar_alarm_callback can be implemented in the user file.
538  *
539  * @param[in] p_calendar: Pointer to a CALENDAR handle which contains the configuration
540  * information for the specified CALENDAR module.
541  ****************************************************************************************
542  */
544 
545 /**
546  ****************************************************************************************
547  * @brief CALENDAR milliseconds count complete (counter reaches to 0) callback.
548  *
549  * @note This function should not be modified. when the callback is needed,
550  * the hal_calendar_tick_callback can be implemented in the user file.
551  *
552  * @param[in] p_calendar: Pointer to a CALENDAR handle which contains the configuration
553  * information for the specified CALENDAR module.
554  ****************************************************************************************
555  */
557 
558 /**
559  ****************************************************************************************
560  * @brief CALENDAR overflow callback.
561  *
562  * @note This function should not be modified. when the callback is needed,
563  * the hal_calendar_overflow_callback can be implemented in the user file.
564  *
565  * @note The overflow time is about 36 hours.
566  *
567  * @param[in] p_calendar: Pointer to a CALENDAR handle which contains the configuration
568  * information for the specified CALENDAR module.
569  ****************************************************************************************
570  */
572 
573 /** @} */
574 
575 /** @} */
576 
577 #ifdef __cplusplus
578 }
579 #endif
580 
581 #endif /* __GR55xx_HAL_CALENDAR_H__ */
582 
583 /** @} */
584 
585 /** @} */
586 
587 /** @} */
_calendar_time::sec
uint8_t sec
Definition: gr55xx_hal_calendar.h:77
_calendar_alarm::alarm_date_week_mask
uint8_t alarm_date_week_mask
Definition: gr55xx_hal_calendar.h:116
_calendar_time::date
uint8_t date
Definition: gr55xx_hal_calendar.h:86
_calendar_time::min
uint8_t min
Definition: gr55xx_hal_calendar.h:80
calendar_alarm_t
struct _calendar_alarm calendar_alarm_t
CALENDAR_Alarm calendar alarm structure definition.
_calendar_callback::calendar_alarm_callback
void(* calendar_alarm_callback)(calendar_handle_t *p_calendar)
Definition: gr55xx_hal_calendar.h:165
hal_lock_t
hal_lock_t
HAL Lock structures definition.
Definition: gr55xx_hal_def.h:81
calendar_time_t
struct _calendar_time calendar_time_t
CALENDAR_Time calendar time structure definition.
_calendar_time::hour
uint8_t hour
Definition: gr55xx_hal_calendar.h:83
hal_calendar_alarm_callback
void hal_calendar_alarm_callback(calendar_handle_t *p_calendar)
CALENDAR date count complete (counter reaches to alarm) callback.
hal_calendar_sync_time
hal_status_t hal_calendar_sync_time(calendar_handle_t *p_calendar, uint32_t SlowClockFreq)
Sync slow clock to calendar.
hal_calendar_disable_event
hal_status_t hal_calendar_disable_event(calendar_handle_t *p_calendar, uint32_t disable_mode)
Disable CALENDAR alarm event.
hal_calendar_deinit
hal_status_t hal_calendar_deinit(calendar_handle_t *p_calendar)
De-initialize the CALENDAR peripheral.
_calendar_handle::pre_count
uint32_t pre_count
Definition: gr55xx_hal_calendar.h:135
_calendar_time::ms
uint16_t ms
Definition: gr55xx_hal_calendar.h:98
hal_calendar_tick_callback
void hal_calendar_tick_callback(calendar_handle_t *p_calendar)
CALENDAR milliseconds count complete (counter reaches to 0) callback.
_calendar_time::mon
uint8_t mon
Definition: gr55xx_hal_calendar.h:89
hal_calendar_get_time
hal_status_t hal_calendar_get_time(calendar_handle_t *p_calendar, calendar_time_t *p_time)
Get current CALENDAR time.
_calendar_callback::calendar_overflow_callback
void(* calendar_overflow_callback)(calendar_handle_t *p_calendar)
Definition: gr55xx_hal_calendar.h:167
hal_calendar_init
hal_status_t hal_calendar_init(calendar_handle_t *p_calendar)
Initialize the CALENDAR according to the specified parameters in the calendar_init_t of associated ha...
_calendar_handle::clock_freq
uint32_t clock_freq
Definition: gr55xx_hal_calendar.h:145
_calendar_handle
CALENDAR handle Structure definition.
Definition: gr55xx_hal_calendar.h:132
hal_calendar_set_alarm
hal_status_t hal_calendar_set_alarm(calendar_handle_t *p_calendar, calendar_alarm_t *p_alarm)
Set a CALENDAR date alarm.
_calendar_alarm::alarm_sel
uint8_t alarm_sel
Definition: gr55xx_hal_calendar.h:113
_calendar_handle::lock
hal_lock_t lock
Definition: gr55xx_hal_calendar.h:139
hal_calendar_irq_handler
void hal_calendar_irq_handler(calendar_handle_t *p_calendar)
Handle CALENDAR interrupt request.
_calendar_handle::alarm
calendar_alarm_t alarm
Definition: gr55xx_hal_calendar.h:137
_calendar_time::week
uint8_t week
Definition: gr55xx_hal_calendar.h:95
hal_calendar_init_time
hal_status_t hal_calendar_init_time(calendar_handle_t *p_calendar, calendar_time_t *p_time)
Initialize the CALENDAR time.
calendar_callback_t
struct _calendar_callback calendar_callback_t
HAL_CALENDAR Callback function definition.
gr55xx_ll_calendar.h
Header file containing functions prototypes of CALENDAR LL library.
_calendar_handle::utc
uint32_t utc
Definition: gr55xx_hal_calendar.h:133
_calendar_callback::calendar_tick_callback
void(* calendar_tick_callback)(calendar_handle_t *p_calendar)
Definition: gr55xx_hal_calendar.h:166
_calendar_handle::interval
uint32_t interval
Definition: gr55xx_hal_calendar.h:141
_calendar_alarm
CALENDAR_Alarm calendar alarm structure definition.
Definition: gr55xx_hal_calendar.h:106
hal_status_t
hal_status_t
HAL Status structures definition.
Definition: gr55xx_hal_def.h:70
_calendar_alarm::hour
uint8_t hour
Definition: gr55xx_hal_calendar.h:110
hal_calendar_overflow_callback
void hal_calendar_overflow_callback(calendar_handle_t *p_calendar)
CALENDAR overflow callback.
hal_calendar_set_tick
hal_status_t hal_calendar_set_tick(calendar_handle_t *p_calendar, uint32_t interval)
Set a CALENDAR tick 0 alarm.
calendar_handle_t
struct _calendar_handle calendar_handle_t
CALENDAR handle Structure definition.
_calendar_alarm::min
uint8_t min
Definition: gr55xx_hal_calendar.h:107
_calendar_handle::mode
uint8_t mode
Definition: gr55xx_hal_calendar.h:143
_calendar_time
CALENDAR_Time calendar time structure definition.
Definition: gr55xx_hal_calendar.h:76
_calendar_time::year
uint8_t year
Definition: gr55xx_hal_calendar.h:92
_calendar_callback
HAL_CALENDAR Callback function definition.
Definition: gr55xx_hal_calendar.h:164
gr55xx_hal_def.h
This file contains HAL common definitions, enumeration, macros and structures definitions.