| NANO100_BSP V3.05.000 The Board Support Package for Nano100BN Series

Macros | Functions | Variables
RTC Exported Functions
NANO100 Device Driver » RTC Driver » RTC Exported Constants » RTC Exported Structs
Collaboration diagram for RTC Exported Functions:

## Macros
#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...
#define | RTC_IS_LEAP_YEAR() ((RTC->LIR & (RTC_LIR_LIR_Msk))?1:0)
| According to current time, return this year is leap year or not. More...
#define | RTC_CLEAR_ALARM_INT_FLAG() (RTC->RIIR = RTC_RIIR_AIF_Msk)
| Clear alarm interrupt status. More...
#define | RTC_CLEAR_TICK_INT_FLAG() (RTC->RIIR = RTC_RIIR_TIF_Msk)
| Clear tick interrupt status. More...
#define | RTC_CLEAR_TAMPER_FLAG(u32PinNum) (RTC->RIIR = RTC_RIIR_SNOOPIF_Msk)
| Clear tamper detect pin status. More...
#define | RTC_GET_ALARM_INT_FLAG() ((RTC->RIIR & RTC_RIIR_AIF_Msk) >> RTC_RIIR_AIF_Pos)
| Get alarm interrupt status. More...
#define | RTC_GET_TICK_INT_FLAG() ((RTC->RIIR & RTC_RIIR_TIF_Msk) >> RTC_RIIR_TIF_Pos)
| Get alarm interrupt status. More...
#define | RTC_GET_TAMPER_FLAG() ( (RTC->RIIR & RTC_RIIR_SNOOPIF_Msk) >> RTC_RIIR_SNOOPIF_Pos)
| Get tamper detect pin status. More...
#define | RTC_ENABLE_TICK_WAKEUP() (RTC->TTR |= RTC_TTR_TWKE_Msk);
| Enable Timer tick wakeup function. More...
#define | RTC_DISABLE_TICK_WAKEUP() (RTC->TTR &= ~RTC_TTR_TWKE_Msk);
| Disable Timer tick wakeup function. More...

## Functions
void | RTC_Open (S_RTC_TIME_DATA_T *sPt)
| This function is used to write initial key to let RTC start count and set current time. More...
void | RTC_Close (void)
| Disable RTC clock. More...
void | RTC_32KCalibration (int32_t i32FrequencyX100)
| Set Frequency Compensation Data. More...
void | RTC_SetTickPeriod (uint32_t u32TickSelection)
| The function is used to set time tick period for periodic time tick Interrupt. More...
void | RTC_EnableInt (uint32_t u32IntFlagMask)
| The function is used to enable specified interrupt. More...
void | RTC_DisableInt (uint32_t u32IntFlagMask)
| The function is used to disable specified interrupt. More...
uint32_t | RTC_GetDayOfWeek (void)
| This function is used to get day of week. More...
void | RTC_DisableTamperDetection (void)
| This function is used to disable tamper detection function. More...
void | RTC_EnableTamperDetection (uint32_t u32PinCondition)
| This function is used to enable tamper detection function and set tamper control register, interrupt. More...
void | RTC_SetAlarmTime (uint32_t u32Hour, uint32_t u32Minute, uint32_t u32Second, uint32_t u32TimeMode, uint32_t u32AmPm)
| This function is used to set alarm date to RTC. More...
void | RTC_SetAlarmDate (uint32_t u32Year, uint32_t u32Month, uint32_t u32Day)
| This function is used to set alarm date to RTC. More...
void | RTC_SetTime (uint32_t u32Hour, uint32_t u32Minute, uint32_t u32Second, uint32_t u32TimeMode, uint32_t u32AmPm)
| This function is used to update time to RTC. More...
void | RTC_SetDate (uint32_t u32Year, uint32_t u32Month, uint32_t u32Day, uint32_t u32DayOfWeek)
| This function is used to update date to RTC. More...
void | RTC_SetAlarmDateAndTime (S_RTC_TIME_DATA_T *sPt)
| This function is used to set alarm date/time to RTC. More...
void | RTC_SetDateAndTime (S_RTC_TIME_DATA_T *sPt)
| This function is used to update date/time to RTC. More...
void | RTC_GetAlarmDateAndTime (S_RTC_TIME_DATA_T *sPt)
| Read alarm date/time from RTC setting. More...
void | RTC_GetDateAndTime (S_RTC_TIME_DATA_T *sPt)
| Read current date/time from RTC setting. 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->RIIR = RTC_RIIR_AIF_Msk)

