hal_calendar.h
Go to the documentation of this file.
1 /**
2  ****************************************************************************************
3  *
4  * @file 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 HAL_CALENDER_H
53 #define HAL_CALENDER_H
54 
55 #ifdef __cplusplus
56 extern "C" {
57 #endif
58 
59 /* Includes ------------------------------------------------------------------*/
60 #include "ll_calendar.h"
61 #include "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 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 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  uint32_t interval; /**< Specifies the Calendar milliseconds alarm. */
140 
141  uint8_t mode; /**< Specifies the Calendar alarm mode. */
142 
143  float clock_freq; /**< CALENDAR clock frequce. Unit: Hz. */
145 
146 /** @} */
147 
148 /** @} */
149 
150 /** @addtogroup HAL_CALENDAR_CALLBACK_STRUCTURES Callback structures
151  * @{
152  */
153 
154 /** @defgroup HAL_CALENDAR_CALLBACK Callback
155  * @{
156  */
157 
158 /**
159  * @brief CALENDAR callback function definition
160  */
162 {
163  void (*calendar_alarm_callback)(calendar_handle_t *p_calendar); /**< CALENDAR date count complete callback */
164  void (*calendar_tick_callback)(calendar_handle_t *p_calendar); /**< CALENDAR tick count complete callback */
165  void (*calendar_overflow_callback)(calendar_handle_t *p_calendar); /**< CALENDAR overflow callback */
167 
168 /** @} */
169 
170 /** @} */
171 
172 /**
173  * @defgroup HAL_CALENDAR_MACRO Defines
174  * @{
175  */
176 
177 /* Exported constants --------------------------------------------------------*/
178 /** @defgroup CALENDAR_EXPORTED_CONSTANTS CALENDAR exported constants
179  * @{
180  */
181 
182 /** @defgroup CALENDAR_INTERRUPTS CALENDAR interrupts
183  * @{
184  */
185 #define CALENDAR_IT_ALARM RTC_INT_EN_ALARM /**< Alarm interrupt */
186 #define CALENDAR_IT_WRAP RTC_INT_EN_WRAP /**< Wrap interrupt */
187 #define CALENDAR_IT_TICK RTC_INT_EN_TICK /**< Tick interrupt */
188 /** @} */
189 
190 /** @defgroup CALENDAR_Flags CALENDAR flags
191  * @{
192  */
193 #define CALENDAR_FLAG_ALARM RTC_INT_STAT_ALARM /**< Alarm interrupt flag */
194 #define CALENDAR_FLAG_WRAP RTC_INT_STAT_WRAP /**< Wrap interrupt flag */
195 #define CALENDAR_FLAG_TICK RTC_INT_STAT_TICK /**< Tick interrupt flag */
196 /** @} */
197 
198 /** @defgroup CALENDAR_ALARM_SEL CALENDAR alarm type select
199  * @{
200  */
201 #define CALENDAR_ALARM_SEL_DATE (0UL) /**< Alarm in date */
202 #define CALENDAR_ALARM_SEL_WEEKDAY (1UL) /**< Alarm in weekday */
203 /** @} */
204 
205 /** @defgroup CALENDAR_ALARM_WEEKDAY CALENDAR alarm weekday
206  * @{
207  */
208 #define CALENDAR_ALARM_WEEKDAY_SUN (0x01ul) /**< Alarm weekday mask Sunday */
209 #define CALENDAR_ALARM_WEEKDAY_MON (0x02ul) /**< Alarm weekday mask Monday */
210 #define CALENDAR_ALARM_WEEKDAY_TUE (0x04ul) /**< Alarm weekday mask Tuesday */
211 #define CALENDAR_ALARM_WEEKDAY_WED (0x08ul) /**< Alarm weekday mask Wednesday */
212 #define CALENDAR_ALARM_WEEKDAY_THU (0x10ul) /**< Alarm weekday mask Thursday */
213 #define CALENDAR_ALARM_WEEKDAY_FRI (0x20ul) /**< Alarm weekday mask Friday */
214 #define CALENDAR_ALARM_WEEKDAY_SAT (0x40ul) /**< Alarm weekday mask Saturday */
215 /** @} */
216 
217 /** @defgroup CALENDAR_ALARM_DISABLE_MODE CALENDAR alarm disable mode
218  * @{
219  */
220 #define CALENDAR_ALARM_DISABLE_DATE (1UL) /**< Disable date alarm */
221 #define CALENDAR_ALARM_DISABLE_TICK (2UL) /**< Disable tick 0 alarm */
222 #define CALENDAR_ALARM_DISABLE_ALL (CALENDAR_ALARM_DISABLE_DATE | CALENDAR_ALARM_DISABLE_TICK) /**< Disable all alarm */
223 /** @} */
224 
225 /** @defgroup CALENDAR_ALARM_TICK_MODE CALENDAR alarm tick mode
226  * @{
227  */
228 #define CALENDAR_TICK_SINGLE LL_CLDR_TIMER_TICK_TYPE_SINGLE /**< Alarm tick reload single */
229 #define CALENDAR_TICK_AUTO LL_CLDR_TIMER_TICK_TYPE_AUTO /**< Alarm tick reload auto */
230 
231 /** @} */
232 
233 /** @} */
234 
235 /* Exported macro ------------------------------------------------------------*/
236 /** @defgroup CALENDAR_EXPORTED_MACROS CALENDAR exported macros
237  * @{
238  */
239 
240 /** @brief Enable the specified CALENDAR peripheral.
241  * @retval None
242  */
243 #define __HAL_CALENDAR_ENABLE() WRITE_REG(CALENDAR->CFG0, RTC_CFG0_CFG | RTC_CFG0_EN)
244 /** @brief Disable the specified CALENDAR peripheral.
245  * @retval None
246  */
247 #define __HAL_CALENDAR_DISABLE() MODIFY_REG(CALENDAR->CFG0, 0xFFFFFFFFU, RTC_CFG0_CFG);
248 
249 /** @brief Enable the specified CALENDAR interrupts.
250  * @param[in] __INTERRUPT__ Specifies the interrupt source to enable.
251  * This parameter can be one of the following values:
252  * @arg @ref CALENDAR_IT_ALARM Alarm Interrupt
253  * @arg @ref CALENDAR_IT_WRAP Wrap Interrupt
254  * @arg @ref CALENDAR_IT_TICK Tick Interrupt
255  * @retval None
256  */
257 #define __HAL_CALENDAR_ENABLE_IT(__INTERRUPT__) SET_BITS(CALENDAR->INT_EN, (__INTERRUPT__))
258 /** @brief Disable the specified CALENDAR interrupts.
259  * @param[in] __INTERRUPT__ Specifies the interrupt source to disable.
260  * This parameter can be one of the following values:
261  * @arg @ref CALENDAR_IT_ALARM Alarm Interrupt
262  * @arg @ref CALENDAR_IT_WRAP Wrap Interrupt
263  * @arg @ref CALENDAR_IT_TICK Tick Interrupt
264  * @retval None
265  */
266 #define __HAL_CALENDAR_DISABLE_IT(__INTERRUPT__) CLEAR_BITS(CALENDAR->INT_EN, (__INTERRUPT__))
267 
268 /** @brief Check whether the specified CALENDAR interrupt flag is set or not.
269  * @param[in] __FLAG__ Specifies the interrupt source to check.
270  * This parameter can be one of the following values:
271  * @arg @ref CALENDAR_FLAG_ALARM Alarm Interrupt event
272  * @arg @ref CALENDAR_FLAG_WRAP Wrap Interrupt event
273  * @arg @ref CALENDAR_FLAG_TICK Tick Interrupt event
274  * @retval The new state of __IT__ (TRUE or FALSE).
275  */
276 #define __HAL_CALENDAR_GET_IT_SOURCE(__FLAG__) (READ_BITS(CALENDAR->INT_STAT, (__FLAG__)) == (__FLAG__))
277 /** @brief Clear the specified CALENDAR flag.
278  * @param[in] __FLAG__ Specifies the flag to clear.
279  * This parameter can be one of the following values:
280  * @arg @ref CALENDAR_FLAG_ALARM Alarm Interrupt event
281  * @arg @ref CALENDAR_FLAG_WRAP Wrap Interrupt event
282  * @arg @ref CALENDAR_FLAG_TICK Tick Interrupt event
283  * @retval None
284  */
285 #define __HAL_CALENDAR_CLEAR_FLAG(__FLAG__) WRITE_REG(CALENDAR->INT_STAT, (__FLAG__))
286 
287 /** @brief Get the CALENDAR busy flag.
288  * @retval The new state of __BUSY__ (TRUE or FALSE).
289  */
290 #define __HAL_CALENDAR_BUSY_FLAG() ((READ_BITS(CALENDAR->STAT, RTC_STAT_BUSY) == RTC_STAT_BUSY))
291 /** @} */
292 
293 /* Private macros ------------------------------------------------------------*/
294 /** @defgroup CALENDAR_Private_Macro CALENDAR Private Macros
295  * @{
296  */
297 
298 /** @brief Check if CALENDAR Alarm Type is valid.
299  * @param[in] __TYPE__ CALENDAR Alarm Type.
300  * @retval SET (__TYPE__ is valid) or RESET (__TYPE__ is invalid)
301  */
302 #define IS_CALENDAR_ALARM_TYPE(__TYPE__) (((__TYPE__) == CALENDAR_ALARM_SEL_DATE) || \
303  ((__TYPE__) == CALENDAR_ALARM_SEL_WEEKDAY))
304 
305 /** @brief Check if CALENDAR Date is valid.
306  * @param[in] __DATE__ CALENDAR Date.
307  * @retval SET (__DATE__ is valid) or RESET (__DATE__ is invalid)
308  */
309 #define IS_CALENDAR_DATE(__DATE__) (((__DATE__) > 0U) && ((__DATE__) <= 31U))
310 
311 /** @brief Check if CALENDAR Weekday is valid.
312  * @param[in] __WEEKDAY__ CALENDAR Weekday.
313  * @retval SET (__WEEKDAY__ is valid) or RESET (__WEEKDAY__ is invalid)
314  */
315 #define IS_CALENDAR_WEEKDAY(__WEEKDAY__) (((__WEEKDAY__) >= 0U) && ((__WEEKDAY__) <= 6U))
316 
317 /** @brief Check if CALENDAR year is leap year.
318  * @param[in] __YEAR__ CALENDAR Year.
319  * @retval SET (__YEAR__ is leap year) or RESET (__YEAR__ is nonleap year)
320  */
321 #define IS_CALENDAR_LEAP_YEAR(__YEAR__) ((((__YEAR__) % 4U) == 0 && ((__YEAR__) % 100U) != 0U) || \
322  ((__YEAR__) % 400U) == 0)
323 
324 /** @} */
325 
326 /** @} */
327 
328 /* Exported functions --------------------------------------------------------*/
329 /** @addtogroup HAL_CALENDAR_DRIVER_FUNCTIONS Functions
330  * @{
331  */
332 
333 /** @addtogroup CALENDAR_Exported_Functions_Group1 Initialization and de-initialization functions
334  * @brief Initialization and Configuration functions.
335  *
336 @verbatim
337  ==============================================================================
338  ##### Initialization and Configuration functions #####
339  ==============================================================================
340  [..]
341  This section provides functions allowing to:
342  (+) Initialize and start the CALENDAR according to the specified parameters
343  in the cslendar_init_t of associated handle.
344  (+) Initialize the CALENDAR MSP.
345 
346 @endverbatim
347  * @{
348  */
349 
350 /**
351  ****************************************************************************************
352  * @brief Initialize the CALENDAR according to the specified parameters in the
353  * calendar_init_t of associated handle.
354  *
355  * @param[in] p_calendar: Pointer to a CALENDAR handle which contains the configuration
356  * information for the specified CALENDAR module.
357  *
358  * @retval ::HAL_OK: Operation is OK.
359  * @retval ::HAL_ERROR: Parameter error or operation not supported.
360  * @retval ::HAL_BUSY: Driver is busy.
361  * @retval ::HAL_TIMEOUT: Timeout occurred.
362  ****************************************************************************************
363  */
365 
366 /**
367  ****************************************************************************************
368  * @brief De-initialize the CALENDAR peripheral.
369  *
370  * @param[in] p_calendar: CALENDAR handle.
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  */
379 
380 /** @} */
381 
382 /** @addtogroup CALENDAR_Exported_Functions_Group2 IO operation functions
383  * @brief IO operation functions
384  *
385 @verbatim
386  ==============================================================================
387  ##### IO operation functions #####
388  ==============================================================================
389  [..]
390  This section provides functions allowing to:
391  (+) Init the CALENDAR time.
392  (+) Get the CALENDAR time.
393  (+) Set the CALENDAR alarm.
394  (+) Disable the CALENDAR alarm.
395  (+) Handle CALENDAR interrupt request and associated function callback.
396 
397 @endverbatim
398  * @{
399  */
400 
401 /**
402  ****************************************************************************************
403  * @brief Initialize the CALENDAR time.
404  *
405  * @param[in] p_calendar: Pointer to a CALENDAR handle which contains the configuration
406  * information for the specified CALENDAR module.
407  * @param[in] p_time: Pointer to a CALENDAR time struction.
408  *
409  * @retval ::HAL_OK: Operation is OK.
410  * @retval ::HAL_ERROR: Parameter error or operation not supported.
411  * @retval ::HAL_BUSY: Driver is busy.
412  * @retval ::HAL_TIMEOUT: Timeout occurred.
413  ****************************************************************************************
414  */
416 
417 /**
418  ****************************************************************************************
419  * @brief Get current CALENDAR time.
420  *
421  * @param[in] p_calendar: Pointer to a CALENDAR handle which contains the configuration
422  * information for the specified CALENDAR module.
423  * @param[in] p_time: Pointer to a CALENDAR time struction.
424  *
425  * @retval ::HAL_OK: Operation is OK.
426  * @retval ::HAL_ERROR: Parameter error or operation not supported.
427  * @retval ::HAL_BUSY: Driver is busy.
428  * @retval ::HAL_TIMEOUT: Timeout occurred.
429  ****************************************************************************************
430  */
432 
433 /**
434  ****************************************************************************************
435  * @brief Set a CALENDAR date alarm.
436  *
437  * @param[in] p_calendar: Pointer to a CALENDAR handle which contains the configuration
438  * information for the specified CALENDAR module.
439  * @param[in] p_alarm: After seconds will generate a date alarm interrupt.
440  *
441  * @retval ::HAL_OK: Operation is OK.
442  * @retval ::HAL_ERROR: Parameter error or operation not supported.
443  * @retval ::HAL_BUSY: Driver is busy.
444  * @retval ::HAL_TIMEOUT: Timeout occurred.
445  ****************************************************************************************
446  */
448 
449 /**
450  ****************************************************************************************
451  * @brief Set a CALENDAR tick 0 alarm.
452  *
453  * @param[in] p_calendar: Pointer to a CALENDAR handle which contains the configuration
454  * information for the specified CALENDAR module.
455  * @param[in] interval: After milliseconds will generate a milliseconds alarm interrupt.
456  * The value of interval is greater than or equal to 0ms.
457  *
458  * @retval ::HAL_OK: Operation is OK.
459  * @retval ::HAL_ERROR: Parameter error or operation not supported.
460  * @retval ::HAL_BUSY: Driver is busy.
461  * @retval ::HAL_TIMEOUT: Timeout occurred.
462  ****************************************************************************************
463  */
464 hal_status_t hal_calendar_set_tick(calendar_handle_t *p_calendar, uint32_t interval);
465 
466 /**
467  ****************************************************************************************
468  * @brief Disable CALENDAR alarm event.
469  *
470  * @param[in] p_calendar: Pointer to a CALENDAR handle which contains the configuration
471  * information for the specified CALENDAR module.
472  * @param[in] disable_mode: Disable specified CALENDAR alarm mode.
473  * This parameter can be the following values:
474  * @arg @ref CALENDAR_ALARM_DISABLE_DATE
475  * @arg @ref CALENDAR_ALARM_DISABLE_TICK
476  * @arg @ref CALENDAR_ALARM_DISABLE_ALL
477  *
478  * @retval ::HAL_OK: Operation is OK.
479  * @retval ::HAL_ERROR: Parameter error or operation not supported.
480  * @retval ::HAL_BUSY: Driver is busy.
481  * @retval ::HAL_TIMEOUT: Timeout occurred.
482  ****************************************************************************************
483  */
484 hal_status_t hal_calendar_disable_event(calendar_handle_t *p_calendar, uint32_t disable_mode);
485 
486 /**
487  ****************************************************************************************
488  * @brief Sync slow clock to calendar.
489  *
490  * @param[in] p_calendar: Pointer to a CALENDAR handle which contains the configuration
491  * information for the specified CALENDAR module.
492  * @param[in] slow_clock_freq: Number of slow clocks after calibration.
493  *
494  * @retval ::HAL_OK: Operation is OK.
495  * @retval ::HAL_ERROR: Parameter error or operation not supported.
496  * @retval ::HAL_BUSY: Driver is busy.
497  * @retval ::HAL_TIMEOUT: Timeout occurred.
498  ****************************************************************************************
499  */
500 hal_status_t hal_calendar_sync_time(calendar_handle_t *p_calendar, float slow_clock_freq);
501 
502 /** @} */
503 
504 
505 /** @addtogroup CALENDAR_IRQ_Handler_and_Callbacks IRQ Handler and Callbacks
506  * @brief IRQ Handler and Callbacks functions
507  * @{
508  */
509 
510 /**
511  ****************************************************************************************
512  * @brief Handle CALENDAR interrupt request.
513  *
514  * @note When alarm is enabled, CALENDAR will generate an interrupt on conter match alarm value.
515  *
516  * @param[in] p_calendar: Pointer to a CALENDAR handle which contains the configuration
517  * information for the specified CALENDAR module.
518  ****************************************************************************************
519  */
521 
522 /**
523  ****************************************************************************************
524  * @brief CALENDAR date count complete (counter reaches to alarm) callback.
525  *
526  * @note This function should not be modified. when the callback is needed,
527  * the hal_calendar_alarm_callback can be implemented in the user file.
528  *
529  * @param[in] p_calendar: Pointer to a CALENDAR handle which contains the configuration
530  * information for the specified CALENDAR module.
531  ****************************************************************************************
532  */
534 
535 /**
536  ****************************************************************************************
537  * @brief CALENDAR milliseconds count complete (counter reaches to 0) callback.
538  *
539  * @note This function should not be modified. when the callback is needed,
540  * the hal_calendar_tick_callback can be implemented in the user file.
541  *
542  * @param[in] p_calendar: Pointer to a CALENDAR handle which contains the configuration
543  * information for the specified CALENDAR module.
544  ****************************************************************************************
545  */
547 
548 /**
549  ****************************************************************************************
550  * @brief CALENDAR overflow callback.
551  *
552  * @note This function should not be modified. when the callback is needed,
553  * the hal_calendar_overflow_callback can be implemented in the user file.
554  *
555  * @note The overflow time is about 36 hours.
556  *
557  * @param[in] p_calendar: Pointer to a CALENDAR handle which contains the configuration
558  * information for the specified CALENDAR module.
559  ****************************************************************************************
560  */
562 
563 /** @} */
564 
565 /** @} */
566 
567 #ifdef __cplusplus
568 }
569 #endif
570 
571 #endif /* HAL_CALENDER_H */
572 
573 /** @} */
574 
575 /** @} */
576 
577 /** @} */
_calendar_time::sec
uint8_t sec
Definition: hal_calendar.h:77
_calendar_alarm::alarm_date_week_mask
uint8_t alarm_date_week_mask
Definition: hal_calendar.h:116
_calendar_handle::clock_freq
float clock_freq
Definition: hal_calendar.h:143
_calendar_time::date
uint8_t date
Definition: hal_calendar.h:86
_calendar_time::min
uint8_t min
Definition: hal_calendar.h:80
_calendar_time::hour
uint8_t hour
Definition: 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: hal_calendar.h:135
_calendar_time::ms
uint16_t ms
Definition: 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: hal_calendar.h:89
ll_calendar.h
Header file containing functions prototypes of CALENDAR LL library.
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: hal_calendar.h:163
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_time_t
struct _calendar_time calendar_time_t
CALENDAR time structure definition.
_calendar_handle
CALENDAR handle structure definition.
Definition: 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: hal_calendar.h:113
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: hal_calendar.h:137
_calendar_time::week
uint8_t week
Definition: 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_t
struct _calendar_handle calendar_handle_t
CALENDAR handle structure definition.
_calendar_handle::utc
uint32_t utc
Definition: hal_calendar.h:133
hal_status_t
hal_status_t
HAL Status structures definition.
Definition: gr_common.h:140
hal_def.h
This file contains HAL common definitions, enumeration, macros and structures definitions.
_calendar_handle::interval
uint32_t interval
Definition: hal_calendar.h:139
_calendar_alarm
CALENDAR alarm structure definition.
Definition: hal_calendar.h:106
_calendar_alarm::hour
uint8_t hour
Definition: hal_calendar.h:110
hal_calendar_overflow_callback
void hal_calendar_overflow_callback(calendar_handle_t *p_calendar)
CALENDAR overflow callback.
_hal_calendar_callback
CALENDAR callback function definition.
Definition: hal_calendar.h:162
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_alarm::min
uint8_t min
Definition: hal_calendar.h:107
_hal_calendar_callback::calendar_overflow_callback
void(* calendar_overflow_callback)(calendar_handle_t *p_calendar)
Definition: hal_calendar.h:165
_calendar_handle::mode
uint8_t mode
Definition: hal_calendar.h:141
hal_calendar_callback_t
struct _hal_calendar_callback hal_calendar_callback_t
CALENDAR callback function definition.
_hal_calendar_callback::calendar_tick_callback
void(* calendar_tick_callback)(calendar_handle_t *p_calendar)
Definition: hal_calendar.h:164
_calendar_time
CALENDAR time structure definition.
Definition: hal_calendar.h:76
_calendar_time::year
uint8_t year
Definition: hal_calendar.h:92
hal_calendar_sync_time
hal_status_t hal_calendar_sync_time(calendar_handle_t *p_calendar, float slow_clock_freq)
Sync slow clock to calendar.
calendar_alarm_t
struct _calendar_alarm calendar_alarm_t
CALENDAR alarm structure definition.