gr533x_hal_calendar.h
Go to the documentation of this file.
1 /**
2 ****************************************************************************************
3 *
4 * @file gr533x_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 __GR533x_HAL_CALENDAR_H__
53 #define __GR533x_HAL_CALENDAR_H__
54
55 #ifdef __cplusplus
56 extern "C" {
57 #endif
58
59 /* Includes ------------------------------------------------------------------*/
60 #include "gr533x_ll_calendar.h"
61 #include "gr533x_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. */
100 } calendar_time_t;
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
120 } calendar_alarm_t;
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 float clock_freq; /**< CALENDAR clock frequce. Unit: Hz. */
146 } calendar_handle_t;
147
148 /** @} */
149
150 /** @} */
151
152 /** @addtogroup HAL_CALENDAR_CALLBACK_STRUCTURES Callback Structures
153 * @{
154 */
155
156 /** @defgroup HAL_CALENDAR_Callback Callback
157 * @{
158 */
159
160 /**
161 * @brief HAL_CALENDAR Callback function definition
162 */
163 typedef struct _hal_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 */
168 } hal_calendar_callback_t;
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 /** @brief Disable the specified CALENDAR peripheral.
247 * @retval None
248 */
249 #define __HAL_CALENDAR_DISABLE() MODIFY_REG(CALENDAR->CFG0, 0xFFFFFFFF, RTC_CFG0_CFG);
250
251 /** @brief Enable the specified CALENDAR interrupts.
252 * @param __INTERRUPT__ Specifies the interrupt source to enable.
253 * This parameter can be one of the following values:
254 * @arg @ref CALENDAR_IT_ALARM Alarm Interrupt
255 * @arg @ref CALENDAR_IT_WARP Warp Interrupt
256 * @arg @ref CALENDAR_IT_TICK Tick Interrupt
257 * @retval None
258 */
259 #define __HAL_CALENDAR_ENABLE_IT(__INTERRUPT__) SET_BITS(CALENDAR->INT_EN, (__INTERRUPT__))
260 /** @brief Disable the specified CALENDAR interrupts.
261 * @param __INTERRUPT__ Specifies the interrupt source to disable.
262 * This parameter can be one of the following values:
263 * @arg @ref CALENDAR_IT_ALARM Alarm Interrupt
264 * @arg @ref CALENDAR_IT_WARP Warp Interrupt
265 * @arg @ref CALENDAR_IT_TICK Tick Interrupt
266 * @retval None
267 */
268 #define __HAL_CALENDAR_DISABLE_IT(__INTERRUPT__) CLEAR_BITS(CALENDAR->INT_EN, (__INTERRUPT__))
269
270 /** @brief Check whether the specified CALENDAR interrupt flag is set or not.
271 * @param __FLAG__ Specifies the interrupt source to check.
272 * This parameter can be one of the following values:
273 * @arg @ref CALENDAR_FLAG_ALARM Alarm Interrupt event
274 * @arg @ref CALENDAR_FLAG_WARP Warp Interrupt event
275 * @arg @ref CALENDAR_FLAG_TICK Tick Interrupt event
276 * @retval The new state of __IT__ (TRUE or FALSE).
277 */
278 #define __HAL_CALENDAR_GET_IT_SOURCE(__FLAG__) (READ_BITS(CALENDAR->INT_STAT, (__FLAG__)) == (__FLAG__))
279 /** @brief Clear the specified CALENDAR flag.
280 * @param __FLAG__ Specifies the flag to clear.
281 * This parameter can be one of the following values:
282 * @arg @ref CALENDAR_FLAG_ALARM Alarm Interrupt event
283 * @arg @ref CALENDAR_FLAG_WARP Warp Interrupt event
284 * @arg @ref CALENDAR_FLAG_TICK Tick Interrupt event
285 * @retval None
286 */
287 #define __HAL_CALENDAR_CLEAR_FLAG(__FLAG__) WRITE_REG(CALENDAR->INT_STAT, (__FLAG__))
288
289 /** @brief Get the CALENDAR busy flag.
290 * @retval The new state of __BUSY__ (TRUE or FALSE).
291 */
292 #define __HAL_CALENDAR_BUSY_FLAG() ((READ_BITS(CALENDAR->STAT, RTC_STAT_BUSY) == RTC_STAT_BUSY))
293 /** @} */
294
295 /* Private macros ------------------------------------------------------------*/
296 /** @defgroup CALENDAR_Private_Macro CALENDAR Private Macros
297 * @{
298 */
299
300 /** @brief Check if CALENDAR Alarm Type is valid.
301 * @param __TYPE__ CALENDAR Alarm Type.
302 * @retval SET (__TYPE__ is valid) or RESET (__TYPE__ is invalid)
303 */
304 #define IS_CALENDAR_ALARM_TYPE(__TYPE__) (((__TYPE__) == CALENDAR_ALARM_SEL_DATE) || \
305 ((__TYPE__) == CALENDAR_ALARM_SEL_WEEKDAY))
306
307 /** @brief Check if CALENDAR Date is valid.
308 * @param __DATE__ CALENDAR Date.
309 * @retval SET (__DATE__ is valid) or RESET (__DATE__ is invalid)
310 */
311 #define IS_CALENDAR_DATE(__DATE__) (((__DATE__) > 0) && ((__DATE__) <= 31))
312
313 /** @brief Check if CALENDAR Weekday is valid.
314 * @param __WEEKDAY__ CALENDAR Weekday.
315 * @retval SET (__WEEKDAY__ is valid) or RESET (__WEEKDAY__ is invalid)
316 */
317 #define IS_CALENDAR_WEEKDAY(__WEEKDAY__) (((__WEEKDAY__) >= 0) && ((__WEEKDAY__) <= 6))
318
319 /** @brief Check if CALENDAR year is leap year.
320 * @param __YEAR__ CALENDAR Year.
321 * @retval SET (__YEAR__ is leap year) or RESET (__YEAR__ is nonleap year)
322 */
323 #define IS_CALENDAR_LEAP_YEAR(__YEAR__) ((((__YEAR__) % 4) == 0 && ((__YEAR__) % 100) != 0) || \
324 ((__YEAR__) % 400) == 0)
325
326 /** @} */
327
328 /** @} */
329
330 /* Exported functions --------------------------------------------------------*/
331 /** @addtogroup HAL_CALENDAR_DRIVER_FUNCTIONS Functions
332 * @{
333 */
334
335 /** @addtogroup CALENDAR_Exported_Functions_Group1 Initialization and de-initialization functions
336 * @brief Initialization and Configuration functions.
337 *
338 @verbatim
339 ==============================================================================
340 ##### Initialization and Configuration functions #####
341 ==============================================================================
342 [..]
343 This section provides functions allowing to:
344 (+) Initialize and start the CALENDAR according to the specified parameters
345 in the cslendar_init_t of associated handle.
346 (+) Initialize the CALENDAR MSP.
347
348 @endverbatim
349 * @{
350 */
351
352 /**
353 ****************************************************************************************
354 * @brief Initialize the CALENDAR according to the specified parameters in the
355 * calendar_init_t of associated handle.
356 *
357 * @param[in] p_calendar: Pointer to a CALENDAR handle which contains the configuration
358 * information for the specified CALENDAR 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 */
366 hal_status_t hal_calendar_init(calendar_handle_t *p_calendar);
367
368 /**
369 ****************************************************************************************
370 * @brief De-initialize the CALENDAR peripheral.
371 *
372 * @param[in] p_calendar: CALENDAR handle.
373 *
374 * @retval ::HAL_OK: Operation is OK.
375 * @retval ::HAL_ERROR: Parameter error or operation not supported.
376 * @retval ::HAL_BUSY: Driver is busy.
377 * @retval ::HAL_TIMEOUT: Timeout occurred.
378 ****************************************************************************************
379 */
380 hal_status_t hal_calendar_deinit(calendar_handle_t *p_calendar);
381
382 /** @} */
383
384 /** @addtogroup CALENDAR_Exported_Functions_Group2 IO operation functions
385 * @brief IO operation functions
386 *
387 @verbatim
388 ==============================================================================
389 ##### IO operation functions #####
390 ==============================================================================
391 [..]
392 This section provides functions allowing to:
393 (+) Init the CALENDAR time.
394 (+) Get the CALENDAR time.
395 (+) Set the CALENDAR alarm.
396 (+) Disable the CALENDAR alarm.
397 (+) Handle CALENDAR interrupt request and associated function callback.
398
399 @endverbatim
400 * @{
401 */
402
403 /**
404 ****************************************************************************************
405 * @brief Initialize the CALENDAR time.
406 *
407 * @param[in] p_calendar: Pointer to a CALENDAR handle which contains the configuration
408 * information for the specified CALENDAR module.
409 * @param[in] p_time: Pointer to a CALENDAR time struction.
410 *
411 * @retval ::HAL_OK: Operation is OK.
412 * @retval ::HAL_ERROR: Parameter error or operation not supported.
413 * @retval ::HAL_BUSY: Driver is busy.
414 * @retval ::HAL_TIMEOUT: Timeout occurred.
415 ****************************************************************************************
416 */
417 hal_status_t hal_calendar_init_time(calendar_handle_t *p_calendar, calendar_time_t *p_time);
418
419 /**
420 ****************************************************************************************
421 * @brief Get current CALENDAR time.
422 *
423 * @param[in] p_calendar: Pointer to a CALENDAR handle which contains the configuration
424 * information for the specified CALENDAR module.
425 * @param[in] p_time: Pointer to a CALENDAR time struction.
426 *
427 * @retval ::HAL_OK: Operation is OK.
428 * @retval ::HAL_ERROR: Parameter error or operation not supported.
429 * @retval ::HAL_BUSY: Driver is busy.
430 * @retval ::HAL_TIMEOUT: Timeout occurred.
431 ****************************************************************************************
432 */
433 hal_status_t hal_calendar_get_time(calendar_handle_t *p_calendar, calendar_time_t *p_time);
434
435 /**
436 ****************************************************************************************
437 * @brief Set a CALENDAR date alarm.
438 *
439 * @param[in] p_calendar: Pointer to a CALENDAR handle which contains the configuration
440 * information for the specified CALENDAR module.
441 * @param[in] p_alarm: After seconds will generate an date alarm interrupt.
442 *
443 * @retval ::HAL_OK: Operation is OK.
444 * @retval ::HAL_ERROR: Parameter error or operation not supported.
445 * @retval ::HAL_BUSY: Driver is busy.
446 * @retval ::HAL_TIMEOUT: Timeout occurred.
447 ****************************************************************************************
448 */
449 hal_status_t hal_calendar_set_alarm(calendar_handle_t *p_calendar, calendar_alarm_t *p_alarm);
450
451 /**
452 ****************************************************************************************
453 * @brief Set a CALENDAR tick 0 alarm.
454 *
455 * @param[in] p_calendar: Pointer to a CALENDAR handle which contains the configuration
456 * information for the specified CALENDAR module.
457 * @param[in] interval: After milliseconds will generate an milliseconds alarm interrupt.
458 * The value of interval is greater than or equal to 0ms.
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 */
466 hal_status_t hal_calendar_set_tick(calendar_handle_t *p_calendar, uint32_t interval);
467
468 /**
469 ****************************************************************************************
470 * @brief Disable CALENDAR alarm event.
471 *
472 * @param[in] p_calendar: Pointer to a CALENDAR handle which contains the configuration
473 * information for the specified CALENDAR module.
474 * @param[in] disable_mode: Disable specified CALENDAR alarm mode.
475 * This parameter can be the following values:
476 * @arg @ref CALENDAR_ALARM_DISABLE_DATE
477 * @arg @ref CALENDAR_ALARM_DISABLE_TICK
478 * @arg @ref CALENDAR_ALARM_DISABLE_ALL
479 *
480 * @retval ::HAL_OK: Operation is OK.
481 * @retval ::HAL_ERROR: Parameter error or operation not supported.
482 * @retval ::HAL_BUSY: Driver is busy.
483 * @retval ::HAL_TIMEOUT: Timeout occurred.
484 ****************************************************************************************
485 */
486 hal_status_t hal_calendar_disable_event(calendar_handle_t *p_calendar, uint32_t disable_mode);
487
488 /**
489 ****************************************************************************************
490 * @brief Sync slow clock to calendar.
491 *
492 * @param[in] p_calendar: Pointer to a CALENDAR handle which contains the configuration
493 * information for the specified CALENDAR module.
494 * @param[in] SlowClockFreq: Number of slow clocks after calibration.
495 *
496 * @retval ::HAL_OK: Operation is OK.
497 * @retval ::HAL_ERROR: Parameter error or operation not supported.
498 * @retval ::HAL_BUSY: Driver is busy.
499 * @retval ::HAL_TIMEOUT: Timeout occurred.
500 ****************************************************************************************
501 */
502 hal_status_t hal_calendar_sync_time(calendar_handle_t *p_calendar, float SlowClockFreq);
503
504 /** @} */
505
506
507 /** @addtogroup CALENDAR_IRQ_Handler_and_Callbacks IRQ Handler and Callbacks
508 * @brief IRQ Handler and Callbacks functions
509 * @{
510 */
511
512 /**
513 ****************************************************************************************
514 * @brief Handle CALENDAR interrupt request.
515 *
516 * @note When alarm is enabled, CALENDAR will generate an interrupt on conter match alarm value.
517 *
518 * @param[in] p_calendar: Pointer to a CALENDAR handle which contains the configuration
519 * information for the specified CALENDAR module.
520 ****************************************************************************************
521 */
522 void hal_calendar_irq_handler(calendar_handle_t *p_calendar);
523
524 /**
525 ****************************************************************************************
526 * @brief CALENDAR date count complete (counter reaches to alarm) callback.
527 *
528 * @note This function should not be modified. when the callback is needed,
529 * the hal_calendar_alarm_callback can be implemented in the user file.
530 *
531 * @param[in] p_calendar: Pointer to a CALENDAR handle which contains the configuration
532 * information for the specified CALENDAR module.
533 ****************************************************************************************
534 */
535 void hal_calendar_alarm_callback(calendar_handle_t *p_calendar);
536
537 /**
538 ****************************************************************************************
539 * @brief CALENDAR milliseconds count complete (counter reaches to 0) callback.
540 *
541 * @note This function should not be modified. when the callback is needed,
542 * the hal_calendar_tick_callback can be implemented in the user file.
543 *
544 * @param[in] p_calendar: Pointer to a CALENDAR handle which contains the configuration
545 * information for the specified CALENDAR module.
546 ****************************************************************************************
547 */
548 void hal_calendar_tick_callback(calendar_handle_t *p_calendar);
549
550 /**
551 ****************************************************************************************
552 * @brief CALENDAR overflow callback.
553 *
554 * @note This function should not be modified. when the callback is needed,
555 * the hal_calendar_overflow_callback can be implemented in the user file.
556 *
557 * @note The overflow time is about 36 hours.
558 *
559 * @param[in] p_calendar: Pointer to a CALENDAR handle which contains the configuration
560 * information for the specified CALENDAR module.
561 ****************************************************************************************
562 */
563 void hal_calendar_overflow_callback(calendar_handle_t *p_calendar);
564
565 /** @} */
566
567 /** @} */
568
569 #ifdef __cplusplus
570 }
571 #endif
572
573 #endif /* __GR533x_HAL_CALENDAR_H__ */
574
575 /** @} */
576
577 /** @} */
578
579 /** @} */
_calendar_time::sec
uint8_t sec
Definition: gr533x_hal_calendar.h:77
_calendar_alarm::alarm_date_week_mask
uint8_t alarm_date_week_mask
Definition: gr533x_hal_calendar.h:116
_calendar_handle::clock_freq
float clock_freq
Definition: gr533x_hal_calendar.h:145
_calendar_time::date
uint8_t date
Definition: gr533x_hal_calendar.h:86
_calendar_time::min
uint8_t min
Definition: gr533x_hal_calendar.h:80
calendar_alarm_t
struct _calendar_alarm calendar_alarm_t
CALENDAR_Alarm calendar alarm structure definition.
hal_lock_t
hal_lock_t
HAL Lock structures definition.
Definition: gr533x_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: gr533x_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_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.
gr533x_ll_calendar.h
Header file containing functions prototypes of CALENDAR LL library.
_calendar_handle::pre_count
uint32_t pre_count
Definition: gr533x_hal_calendar.h:135
_calendar_time::ms
uint16_t ms
Definition: gr533x_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: gr533x_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.
_hal_calendar_callback::calendar_alarm_callback
void(* calendar_alarm_callback)(calendar_handle_t *p_calendar)
Definition: gr533x_hal_calendar.h:165
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
CALENDAR handle Structure definition.
Definition: gr533x_hal_calendar.h:132
hal_calendar_callback_t
struct _hal_calendar_callback hal_calendar_callback_t
HAL_CALENDAR Callback function definition.
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: gr533x_hal_calendar.h:113
_calendar_handle::lock
hal_lock_t lock
Definition: gr533x_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: gr533x_hal_calendar.h:137
_calendar_time::week
uint8_t week
Definition: gr533x_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_handle::utc
uint32_t utc
Definition: gr533x_hal_calendar.h:133
_calendar_handle::interval
uint32_t interval
Definition: gr533x_hal_calendar.h:141
_calendar_alarm
CALENDAR_Alarm calendar alarm structure definition.
Definition: gr533x_hal_calendar.h:106
hal_calendar_sync_time
hal_status_t hal_calendar_sync_time(calendar_handle_t *p_calendar, float SlowClockFreq)
Sync slow clock to calendar.
hal_status_t
hal_status_t
HAL Status structures definition.
Definition: gr533x_hal_def.h:70
_calendar_alarm::hour
uint8_t hour
Definition: gr533x_hal_calendar.h:110
hal_calendar_overflow_callback
void hal_calendar_overflow_callback(calendar_handle_t *p_calendar)
CALENDAR overflow callback.
_hal_calendar_callback
HAL_CALENDAR Callback function definition.
Definition: gr533x_hal_calendar.h:164
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: gr533x_hal_calendar.h:107
_hal_calendar_callback::calendar_overflow_callback
void(* calendar_overflow_callback)(calendar_handle_t *p_calendar)
Definition: gr533x_hal_calendar.h:167
_calendar_handle::mode
uint8_t mode
Definition: gr533x_hal_calendar.h:143
_hal_calendar_callback::calendar_tick_callback
void(* calendar_tick_callback)(calendar_handle_t *p_calendar)
Definition: gr533x_hal_calendar.h:166
_calendar_time
CALENDAR_Time calendar time structure definition.
Definition: gr533x_hal_calendar.h:76
_calendar_time::year
uint8_t year
Definition: gr533x_hal_calendar.h:92
gr533x_hal_def.h
This file contains HAL common definitions, enumeration, macros and structures definitions.