Go to the documentation of this file.
52 #ifndef __GR55xx_HAL_CALENDAR_H__
53 #define __GR55xx_HAL_CALENDAR_H__
214 #define CALENDAR_IT_ALARM AON_CALENDAR_TIMER_CTL_ALARM_INT_EN
215 #define CALENDAR_IT_WARP AON_CALENDAR_TIMER_CTL_WRAP_INT_EN
221 #define CALENDAR_FLAG_ALARM AON_SLP_EVENT_CALENDAR_TIMER_ALARM
222 #define CALENDAR_FLAG_WARP AON_SLP_EVENT_CALENDAR_TIMER_WRAP
228 #define CALENDAR_ALARM_SEL_DATE (0UL)
229 #define CALENDAR_ALARM_SEL_WEEKDAY (1UL)
235 #define CALENDAR_ALARM_WEEKDAY_SUN (0x01ul)
236 #define CALENDAR_ALARM_WEEKDAY_MON (0x02ul)
237 #define CALENDAR_ALARM_WEEKDAY_TUE (0x04ul)
238 #define CALENDAR_ALARM_WEEKDAY_WED (0x08ul)
239 #define CALENDAR_ALARM_WEEKDAY_THU (0x10ul)
240 #define CALENDAR_ALARM_WEEKDAY_FRI (0x20ul)
241 #define CALENDAR_ALARM_WEEKDAY_SAT (0x40ul)
247 #define CALENDAR_ALARM_DISABLE_DATE (1UL)
248 #define CALENDAR_ALARM_DISABLE_TICK (2UL)
249 #define CALENDAR_ALARM_DISABLE_ALL ((CALENDAR_ALARM_DISABLE_DATE) | CALENDAR_ALARM_DISABLE_TICK)
262 #define __HAL_CALENDAR_ENABLE() SET_BITS(AON->CALENDAR_TIMER_CTL, AON_CALENDAR_TIMER_CTL_EN)
267 #define __HAL_CALENDAR_DISABLE() CLEAR_BITS(AON->CALENDAR_TIMER_CTL, AON_CALENDAR_TIMER_CTL_EN)
276 #define __HAL_CALENDAR_ENABLE_IT(__INTERRUPT__) SET_BITS(AON->CALENDAR_TIMER_CTL, (__INTERRUPT__))
285 #define __HAL_CALENDAR_DISABLE_IT(__INTERRUPT__) CLEAR_BITS(AON->CALENDAR_TIMER_CTL, (__INTERRUPT__))
294 #define __HAL_CALENDAR_GET_IT_SOURCE(__FLAG__) (READ_BITS(AON->SLP_EVENT, (__FLAG__)) == (__FLAG__))
303 #define __HAL_CALENDAR_CLEAR_FLAG(__FLAG__) WRITE_REG(AON->SLP_EVENT, ~(__FLAG__))
316 #define IS_CALENDAR_ALARM_TYPE(__TYPE__) (((__TYPE__) == CALENDAR_ALARM_SEL_DATE) || \
317 ((__TYPE__) == CALENDAR_ALARM_SEL_WEEKDAY))
323 #define IS_CALENDAR_DATE(__DATE__) (((__DATE__) > 0) && ((__DATE__) <= 31))
329 #define IS_CALENDAR_WEEKDAY(__WEEKDAY__) (((__WEEKDAY__) >= 0) && ((__WEEKDAY__) <= 6))
335 #define IS_CALENDAR_LEAP_YEAR(__YEAR__) ((((__YEAR__) % 4) == 0 && ((__YEAR__) % 100) != 0) || \
336 ((__YEAR__) % 400) == 0)
uint8_t sec
Specifies the Calendar time seconds.
uint8_t alarm_date_week_mask
Specifies the alarm date/weekday.
uint8_t date
Specifies the Calendar date.
uint8_t min
Specifies the Calendar time minutes.
struct _calendar_alarm calendar_alarm_t
CALENDAR_Alarm calendar alarm structure definition.
hal_lock_t
HAL Lock structures definition.
struct _calendar_time calendar_time_t
CALENDAR_Time calendar time structure definition.
hal_calender_state_t state
Calendar state.
@ HAL_CALENDAR_STATE_ERROR
Peripheral in error
uint8_t hour
Specifies the Calendar time hour.
void hal_calendar_alarm_callback(calendar_handle_t *p_calendar)
CALENDAR date count complete 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.
uint16_t ms
The Calendar time milliseconds.
hal_calender_state_t
HAL CALENDAR State Enumerations definition.
void hal_calendar_tick_callback(calendar_handle_t *p_calendar)
CALENDAR milliseconds count complete callback.
calendar_time_t time_init
Specifies the Calendar inital time.
@ HAL_CALENDAR_STATE_RESET
Peripheral not initialized
uint8_t mon
Specifies the Calendar month.
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)
CALENDAR date count complete callback.
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 Structure definition.
struct _hal_calendar_callback hal_calendar_callback_t
HAL_CALENDAR Callback function definition.
hal_status_t hal_calendar_set_alarm(calendar_handle_t *p_calendar, calendar_alarm_t *p_alarm)
Set a CALENDAR date alarm.
uint32_t prev_ms
Accumulated millisecond count .
uint8_t alarm_sel
Specifies the alarm is on date or weekday.
hal_lock_t lock
Specifies the Calendar locking object.
void hal_calendar_irq_handler(calendar_handle_t *p_calendar)
Handle CALENDAR interrupt request.
calendar_alarm_t alarm
Specifies the Calendar date alarm.
uint8_t week
Specifies the Calendar weekday.
hal_status_t hal_calendar_init_time(calendar_handle_t *p_calendar, calendar_time_t *p_time)
Initialize the CALENDAR time.
Header file containing functions prototypes of CALENDAR LL library.
uint8_t sec
The seconds for the date alarm.
uint32_t interval
Specifies the Calendar milliseconds alarm.
CALENDAR_Alarm calendar alarm structure definition.
hal_status_t
HAL Status structures definition.
@ HAL_CALENDAR_STATE_READY
Peripheral initialized and ready for use
uint8_t hour
Specifies the alarm time hour.
void hal_calendar_overflow_callback(calendar_handle_t *p_calendar)
CALENDAR overflow callback.
HAL_CALENDAR Callback function definition.
hal_status_t hal_calendar_set_tick(calendar_handle_t *p_calendar, uint32_t interval)
Set a CALENDAR tick alarm.
struct _calendar_handle calendar_handle_t
CALENDAR handle Structure definition.
uint16_t ms
The milliseconds for the date alarm.
uint8_t min
Specifies the alarm time minutes.
void(* calendar_overflow_callback)(calendar_handle_t *p_calendar)
CALENDAR count overflow callback.
uint8_t mode
Specifies the Calendar alarm mode.
void(* calendar_tick_callback)(calendar_handle_t *p_calendar)
CALENDAR tick count complete callback.
CALENDAR_Time calendar time structure definition.
uint8_t year
Specifies the Calendar year which stars from 2010.
This file contains HAL common definitions, enumeration, macros and structures definitions.