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