Clear alarm interrupt status.

Parameters

  None |

Returns
  None

Definition at line 142 of file rtc.h.

## ◆ RTC_CLEAR_TAMPER_FLAG

#define RTC_CLEAR_TAMPER_FLAG | ( |  | u32PinNum | ) | (RTC->RIIR = RTC_RIIR_SNOOPIF_Msk)

Clear tamper detect pin status.

Parameters

  [in] | u32PinNum | tamper detect pin number.

Returns
  None

Definition at line 162 of file rtc.h.

## ◆ RTC_CLEAR_TICK_INT_FLAG

#define RTC_CLEAR_TICK_INT_FLAG | ( |  | ) | (RTC->RIIR = RTC_RIIR_TIF_Msk)

Clear tick interrupt status.

Parameters

  None |

Returns
  None

Definition at line 152 of file rtc.h.

## ◆ RTC_DISABLE_TICK_WAKEUP

#define RTC_DISABLE_TICK_WAKEUP | ( |  | ) | (RTC->TTR &= ~RTC_TTR_TWKE_Msk);

Disable Timer tick wakeup function.

Parameters

  None |

Returns
  None

Definition at line 213 of file rtc.h.

## ◆ RTC_ENABLE_TICK_WAKEUP

#define RTC_ENABLE_TICK_WAKEUP | ( |  | ) | (RTC->TTR |= RTC_TTR_TWKE_Msk);

Enable Timer tick wakeup function.

Parameters

  None |

Returns
  None

Definition at line 203 of file rtc.h.

## ◆ RTC_GET_ALARM_INT_FLAG

#define RTC_GET_ALARM_INT_FLAG | ( |  | ) | ((RTC->RIIR & RTC_RIIR_AIF_Msk) >> RTC_RIIR_AIF_Pos)

Get alarm interrupt status.

Parameters

  None |

Returns
  Alarm interrupt status

Definition at line 172 of file rtc.h.

## ◆ RTC_GET_TAMPER_FLAG

#define RTC_GET_TAMPER_FLAG | ( |  | ) | ( (RTC->RIIR & RTC_RIIR_SNOOPIF_Msk) >> RTC_RIIR_SNOOPIF_Pos)

Get tamper detect pin status.

Parameters

  None |

Returns
  1: Snooper Pin Event Detected
  0: Snooper Pin Event Never Detected

Definition at line 193 of file rtc.h.

## ◆ RTC_GET_TICK_INT_FLAG

#define RTC_GET_TICK_INT_FLAG | ( |  | ) | ((RTC->RIIR & RTC_RIIR_TIF_Msk) >> RTC_RIIR_TIF_Pos)

Get alarm interrupt status.

Parameters

  None |

Returns
  Alarm interrupt status

Definition at line 182 of file rtc.h.

## ◆ RTC_IS_LEAP_YEAR

#define RTC_IS_LEAP_YEAR | ( |  | ) | ((RTC->LIR & (RTC_LIR_LIR_Msk))?1:0)

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

Parameters

  None |

Returns
  0 = This year is not a leap year.
  1 = This year is a leap year.

Definition at line 132 of file rtc.h.

## ◆ RTC_READ_SPARE_REGISTER

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

Read spare register.

Parameters

  [in] | u32RegNum | The spare register number(0~23)

Returns
  Spare register content.

Definition at line 110 of file rtc.h.

## ◆ RTC_WRITE_SPARE_REGISTER

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

Write spare register.

Parameters

  [in] | u32RegNum | The spare register number(0~23)
  [in] | u32RegValue | The spare register value

Returns
  None

Definition at line 121 of file rtc.h.

## Function Documentation

## ◆ RTC_32KCalibration()

void RTC_32KCalibration | ( | int32_t | i32FrequencyX100 | ) |

Set Frequency Compensation Data.

Parameters

  [in] | i32FrequencyX100 | Specify the RTC clock X100, ex: 3277365 means 32773.65.

Returns
  None

Definition at line 58 of file rtc.c.

## ◆ RTC_Close()

void RTC_Close | ( | void |  | ) |

Disable RTC clock.

Returns
  None

Definition at line 943 of file rtc.c.

## ◆ RTC_DisableInt()

void RTC_DisableInt | ( | uint32_t | u32IntFlagMask | ) |

The function is used to disable specified interrupt.

Parameters

  [in] | u32IntFlagMask | The structure of interrupt source. It consists of: RTC_RIER_AIER_Msk : Alarm interrupt RTC_RIER_TIER_Msk : Tick interrupt RTC_RIER_SNOOPIER_Msk : Snooper Pin Event Detection Interrupt

