M471M/R1/S BSP V3.01.000
The Board Support Package for M4521
Macros | Functions | Variables
Collaboration diagram for RTC Exported Functions:

Macros

#define RTC_IS_LEAP_YEAR()   (RTC->LEAPYEAR & RTC_LEAPYEAR_LEAPYEAR_Msk ? 1:0)
 Indicate is Leap Year or not. More...
 
#define RTC_CLEAR_ALARM_INT_FLAG()   (RTC->INTSTS = (RTC->INTSTS & ~(RTC_INTSTS_TICKIF_Msk | RTC_INTSTS_SNPDIF_Msk)) | RTC_INTSTS_ALMIF_Msk)
 Clear RTC Alarm Interrupt Flag. More...
 
#define RTC_CLEAR_TICK_INT_FLAG()   (RTC->INTSTS = (RTC->INTSTS & ~(RTC_INTSTS_ALMIF_Msk | RTC_INTSTS_SNPDIF_Msk)) | RTC_INTSTS_TICKIF_Msk)
 Clear RTC Tick Interrupt Flag. More...
 
#define RTC_CLEAR_SNOOPER_INT_FLAG()   (RTC->INTSTS = (RTC->INTSTS & ~(RTC_INTSTS_ALMIF_Msk | RTC_INTSTS_TICKIF_Msk)) | RTC_INTSTS_SNPDIF_Msk)
 Clear RTC Snooper Interrupt Flag. More...
 
#define RTC_GET_ALARM_INT_FLAG()   ((RTC->INTSTS & RTC_INTSTS_ALMIF_Msk)? 1:0)
 Get RTC Alarm Interrupt Flag. More...
 
#define RTC_GET_TICK_INT_FLAG()   ((RTC->INTSTS & RTC_INTSTS_TICKIF_Msk)? 1:0)
 Get RTC Time Tick Interrupt Flag. More...
 
#define RTC_GET_SNPPOER_INT_FLAG()   ((RTC->INTSTS & RTC_INTSTS_SNPDIF_Msk)? 1:0)
 Get RTC Snooper Interrupt Flag. More...
 
#define RTC_READ_SPARE_REGISTER(u32RegNum)   (RTC->SPR[(u32RegNum)])
 Read Spare Register. More...
 
#define RTC_WRITE_SPARE_REGISTER(u32RegNum, u32RegValue)   (RTC->SPR[(u32RegNum)] = (u32RegValue))
 Write Spare Register. More...
 

Functions

static __INLINE int32_t RTC_WaitAccessEnable (void)
 Wait RTC Access Enable. More...
 
int32_t RTC_Open (S_RTC_TIME_DATA_T *sPt)
 Initialize RTC module and start counting. More...
 
void RTC_Close (void)
 Disable RTC Clock. More...
 
void RTC_32KCalibration (int32_t i32FrequencyX100)
 Set 32k Frequency Compensation Data. More...
 
void RTC_GetDateAndTime (S_RTC_TIME_DATA_T *sPt)
 Get Current RTC Date and Time. More...
 
void RTC_GetAlarmDateAndTime (S_RTC_TIME_DATA_T *sPt)
 Get RTC Alarm Date and Time. More...
 
void RTC_SetDateAndTime (S_RTC_TIME_DATA_T *sPt)
 Update Current RTC Date and Time. More...
 
void RTC_SetAlarmDateAndTime (S_RTC_TIME_DATA_T *sPt)
 Update RTC Alarm Date and Time. More...
 
void RTC_SetDate (uint32_t u32Year, uint32_t u32Month, uint32_t u32Day, uint32_t u32DayOfWeek)
 Update RTC Current Date. More...
 
void RTC_SetTime (uint32_t u32Hour, uint32_t u32Minute, uint32_t u32Second, uint32_t u32TimeMode, uint32_t u32AmPm)
 Update RTC Current Time. More...
 
void RTC_SetAlarmDate (uint32_t u32Year, uint32_t u32Month, uint32_t u32Day)
 Update RTC Alarm Date. More...
 
