Go to the documentation of this file.
52 #ifndef __GR55xx_HAL_CALENDAR_H__
53 #define __GR55xx_HAL_CALENDAR_H__
213 #define CALENDAR_IT_ALARM AON_CALENDAR_TIMER_CTL_ALARM_INT_EN
214 #define CALENDAR_IT_WARP AON_CALENDAR_TIMER_CTL_WRAP_INT_EN
220 #define CALENDAR_FLAG_ALARM AON_SLP_EVENT_CALENDAR_TIMER_ALARM
221 #define CALENDAR_FLAG_WARP AON_SLP_EVENT_CALENDAR_TIMER_WRAP
227 #define CALENDAR_ALARM_SEL_DATE (0UL)
228 #define CALENDAR_ALARM_SEL_WEEKDAY (1UL)
234 #define CALENDAR_ALARM_WEEKDAY_SUN (0x01ul)
235 #define CALENDAR_ALARM_WEEKDAY_MON (0x02ul)
236 #define CALENDAR_ALARM_WEEKDAY_TUE (0x04ul)
237 #define CALENDAR_ALARM_WEEKDAY_WED (0x08ul)
238 #define CALENDAR_ALARM_WEEKDAY_THU (0x10ul)
239 #define CALENDAR_ALARM_WEEKDAY_FRI (0x20ul)
240 #define CALENDAR_ALARM_WEEKDAY_SAT (0x40ul)
246 #define CALENDAR_ALARM_DISABLE_DATE (1UL)
247 #define CALENDAR_ALARM_DISABLE_TICK (2UL)
248 #define CALENDAR_ALARM_DISABLE_ALL ((CALENDAR_ALARM_DISABLE_DATE) | CALENDAR_ALARM_DISABLE_TICK)
261 #define __HAL_CALENDAR_ENABLE() SET_BITS(AON->CALENDAR_TIMER_CTL, AON_CALENDAR_TIMER_CTL_EN)
266 #define __HAL_CALENDAR_DISABLE() CLEAR_BITS(AON->CALENDAR_TIMER_CTL, AON_CALENDAR_TIMER_CTL_EN)
275 #define __HAL_CALENDAR_ENABLE_IT(__INTERRUPT__) SET_BITS(AON->CALENDAR_TIMER_CTL, (__INTERRUPT__))
284 #define __HAL_CALENDAR_DISABLE_IT(__INTERRUPT__) CLEAR_BITS(AON->CALENDAR_TIMER_CTL, (__INTERRUPT__))
293 #define __HAL_CALENDAR_GET_IT_SOURCE(__FLAG__) (READ_BITS(AON->SLP_EVENT, (__FLAG__)) == (__FLAG__))
302 #define __HAL_CALENDAR_CLEAR_FLAG(__FLAG__) WRITE_REG(AON->SLP_EVENT, ~(__FLAG__))
315 #define IS_CALENDAR_ALARM_TYPE(__TYPE__) (((__TYPE__) == CALENDAR_ALARM_SEL_DATE) || \
316 ((__TYPE__) == CALENDAR_ALARM_SEL_WEEKDAY))
322 #define IS_CALENDAR_DATE(__DATE__) (((__DATE__) > 0) && ((__DATE__) <= 31))
328 #define IS_CALENDAR_WEEKDAY(__WEEKDAY__) (((__WEEKDAY__) >= 0) && ((__WEEKDAY__) <= 6))
334 #define IS_CALENDAR_LEAP_YEAR(__YEAR__) ((((__YEAR__) % 4) == 0 && ((__YEAR__) % 100) != 0) || \
335 ((__YEAR__) % 400) == 0)
uint8_t sec
Definition: gr55xx_hal_calendar.h:97
uint8_t alarm_date_week_mask
Definition: gr55xx_hal_calendar.h:136
uint8_t date
Definition: gr55xx_hal_calendar.h:106
uint8_t min
Definition: gr55xx_hal_calendar.h:100
struct _calendar_alarm calendar_alarm_t
CALENDAR_Alarm calendar alarm structure definition.
hal_lock_t
HAL Lock structures definition.
Definition: gr55xx_hal_def.h:81
struct _calendar_time calendar_time_t
CALENDAR_Time calendar time structure definition.
hal_calender_state_t state
Definition: gr55xx_hal_calendar.h:169
@ HAL_CALENDAR_STATE_ERROR
Definition: gr55xx_hal_calendar.h:78
uint8_t hour
Definition: gr55xx_hal_calendar.h:103
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
Definition: gr55xx_hal_calendar.h:118
hal_calender_state_t
HAL CALENDAR State Enumerations definition.
Definition: gr55xx_hal_calendar.h:75
void hal_calendar_tick_callback(calendar_handle_t *p_calendar)
CALENDAR milliseconds count complete callback.
calendar_time_t time_init
Definition: gr55xx_hal_calendar.h:153
@ HAL_CALENDAR_STATE_RESET
Definition: gr55xx_hal_calendar.h:76
uint8_t mon
Definition: gr55xx_hal_calendar.h:109
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)
Definition: gr55xx_hal_calendar.h:190
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.
Definition: gr55xx_hal_calendar.h:152
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
Definition: gr55xx_hal_calendar.h:159
uint8_t alarm_sel
Definition: gr55xx_hal_calendar.h:133
hal_lock_t lock
Definition: gr55xx_hal_calendar.h:157
calendar_alarm_t alarm
Definition: gr55xx_hal_calendar.h:155
uint8_t week
Definition: gr55xx_hal_calendar.h:115
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
Definition: gr55xx_hal_calendar.h:165
uint32_t interval
Definition: gr55xx_hal_calendar.h:161
CALENDAR_Alarm calendar alarm structure definition.
Definition: gr55xx_hal_calendar.h:126
hal_status_t
HAL Status structures definition.
Definition: gr55xx_hal_def.h:70
@ HAL_CALENDAR_STATE_READY
Definition: gr55xx_hal_calendar.h:77
uint8_t hour
Definition: gr55xx_hal_calendar.h:130
void hal_calendar_overflow_callback(calendar_handle_t *p_calendar)
CALENDAR overflow callback.
HAL_CALENDAR Callback function definition.
Definition: gr55xx_hal_calendar.h:189
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
Definition: gr55xx_hal_calendar.h:167
uint8_t min
Definition: gr55xx_hal_calendar.h:127
void(* calendar_overflow_callback)(calendar_handle_t *p_calendar)
Definition: gr55xx_hal_calendar.h:192
uint8_t mode
Definition: gr55xx_hal_calendar.h:163
void(* calendar_tick_callback)(calendar_handle_t *p_calendar)
Definition: gr55xx_hal_calendar.h:191
void calendar_irq_handler(calendar_handle_t *p_calendar)
Handle CALENDAR interrupt request.
CALENDAR_Time calendar time structure definition.
Definition: gr55xx_hal_calendar.h:96
uint8_t year
Definition: gr55xx_hal_calendar.h:112
This file contains HAL common definitions, enumeration, macros and structures definitions.