Returns
  None

Definition at line 907 of file rtc.c.

## ◆ RTC_DisableTamperDetection()

void RTC_DisableTamperDetection | ( | void |  | ) |

This function is used to disable tamper detection function.

Parameters

  None |

Returns
  None

Definition at line 811 of file rtc.c.

## ◆ RTC_EnableInt()

void RTC_EnableInt | ( | uint32_t | u32IntFlagMask | ) |

The function is used to enable specified interrupt.

Parameters

  [in] | u32IntFlagMask | The structure of interrupt source. It consists of: RTC_RIER_AIER_Msk : Alarm interrupt RTC_RIER_TIER_Msk : Tick interrupt RTC_RIER_SNOOPIER_Msk : Snooper Pin Event Detection Interrupt

Returns
  None

Definition at line 882 of file rtc.c.

## ◆ RTC_EnableTamperDetection()

void RTC_EnableTamperDetection | ( | uint32_t | u32PinCondition | ) |

This function is used to enable tamper detection function and set tamper control register, interrupt.

Parameters

  [in] | u32PinCondition | set tamper detection condition: 1=Falling detect, 0=Rising detect

Returns
  None

Definition at line 773 of file rtc.c.

## ◆ RTC_GetAlarmDateAndTime()

void RTC_GetAlarmDateAndTime | ( | S_RTC_TIME_DATA_T * | sPt | ) |

Read alarm date/time from RTC setting.

Parameters

  [out] | sPt | Specify the time property and current time. 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

Definition at line 312 of file rtc.c.

## ◆ RTC_GetDateAndTime()

void RTC_GetDateAndTime | ( | S_RTC_TIME_DATA_T * | sPt | ) |

Read current date/time from RTC setting.

Parameters

  [out] | sPt | Specify the time property and current time. 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

Definition at line 219 of file rtc.c.

## ◆ RTC_GetDayOfWeek()

uint32_t RTC_GetDayOfWeek | ( | void |  | ) |

This function is used to get day of week.

Parameters

  None |

Returns
  Day of week

Definition at line 833 of file rtc.c.

## ◆ RTC_Open()

void RTC_Open | ( | S_RTC_TIME_DATA_T * | sPt | ) |

This function is used to write initial key to let RTC start count and set current time.

Parameters

  [in] | sPt | Specify the time property and current time. Null pointer for using default starting time. It includes: u32Year: Year value. u32Month: Month value. u32Day: Day value. u32DayOfWeek: Day of week. [ RTC_SUNDAY / RTC_MONDAY / RTC_TUESDAY / RTC_WEDNESDAY / RTC_THURSDAY / RTC_FRIDAY / RTC_SATURDAY] u32Hour: Hour value. u32Minute: Minute value. u32Second: Second value. u32TimeScale: [ RTC_CLOCK_12 / RTC_CLOCK_24] u8AmPm: [ RTC_AM / RTC_PM]

Returns
  None

Definition at line 104 of file rtc.c.

## ◆ RTC_SetAlarmDate()

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

This function is used to set alarm date to RTC.

Parameters

  [in] | u32Year | The Year Calendar Digit of Alarm Setting
  [in] | u32Month | The Month Calendar Digit of Alarm Setting
  [in] | u32Day | The Day Calendar Digit of Alarm Setting

Returns
  None

Definition at line 677 of file rtc.c.

## ◆ RTC_SetAlarmDateAndTime()

void RTC_SetAlarmDateAndTime | ( | S_RTC_TIME_DATA_T * | sPt | ) |

This function is used to set alarm date/time to RTC.

Parameters

  [in] | sPt | Specify the time property and current time. It includes: u32Year: Year value. u32Month: Month value. u32Day: Day value. u32DayOfWeek: Day of week. [ RTC_SUNDAY / RTC_MONDAY / RTC_TUESDAY / RTC_WEDNESDAY / RTC_THURSDAY / RTC_FRIDAY / RTC_SATURDAY] u32Hour: Hour value. u32Minute: Minute value. u32Second: Second value. u32TimeScale: [ RTC_CLOCK_12 / RTC_CLOCK_24] u8AmPm: [ RTC_AM / RTC_PM]

Returns
  None

Definition at line 504 of file rtc.c.

## ◆ RTC_SetAlarmTime()

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

This function is used to set alarm date to RTC.

