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