Go to the documentation of this file.
52 #ifndef HAL_CALENDER_H
53 #define HAL_CALENDER_H
185 #define CALENDAR_IT_ALARM RTC_INT_EN_ALARM
186 #define CALENDAR_IT_WRAP RTC_INT_EN_WRAP
187 #define CALENDAR_IT_TICK RTC_INT_EN_TICK
193 #define CALENDAR_FLAG_ALARM RTC_INT_STAT_ALARM
194 #define CALENDAR_FLAG_WRAP RTC_INT_STAT_WRAP
195 #define CALENDAR_FLAG_TICK RTC_INT_STAT_TICK
201 #define CALENDAR_ALARM_SEL_DATE (0UL)
202 #define CALENDAR_ALARM_SEL_WEEKDAY (1UL)
208 #define CALENDAR_ALARM_WEEKDAY_SUN (0x01ul)
209 #define CALENDAR_ALARM_WEEKDAY_MON (0x02ul)
210 #define CALENDAR_ALARM_WEEKDAY_TUE (0x04ul)
211 #define CALENDAR_ALARM_WEEKDAY_WED (0x08ul)
212 #define CALENDAR_ALARM_WEEKDAY_THU (0x10ul)
213 #define CALENDAR_ALARM_WEEKDAY_FRI (0x20ul)
214 #define CALENDAR_ALARM_WEEKDAY_SAT (0x40ul)
220 #define CALENDAR_ALARM_DISABLE_DATE (1UL)
221 #define CALENDAR_ALARM_DISABLE_TICK (2UL)
222 #define CALENDAR_ALARM_DISABLE_ALL (CALENDAR_ALARM_DISABLE_DATE | CALENDAR_ALARM_DISABLE_TICK)
228 #define CALENDAR_TICK_SINGLE LL_CLDR_TIMER_TICK_TYPE_SINGLE
229 #define CALENDAR_TICK_AUTO LL_CLDR_TIMER_TICK_TYPE_AUTO
243 #define __HAL_CALENDAR_ENABLE() WRITE_REG(CALENDAR->CFG0, RTC_CFG0_CFG | RTC_CFG0_EN)
247 #define __HAL_CALENDAR_DISABLE() MODIFY_REG(CALENDAR->CFG0, 0xFFFFFFFFU, RTC_CFG0_CFG);
257 #define __HAL_CALENDAR_ENABLE_IT(__INTERRUPT__) SET_BITS(CALENDAR->INT_EN, (__INTERRUPT__))
266 #define __HAL_CALENDAR_DISABLE_IT(__INTERRUPT__) CLEAR_BITS(CALENDAR->INT_EN, (__INTERRUPT__))
276 #define __HAL_CALENDAR_GET_IT_SOURCE(__FLAG__) (READ_BITS(CALENDAR->INT_STAT, (__FLAG__)) == (__FLAG__))
285 #define __HAL_CALENDAR_CLEAR_FLAG(__FLAG__) WRITE_REG(CALENDAR->INT_STAT, (__FLAG__))
290 #define __HAL_CALENDAR_BUSY_FLAG() ((READ_BITS(CALENDAR->STAT, RTC_STAT_BUSY) == RTC_STAT_BUSY))
302 #define IS_CALENDAR_ALARM_TYPE(__TYPE__) (((__TYPE__) == CALENDAR_ALARM_SEL_DATE) || \
303 ((__TYPE__) == CALENDAR_ALARM_SEL_WEEKDAY))
309 #define IS_CALENDAR_DATE(__DATE__) (((__DATE__) > 0U) && ((__DATE__) <= 31U))
315 #define IS_CALENDAR_WEEKDAY(__WEEKDAY__) (((__WEEKDAY__) >= 0U) && ((__WEEKDAY__) <= 6U))
321 #define IS_CALENDAR_LEAP_YEAR(__YEAR__) ((((__YEAR__) % 4U) == 0 && ((__YEAR__) % 100U) != 0U) || \
322 ((__YEAR__) % 400U) == 0)
uint8_t alarm_date_week_mask
void hal_calendar_alarm_callback(calendar_handle_t *p_calendar)
CALENDAR date count complete (counter reaches to alarm) callback.
hal_status_t hal_calendar_disable_event(calendar_handle_t *p_calendar, uint32_t disable_mode)
Disable CALENDAR alarm event.
hal_status_t hal_calendar_deinit(calendar_handle_t *p_calendar)
De-initialize the CALENDAR peripheral.
void hal_calendar_tick_callback(calendar_handle_t *p_calendar)
CALENDAR milliseconds count complete (counter reaches to 0) callback.
Header file containing functions prototypes of CALENDAR LL library.
hal_status_t hal_calendar_get_time(calendar_handle_t *p_calendar, calendar_time_t *p_time)
Get current CALENDAR time.
void(* calendar_alarm_callback)(calendar_handle_t *p_calendar)
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...
struct _calendar_time calendar_time_t
CALENDAR time structure definition.
CALENDAR handle structure definition.
hal_status_t hal_calendar_set_alarm(calendar_handle_t *p_calendar, calendar_alarm_t *p_alarm)
Set a CALENDAR date alarm.
void hal_calendar_irq_handler(calendar_handle_t *p_calendar)
Handle CALENDAR interrupt request.
hal_status_t hal_calendar_init_time(calendar_handle_t *p_calendar, calendar_time_t *p_time)
Initialize the CALENDAR time.
struct _calendar_handle calendar_handle_t
CALENDAR handle structure definition.
hal_status_t
HAL Status structures definition.
This file contains HAL common definitions, enumeration, macros and structures definitions.
CALENDAR alarm structure definition.
void hal_calendar_overflow_callback(calendar_handle_t *p_calendar)
CALENDAR overflow callback.
CALENDAR callback function definition.
hal_status_t hal_calendar_set_tick(calendar_handle_t *p_calendar, uint32_t interval)
Set a CALENDAR tick 0 alarm.
void(* calendar_overflow_callback)(calendar_handle_t *p_calendar)
struct _hal_calendar_callback hal_calendar_callback_t
CALENDAR callback function definition.
void(* calendar_tick_callback)(calendar_handle_t *p_calendar)
CALENDAR time structure definition.
hal_status_t hal_calendar_sync_time(calendar_handle_t *p_calendar, float slow_clock_freq)
Sync slow clock to calendar.
struct _calendar_alarm calendar_alarm_t
CALENDAR alarm structure definition.