void RTC_SetAlarmTime (uint32_t u32Hour, uint32_t u32Minute, uint32_t u32Second, uint32_t u32TimeMode, uint32_t u32AmPm)
 Update RTC Alarm Time. More...
 
uint32_t RTC_GetDayOfWeek (void)
 Get Day of the Week. More...
 
void RTC_SetTickPeriod (uint32_t u32TickSelection)
 Set RTC Tick Period Time. More...
 
void RTC_EnableInt (uint32_t u32IntFlagMask)
 Enable RTC Interrupt. More...
 
void RTC_DisableInt (uint32_t u32IntFlagMask)
 Disable RTC Interrupt. More...
 
void RTC_EnableSpareAccess (void)
 Enable Spare Registers Access. More...
 
void RTC_DisableSpareRegister (void)
 Disable Spare Register. More...
 
void RTC_EnableSnooperDetection (uint32_t u32PinCondition)
 Enable Snooper Pin Detect. More...
 
void RTC_DisableSnooperDetection (void)
 Disable Snooper Pin Detect. More...
 

Variables

uint32_t S_RTC_TIME_DATA_T::u32Year
 
uint32_t S_RTC_TIME_DATA_T::u32Month
 
uint32_t S_RTC_TIME_DATA_T::u32Day
 
uint32_t S_RTC_TIME_DATA_T::u32DayOfWeek
 
uint32_t S_RTC_TIME_DATA_T::u32Hour
 
uint32_t S_RTC_TIME_DATA_T::u32Minute
 
uint32_t S_RTC_TIME_DATA_T::u32Second
 
uint32_t S_RTC_TIME_DATA_T::u32TimeScale
 
uint32_t S_RTC_TIME_DATA_T::u32AmPm
 

Detailed Description

Macro Definition Documentation

◆ RTC_CLEAR_ALARM_INT_FLAG

#define RTC_CLEAR_ALARM_INT_FLAG ( )    (RTC->INTSTS = (RTC->INTSTS & ~(RTC_INTSTS_TICKIF_Msk | RTC_INTSTS_SNPDIF_Msk)) | RTC_INTSTS_ALMIF_Msk)

Clear RTC Alarm Interrupt Flag.

Parameters
None
Returns
None

This macro is used to clear RTC alarm interrupt flag.

Definition at line 131 of file rtc.h.

◆ RTC_CLEAR_SNOOPER_INT_FLAG

#define RTC_CLEAR_SNOOPER_INT_FLAG ( )    (RTC->INTSTS = (RTC->INTSTS & ~(RTC_INTSTS_ALMIF_Msk | RTC_INTSTS_TICKIF_Msk)) | RTC_INTSTS_SNPDIF_Msk)

Clear RTC Snooper Interrupt Flag.

Parameters
None
Returns
None

This macro is used to clear RTC snooper pin interrupt flag.

Definition at line 153 of file rtc.h.

◆ RTC_CLEAR_TICK_INT_FLAG

#define RTC_CLEAR_TICK_INT_FLAG ( )    (RTC->INTSTS = (RTC->INTSTS & ~(RTC_INTSTS_ALMIF_Msk | RTC_INTSTS_SNPDIF_Msk)) | RTC_INTSTS_TICKIF_Msk)

Clear RTC Tick Interrupt Flag.

Parameters
None
Returns
None

This macro is used to clear RTC tick interrupt flag.

Definition at line 142 of file rtc.h.

◆ RTC_GET_ALARM_INT_FLAG

#define RTC_GET_ALARM_INT_FLAG ( )    ((RTC->INTSTS & RTC_INTSTS_ALMIF_Msk)? 1:0)

Get RTC Alarm Interrupt Flag.

Parameters
None
Return values
0RTC alarm interrupt did not occur
1RTC alarm interrupt occurred

This macro indicates RTC alarm interrupt occurred or not.

Definition at line 165 of file rtc.h.

◆ RTC_GET_SNPPOER_INT_FLAG

#define RTC_GET_SNPPOER_INT_FLAG ( )    ((RTC->INTSTS & RTC_INTSTS_SNPDIF_Msk)? 1:0)

Get RTC Snooper Interrupt Flag.