Parameters

  [in] | u32Hour | The Hour Time Digit of Alarm Setting.
  [in] | u32Minute | The Month Calendar Digit of Alarm Setting
  [in] | u32Second | The Day Calendar Digit of Alarm Setting
  [in] | u32TimeMode | The 24-Hour / 12-Hour Time Scale Selection. [ RTC_CLOCK_12 / RTC_CLOCK_24]
  [in] | u32AmPm | 12-hour time scale with AM and PM indication. Only Time Scale select 12-hour used. [ RTC_AM / RTC_PM]

Returns
  None

Definition at line 720 of file rtc.c.

## ◆ RTC_SetDate()

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

This function is used to update date to RTC.

Parameters

  [in] | u32Year | The Year Calendar Digit of Alarm Setting
  [in] | u32Month | The Month Calendar Digit of Alarm Setting
  [in] | u32Day | The Day Calendar Digit of Alarm Setting
  [in] | u32DayOfWeek | The Day of Week. [ RTC_SUNDAY / RTC_MONDAY / RTC_TUESDAY / RTC_WEDNESDAY / RTC_THURSDAY / RTC_FRIDAY / RTC_SATURDAY]

Returns
  None

Definition at line 581 of file rtc.c.

## ◆ RTC_SetDateAndTime()

void RTC_SetDateAndTime | ( | S_RTC_TIME_DATA_T * | sPt | ) |

This function is used to update date/time to RTC.

Parameters

  [in] | sPt | Specify the time property and current time. It includes: u32Year: Year value. u32Month: Month value. u32Day: Day value. u32DayOfWeek: Day of week. [ RTC_SUNDAY / RTC_MONDAY / RTC_TUESDAY / RTC_WEDNESDAY / RTC_THURSDAY / RTC_FRIDAY / RTC_SATURDAY] u32Hour: Hour value. u32Minute: Minute value. u32Second: Second value. u32TimeScale: [ RTC_CLOCK_12 / RTC_CLOCK_24] u8AmPm: [ RTC_AM / RTC_PM]

Returns
  None

Definition at line 422 of file rtc.c.

## ◆ RTC_SetTickPeriod()

void RTC_SetTickPeriod | ( | uint32_t | u32TickSelection | ) |

The function is used to set time tick period for periodic time tick Interrupt.

Parameters

  [in] | u32TickSelection | It is used to set the RTC time tick period for Periodic Time Tick Interrupt 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

Definition at line 857 of file rtc.c.

## ◆ RTC_SetTime()

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

This function is used to update time to RTC.

Parameters

  [in] | u32Hour | The Hour Time Digit of Alarm Setting.
  [in] | u32Minute | The Minute Time Digit of Alarm Setting
  [in] | u32Second | The Second Time Digit of Alarm Setting
  [in] | u32TimeMode | The 24-Hour / 12-Hour Time Scale Selection. [ RTC_CLOCK_12 / RTC_CLOCK_24]
  [in] | u32AmPm | 12-hour time scale with AM and PM indication. Only Time Scale select 12-hour used. [ RTC_AM / RTC_PM]

Returns
  None

Definition at line 625 of file rtc.c.

## Variable Documentation

## ◆ u32AmPm

uint32_t S_RTC_TIME_DATA_T::u32AmPm

Only Time Scale select 12-hr used

Definition at line 91 of file rtc.h.

## ◆ u32Day

uint32_t S_RTC_TIME_DATA_T::u32Day

Day value

Definition at line 85 of file rtc.h.

## ◆ u32DayOfWeek

uint32_t S_RTC_TIME_DATA_T::u32DayOfWeek

Day of week value

Definition at line 86 of file rtc.h.

## ◆ u32Hour

uint32_t S_RTC_TIME_DATA_T::u32Hour

Hour value

Definition at line 87 of file rtc.h.

## ◆ u32Minute

uint32_t S_RTC_TIME_DATA_T::u32Minute

Minute value

Definition at line 88 of file rtc.h.

## ◆ u32Month

uint32_t S_RTC_TIME_DATA_T::u32Month

Month value

Definition at line 84 of file rtc.h.

## ◆ u32Second

uint32_t S_RTC_TIME_DATA_T::u32Second

Second value

Definition at line 89 of file rtc.h.

## ◆ u32TimeScale

uint32_t S_RTC_TIME_DATA_T::u32TimeScale

12-Hour, 24-Hour

Definition at line 90 of file rtc.h.

## ◆ u32Year

uint32_t S_RTC_TIME_DATA_T::u32Year

Year value

Definition at line 83 of file rtc.h.