Parameters
None
Return values
0RTC snooper pin interrupt did not occur
1RTC snooper pin interrupt occurred

This macro indicates RTC snooper pin interrupt occurred or not.

Definition at line 189 of file rtc.h.

◆ RTC_GET_TICK_INT_FLAG

#define RTC_GET_TICK_INT_FLAG ( )    ((RTC->INTSTS & RTC_INTSTS_TICKIF_Msk)? 1:0)

Get RTC Time Tick Interrupt Flag.

Parameters
None
Return values
0RTC time tick interrupt did not occur
1RTC time tick interrupt occurred

This macro indicates RTC time tick interrupt occurred or not.

Definition at line 177 of file rtc.h.

◆ RTC_IS_LEAP_YEAR

#define RTC_IS_LEAP_YEAR ( )    (RTC->LEAPYEAR & RTC_LEAPYEAR_LEAPYEAR_Msk ? 1:0)

Indicate is Leap Year or not.

Parameters
None
Return values
0This year is not a leap year
1This year is a leap year

According to current date, return this year is leap year or not.

Definition at line 120 of file rtc.h.

◆ RTC_READ_SPARE_REGISTER

#define RTC_READ_SPARE_REGISTER (   u32RegNum)    (RTC->SPR[(u32RegNum)])

Read Spare Register.

Parameters
[in]u32RegNumThe spare register number, 0~19.
Returns
Spare register content

Read the specify spare register content.

Note
The returned value is valid only when SPRRDY(SPRCTL[7] SPR Register Ready) bit is set.
And its controlled by RTC Access Enable Register.

Definition at line 202 of file rtc.h.

◆ RTC_WRITE_SPARE_REGISTER

#define RTC_WRITE_SPARE_REGISTER (   u32RegNum,
  u32RegValue 
)    (RTC->SPR[(u32RegNum)] = (u32RegValue))

Write Spare Register.

Parameters
[in]u32RegNumThe spare register number, 0~19.
[in]u32RegValueThe spare register value.
Returns
None

Write specify data to spare register.

Note
This macro is effect only when SPRRDY(SPRCTL[7] SPR Register Ready) bit is set.
And its controlled by RTC Access Enable Register(RTC_RWEN).

Definition at line 216 of file rtc.h.

Function Documentation

◆ RTC_32KCalibration()

void RTC_32KCalibration ( int32_t  i32FrequencyX100)

Set 32k Frequency Compensation Data.

Parameters
[in]i32FrequencyX100Specify the RTC clock X100, ex: 3277365 means 32773.65.
Returns
None

This API is used to compensate the 32 kHz frequency by current LXT frequency for RTC application.

Definition at line 121 of file rtc.c.

Here is the call graph for this function:

◆ RTC_Close()

void RTC_Close ( void  )

Disable RTC Clock.

Parameters
None
Returns
None

This API will disable RTC peripheral clock and stops RTC counting.

Definition at line 107 of file rtc.c.

◆ RTC_DisableInt()

void RTC_DisableInt ( uint32_t  u32IntFlagMask)

Disable RTC Interrupt.

Parameters
[in]u32IntFlagMaskSpecify the interrupt source. It consists of:
RTC_INTEN_ALMIEN_Msk: Alarm interrupt
RTC_INTEN_TICKIEN_Msk: Tick interrupt
RTC_INTEN_SNPDIEN_Msk: Snooper Pin Event Detection interrupt
Returns
None

This API is used to disable the specify RTC interrupt function.

Definition at line 702 of file rtc.c.

◆ RTC_DisableSnooperDetection()

void RTC_DisableSnooperDetection ( void  )

Disable Snooper Pin Detect.

Parameters
None
Returns
None

This API is used to disable the snooper pin detect function.

Definition at line 786 of file rtc.c.

Here is the call graph for this function:

◆ RTC_DisableSpareRegister()

void RTC_DisableSpareRegister ( void  )

Disable Spare Register.

Parameters
None
Returns
None

This API is used to disable the spare register 0~19 cannot be accessed.

Definition at line 750 of file rtc.c.

Here is the call graph for this function:

◆ RTC_EnableInt()

void RTC_EnableInt ( uint32_t  u32IntFlagMask)

Enable RTC Interrupt.

Parameters
[in]u32IntFlagMaskSpecify the interrupt source. It consists of:
RTC_INTEN_ALMIEN_Msk: Alarm interrupt
RTC_INTEN_TICKIEN_Msk: Tick interrupt
RTC_INTEN_SNPDIEN_Msk: Snooper Pin Event Detection interrupt
Returns
None

This API is used to enable the specify RTC interrupt function.

Definition at line 685 of file rtc.c.

◆ RTC_EnableSnooperDetection()

void RTC_EnableSnooperDetection ( uint32_t  u32PinCondition)

Enable Snooper Pin Detect.

Parameters
[in]u32PinConditionSnooper pin trigger condition. Possible options are
Returns
None

This API is used to enable the snooper pin detect function with specify trigger condition.

Definition at line 770 of file rtc.c.

Here is the call graph for this function:

◆ RTC_EnableSpareAccess()

void RTC_EnableSpareAccess ( void  )

Enable Spare Registers Access.

Parameters
None
Returns
None

This API is used to enable the spare registers 0~19 can be accessed.

Definition at line 732 of file rtc.c.

Here is the call graph for this function:

◆ RTC_GetAlarmDateAndTime()

void RTC_GetAlarmDateAndTime ( S_RTC_TIME_DATA_T sPt)

Get RTC Alarm Date and Time.

Parameters
[out]sPtThe returned pointer is specified the RTC alarm value. It includes:
u32Year: Year value
u32Month: Month value
u32Day: Day value
u32DayOfWeek: Day of week
u32Hour: Hour value
u32Minute: Minute value
u32Second: Second value
u32TimeScale: [RTC_CLOCK_12 / RTC_CLOCK_24]
u8AmPm: [RTC_AM / RTC_PM]
Returns
None

This API is used to get the RTC alarm date and time setting.

Definition at line 252 of file rtc.c.

Here is the call graph for this function:

◆ RTC_GetDateAndTime()

void RTC_GetDateAndTime ( S_RTC_TIME_DATA_T sPt)

Get Current RTC Date and Time.

Parameters
[out]sPtThe returned pointer is specified the current RTC value. It includes:
u32Year: Year value
u32Month: Month value
u32Day: Day value
u32DayOfWeek: Day of week
u32Hour: Hour value
u32Minute: Minute value
u32Second: Second value
u32TimeScale: [RTC_CLOCK_12 / RTC_CLOCK_24]
u8AmPm: [RTC_AM / RTC_PM]
Returns
None

This API is used to get the current RTC date and time value.

Definition at line 157 of file rtc.c.

◆ RTC_GetDayOfWeek()

uint32_t RTC_GetDayOfWeek ( void  )

Get Day of the Week.

Parameters
None
Return values
0Sunday
1Monday
2Tuesday
3Wednesday
4Thursday
5Friday
6Saturday

This API is used to get day of the week of current RTC date.

Definition at line 643 of file rtc.c.

◆ RTC_Open()

int32_t RTC_Open ( S_RTC_TIME_DATA_T sPt)

Initialize RTC module and start counting.

Parameters
[in]sPtSpecify the time property and current date and time. It includes:
u32Year: Year value, range between 2000 ~ 2099.
u32Month: Month value, range between 1 ~ 12.
u32Day: Day value, range between 1 ~ 31.
u32DayOfWeek: Day of the week. [RTC_SUNDAY / RTC_MONDAY / RTC_TUESDAY / RTC_WEDNESDAY / RTC_THURSDAY / RTC_FRIDAY / RTC_SATURDAY]
u32Hour: Hour value, range between 0 ~ 23.
u32Minute: Minute value, range between 0 ~ 59.
u32Second: Second value, range between 0 ~ 59.
u32TimeScale: [RTC_CLOCK_12 / RTC_CLOCK_24]
u8AmPm: [RTC_AM / RTC_PM]
Return values
0SUCCESS
-1Initialize RTC module fail

This function is used to:

  1. Write initial key to let RTC start count.
  2. Input parameter indicates start date/time.
  3. User has to make sure that parameters of RTC date/time are reasonable.
    Note
    Null pointer for using default starting date/time.

Definition at line 66 of file rtc.c.

Here is the call graph for this function:

◆ RTC_SetAlarmDate()

void RTC_SetAlarmDate ( uint32_t  u32Year,
uint32_t  u32Month,
uint32_t  u32Day 
)

Update RTC Alarm Date.

Parameters
[in]u32YearThe year calendar digit of RTC alarm setting.
[in]u32MonthThe month calendar digit of RTC alarm setting.
[in]u32DayThe day calendar digit of RTC alarm setting.
Returns
None

This API is used to update alarm date setting to RTC.

Definition at line 566 of file rtc.c.

Here is the call graph for this function:

◆ RTC_SetAlarmDateAndTime()

void RTC_SetAlarmDateAndTime ( S_RTC_TIME_DATA_T sPt)

Update RTC Alarm Date and Time.

Parameters
[in]sPtSpecify the time property and alarm date and time. It includes:
u32Year: Year value, range between 2000 ~ 2099.
u32Month: Month value, range between 1 ~ 12.
u32Day: Day value, range between 1 ~ 31.
u32DayOfWeek: Day of the week. [RTC_SUNDAY / RTC_MONDAY / RTC_TUESDAY / RTC_WEDNESDAY / RTC_THURSDAY / RTC_FRIDAY / RTC_SATURDAY]
u32Hour: Hour value, range between 0 ~ 23.
u32Minute: Minute value, range between 0 ~ 59.
u32Second: Second value, range between 0 ~ 59.
u32TimeScale: [RTC_CLOCK_12 / RTC_CLOCK_24]
u8AmPm: [RTC_AM / RTC_PM]
Returns
None

This API is used to update alarm date and time setting to RTC.

Definition at line 426 of file rtc.c.

Here is the call graph for this function:

◆ RTC_SetAlarmTime()

void RTC_SetAlarmTime ( uint32_t  u32Hour,
uint32_t  u32Minute,
uint32_t  u32Second,
uint32_t  u32TimeMode,
uint32_t  u32AmPm 
)

Update RTC Alarm Time.

Parameters
[in]u32HourThe hour time digit of RTC alarm setting.
[in]u32MinuteThe minute time digit of RTC alarm setting.
[in]u32SecondThe second time digit of RTC alarm setting.
[in]u32TimeModeThe 24-Hour / 12-Hour Time Scale Selection. [RTC_CLOCK_12 / RTC_CLOCK_24]
[in]u32AmPm12-hour time scale with AM and PM indication. Only Time Scale select 12-hour used. [RTC_AM / RTC_PM]
Returns
None

This API is used to update alarm time setting to RTC.

Definition at line 596 of file rtc.c.

Here is the call graph for this function:

◆ RTC_SetDate()

void RTC_SetDate ( uint32_t  u32Year,
uint32_t  u32Month,
uint32_t  u32Day,
uint32_t  u32DayOfWeek 
)

Update RTC Current Date.

Parameters
[in]u32YearThe year calendar digit of current RTC setting.
[in]u32MonthThe month calendar digit of current RTC setting.
[in]u32DayThe day calendar digit of current RTC setting.
[in]u32DayOfWeekThe Day of the week. [RTC_SUNDAY / RTC_MONDAY / RTC_TUESDAY / RTC_WEDNESDAY / RTC_THURSDAY / RTC_FRIDAY / RTC_SATURDAY]
Returns
None

This API is used to update current date to RTC.

Definition at line 491 of file rtc.c.

Here is the call graph for this function:

◆ RTC_SetDateAndTime()

void RTC_SetDateAndTime ( S_RTC_TIME_DATA_T sPt)

Update Current RTC Date and Time.

Parameters
[in]sPtSpecify the time property and current date and time. It includes:
u32Year: Year value, range between 2000 ~ 2099.
u32Month: Month value, range between 1 ~ 12.
u32Day: Day value, range between 1 ~ 31.
u32DayOfWeek: Day of the week. [RTC_SUNDAY / RTC_MONDAY / RTC_TUESDAY / RTC_WEDNESDAY / RTC_THURSDAY / RTC_FRIDAY / RTC_SATURDAY]
u32Hour: Hour value, range between 0 ~ 23.
u32Minute: Minute value, range between 0 ~ 59.
u32Second: Second value, range between 0 ~ 59.
u32TimeScale: [RTC_CLOCK_12 / RTC_CLOCK_24]
u8AmPm: [RTC_AM / RTC_PM]
Returns
None

This API is used to update current date and time to RTC.

Definition at line 352 of file rtc.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ RTC_SetTickPeriod()

void RTC_SetTickPeriod ( uint32_t  u32TickSelection)

Set RTC Tick Period Time.

Parameters
[in]u32TickSelectionIt is used to set the RTC tick period time for Periodic Time Tick request.
It consists of:
RTC_TICK_1_SEC: Time tick is 1 second
RTC_TICK_1_2_SEC: Time tick is 1/2 second
RTC_TICK_1_4_SEC: Time tick is 1/4 second
RTC_TICK_1_8_SEC: Time tick is 1/8 second
RTC_TICK_1_16_SEC: Time tick is 1/16 second
RTC_TICK_1_32_SEC: Time tick is 1/32 second
RTC_TICK_1_64_SEC: Time tick is 1/64 second
RTC_TICK_1_128_SEC: Time tick is 1/128 second
Returns
None

This API is used to set RTC tick period time for each tick interrupt.

Definition at line 666 of file rtc.c.

Here is the call graph for this function:

◆ RTC_SetTime()

void RTC_SetTime ( uint32_t  u32Hour,
uint32_t  u32Minute,
uint32_t  u32Second,
uint32_t  u32TimeMode,
uint32_t  u32AmPm 
)

Update RTC Current Time.

Parameters
[in]u32HourThe hour time digit of current RTC setting.
[in]u32MinuteThe minute time digit of current RTC setting.
[in]u32SecondThe second time digit of current RTC setting.
[in]u32TimeModeThe 24-Hour / 12-Hour Time Scale Selection. [RTC_CLOCK_12 / RTC_CLOCK_24]
[in]u32AmPm12-hour time scale with AM and PM indication. Only Time Scale select 12-hour used. [RTC_AM / RTC_PM]
Returns
None

This API is used to update current time to RTC.

Definition at line 524 of file rtc.c.

Here is the call graph for this function:

◆ RTC_WaitAccessEnable()

static __INLINE int32_t RTC_WaitAccessEnable ( void  )
static

Wait RTC Access Enable.

Parameters
None
Return values
0RTC is unaccessable
1RTC is accessable

This function is used to enable the maximum RTC read/write accessible time.

Definition at line 228 of file rtc.h.

Here is the caller graph for this function:

Variable Documentation

◆ u32AmPm

uint32_t S_RTC_TIME_DATA_T::u32AmPm

Only Time Scale select 12-hr used

Definition at line 100 of file rtc.h.

◆ u32Day

uint32_t S_RTC_TIME_DATA_T::u32Day

Day value

Definition at line 94 of file rtc.h.

◆ u32DayOfWeek

uint32_t S_RTC_TIME_DATA_T::u32DayOfWeek

Day of week value

Definition at line 95 of file rtc.h.

◆ u32Hour

uint32_t S_RTC_TIME_DATA_T::u32Hour

Hour value

Definition at line 96 of file rtc.h.

◆ u32Minute

uint32_t S_RTC_TIME_DATA_T::u32Minute

Minute value

Definition at line 97 of file rtc.h.

◆ u32Month

uint32_t S_RTC_TIME_DATA_T::u32Month

Month value

Definition at line 93 of file rtc.h.

◆ u32Second

uint32_t S_RTC_TIME_DATA_T::u32Second

Second value

Definition at line 98 of file rtc.h.

◆ u32TimeScale

uint32_t S_RTC_TIME_DATA_T::u32TimeScale

12-Hour, 24-Hour

Definition at line 99 of file rtc.h.

◆ u32Year

uint32_t S_RTC_TIME_DATA_T::u32Year

Year value

Definition at line 92 of file rtc.h.