Kinetis SDK v.1.2 API Reference Manual  Rev. 0
Freescale Semiconductor, Inc.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
RTC HAL driver

Overview

This section describes the programming interface of the RTC HAL driver. The RTC HAL driver initializes the RTC registers and provides functions to read or modify the RTC registers. These are mostly invoked by the RTC Peripheral driver.

RTC Initialization

The HAL driver provides the enable (RTC_HAL_Enable()) and disable (RTC_HAL_Disable()) functions to enable or disable the RTC oscillator or the 32 KHz clock from the system oscillator if the platform does not have an RTC oscillator. It also provides an initialization function (RTC_HAL_Init()) to reset the RTC module.

RTC Setting and reading the RTC time

The HAL driver provides RTC_HAL_SetDatetime() and RTC_HAL_GetDatetime() functions to set and read the date and time using an instantiation of the rtc_datetime_t structure. These are the structure details:

typedef struct RtcDatetime
{
uint16_t year;
uint16_t month;
uint16_t day;
uint16_t hour;
uint16_t minute;
uint8_t second;

The HAL driver also provides the ability to set and read the date and time in seconds using the RTC_HAL_SetDatetimeInsecs() and RTC_HAL_GetDatetimeInsecs() functions.

NOTE: If the RTC counter clock is not 32 KHz, the RTC_HAL_SetDatetime() and RTC_HAL_GetDatetime() functions do not provide accurate results. On such boards, use the RTC_HAL_SetDatetimeInsecs() and RTC_HAL_GetDatetimeInsecs() functions and adjust the second calculation taking into account the clock source difference. The RTC peripheral driver adjusts its seconds calculation if the clock feeding RTC counter clock is not 32 KHz. Use the peripheral driver instead of calling the HAL functions directly.

IRTC Setting and reading the Alarm

The HAL driver provides RTC_HAL_SetAlarm() and RTC_HAL_GetAlarm() functions to set an alarm and read back the alarm time.

Data Structures

struct  irtc_datetime_t
 Structure is used to hold the time in a simple "date" format. More...
 
struct  irtc_daylight_time_t
 Structure is used to hold the daylight saving time. More...
 
struct  rtc_datetime_t
 Structure is used to hold the time in a simple "date" format. More...
 

Macros

#define IRTC_BASE_YEAR   (2112U)
 
#define RTC_WRITE_ENABLE(base, value)   (*(__IO uint8_t*)(&RTC_STATUS_REG(base)) = (value))
 

Enumerations

enum  irtc_clock_output_t {
  kIRTCNoOutputClk = 0x0,
  kIRTCFine1hzClk = 0x1,
  kIRTC32khzClk = 0x2,
  kIRTCCoarse1hzClck = 0x3
}
 IRTC clock output selection. More...
 
enum  irtc_alarm_match_t {
  kIRTCSecMinHour = 0x0,
  kIRTCSecMinHourDay = 0x1,
  kIRTCSecMinHourDayMon = 0x2,
  kIRTCSecMinHourDayMonYear = 0x3
}
 IRTC alarm match selection. More...
 
enum  irtc_status_flag_t {
  kIRTCInvalidate = RTC_STATUS_INVAL_BIT_SHIFT,
  kIRTCReadOnly = RTC_STATUS_WRITE_PROT_EN_SHIFT,
  kIRTCLowVoltage = RTC_STATUS_CPU_LOW_VOLT_SHIFT,
  kIRTCResetSrc = RTC_STATUS_RST_SRC_SHIFT,
  kIRTCCmpInterval = RTC_STATUS_CMP_INT_SHIFT,
  kIRTCBusErr = RTC_STATUS_BUS_ERR_SHIFT,
  kIRTCCmpDone = RTC_STATUS_CMP_DONE_SHIFT
}
 IRTC status flags. More...
 
enum  irtc_int_status_flag_t {
  kIRTCTamperIntFlag = RTC_ISR_TAMPER_IS_SHIFT,
  kIRTCAlarmIntFlag = RTC_ISR_ALM_IS_SHIFT,
  kIRTCDayIntFlag = RTC_ISR_DAY_IS_SHIFT,
  kIRTCHourIntFlag = RTC_ISR_HOUR_IS_SHIFT,
  kIRTCMinIntFlag = RTC_ISR_MIN_IS_SHIFT,
  kIRTC1hzIntFlag = RTC_ISR_IS_1HZ_SHIFT,
  kIRTC2hzIntFlag = RTC_ISR_IS_2HZ_SHIFT,
  kIRTC4hzIntFlag = RTC_ISR_IS_4HZ_SHIFT,
  kIRTC8hzIntFlag = RTC_ISR_IS_8HZ_SHIFT,
  kIRTC16hzIntFlag = RTC_ISR_IS_16HZ_SHIFT,
  kIRTC32hzIntFlag = RTC_ISR_IS_32HZ_SHIFT,
  kIRTC64hzIntFlag = RTC_ISR_IS_64HZ_SHIFT,
  kIRTC128hzIntFlag = RTC_ISR_IS_128HZ_SHIFT,
  kIRTC256hzIntFlag = RTC_ISR_IS_256HZ_SHIFT,
  kIRTC512hzIntFlag = RTC_ISR_IS_512HZ_SHIFT
}
 IRTC interrupt status flags. More...
 
enum  irtc_int_t {
  kIRTCTamperInt = RTC_IER_TAMPER_IE_SHIFT,
  kIRTCAlarmInt = RTC_IER_ALM_IE_SHIFT,
  kIRTCDayInt = RTC_IER_DAY_IE_SHIFT,
  kIRTCHourInt = RTC_IER_HOUR_IE_SHIFT,
  kIRTCMinInt = RTC_IER_MIN_IE_SHIFT,
  kIRTC1hzInt = RTC_IER_IE_1HZ_SHIFT,
  kIRTC2hzInt = RTC_IER_IE_2HZ_SHIFT,
  kIRTC4hzInt = RTC_IER_IE_4HZ_SHIFT,
  kIRTC8hzInt = RTC_IER_IE_8HZ_SHIFT,
  kIRTC16hzInt = RTC_IER_IE_16HZ_SHIFT,
  kIRTC32hzInt = RTC_IER_IE_32HZ_SHIFT,
  kIRTC64hzInt = RTC_IER_IE_64HZ_SHIFT,
  kIRTC128hzInt = RTC_IER_IE_128HZ_SHIFT,
  kIRTC256hzInt = RTC_IER_IE_256HZ_SHIFT,
  kIRTC512hzInt = RTC_IER_IE_512HZ_SHIFT
}
 IRTC interrupts. More...
 
enum  rtc_status_t {
  kStatusRtcSuccess = 0x00U,
  kStatusRtcFail = 0x01U
}
 Error codes for RTC driver. More...
 

Initialization

void IRTC_HAL_Init (RTC_Type *base, const irtc_datetime_t *datetime, const irtc_datetime_t *alarmDatetime, irtc_alarm_match_t alarmMode, const irtc_daylight_time_t *daylightTime)
 Resets the IRTC module. More...
 
void IRTC_HAL_SetLockRegisterCmd (RTC_Type *base, bool lock)
 Lock or unlock IRTC registers for write access. More...
 

Date and Time Setting

Note
All APIs of Date and Time Settings except IRTC_HAL_SetDatetime and IRTC_HAL_GetDatetime should first determine the state of the INVAL bit in the STATUS(bit 0) to determine the counters are stable before their value can be read or changed(can be done by calling IRTC_HAL_GetStatusFlag(base, kIRTCInvalidate)). The assertion of INVAL bit ensures that no operation is done at the boundary of a second when counters change value.
void IRTC_HAL_SetYearMonth (RTC_Type *base, uint16_t year, uint16_t month)
 Sets the IRTC year and month. More...
 
void IRTC_HAL_GetYearMonth (RTC_Type *base, uint16_t *year, uint16_t *month)
 Gets the IRTC current year and month. More...
 
static void IRTC_HAL_SetDayWeek (RTC_Type *base, uint16_t day, uint16_t weekDay)
 Sets the IRTC day and day of week. More...
 
void IRTC_HAL_GetDayWeek (RTC_Type *base, uint16_t *day, uint16_t *weekDay)
 Gets the IRTC current day and day of week. More...
 
static void IRTC_HAL_SetHourMin (RTC_Type *base, uint16_t hour, uint16_t min)
 Sets the IRTC hour and min. More...
 
void IRTC_HAL_GetHourMin (RTC_Type *base, uint16_t *hour, uint16_t *min)
 Gets the IRTC current hour and min. More...
 
static void IRTC_HAL_SetSec (RTC_Type *base, uint16_t sec)
 Sets the IRTC second counter. More...
 
static void IRTC_HAL_GetSec (RTC_Type *base, uint16_t *sec)
 Gets the IRTC current second counter. More...
 
void IRTC_HAL_SetDatetime (RTC_Type *base, const irtc_datetime_t *datetime)
 Sets the IRTC date and time according to the given time structure. More...
 
void IRTC_HAL_GetDatetime (RTC_Type *base, irtc_datetime_t *datetime)
 Gets the IRTC time and stores it in the given time structure. More...
 

Alarm Time Setting

static void IRTC_HAL_SetAlarmMatchMode (RTC_Type *base, irtc_alarm_match_t alarmType)
 Sets alarm match type. More...
 
void IRTC_HAL_SetAlarmYearMonth (RTC_Type *base, uint16_t year, uint16_t month)
 Sets the IRTC year and month alarm. More...
 
void IRTC_HAL_GetAlarmYearMonth (RTC_Type *base, uint16_t *year, uint16_t *month)
 Gets the IRTC current year and month alarm. More...
 
static void IRTC_HAL_SetAlarmDay (RTC_Type *base, uint16_t day)
 Sets the IRTC day alarm. More...
 
static void IRTC_HAL_GetAlarmDay (RTC_Type *base, uint16_t *day)
 Gets the IRTC current day alarm. More...
 
static void IRTC_HAL_SetAlarmHourMin (RTC_Type *base, uint16_t hour, uint16_t min)
 Sets the IRTC hour and min alarm. More...
 
void IRTC_HAL_GetAlarmHourMin (RTC_Type *base, uint16_t *hour, uint16_t *min)
 Gets the IRTC current hour and min alarm. More...
 
static void IRTC_HAL_SetAlarmSec (RTC_Type *base, uint16_t sec)
 Sets the IRTC second counter alarm. More...
 
static void IRTC_HAL_GetAlarmSec (RTC_Type *base, uint16_t *sec)
 Gets the IRTC current second counter alarm. More...
 
void IRTC_HAL_SetAlarm (RTC_Type *base, const irtc_datetime_t *datetime)
 Sets the IRTC alarm time and enables the alarm interrupt. More...
 
void IRTC_HAL_GetAlarm (RTC_Type *base, irtc_datetime_t *datetime)
 Reads the value of the time alarm. More...
 

Daylight Saving Time Setting

static void IRTC_HAL_SetDaylightMonth (RTC_Type *base, uint16_t startMonth, uint16_t endMonth)
 Sets IRTC daylight saving start month and end month. More...
 
void IRTC_HAL_GetDaylightMonth (RTC_Type *base, uint16_t *startMonth, uint16_t *endMonth)
 Gets the IRTC current daylight saving start and end month. More...
 
static void IRTC_HAL_SetDaylightDay (RTC_Type *base, uint16_t startDay, uint16_t endDay)
 Sets the IRTC daylight saving start and end day. More...
 
void IRTC_HAL_GetDaylightDay (RTC_Type *base, uint16_t *startDay, uint16_t *endDay)
 Gets the IRTC current daylight saving start and end day. More...
 
static void IRTC_HAL_SetDaylightHour (RTC_Type *base, uint16_t startHour, uint16_t endHour)
 Sets the IRTC current daylight saving start and end hour. More...
 
void IRTC_HAL_GetDaylightHour (RTC_Type *base, uint16_t *startHour, uint16_t *endHour)
 Gets the IRTC current daylight saving start and end hour. More...
 
void IRTC_HAL_SetDaylightTime (RTC_Type *base, const irtc_daylight_time_t *datetime)
 Sets the IRTC daylight saving date and time. More...
 
void IRTC_HAL_GetDaylightTime (RTC_Type *base, irtc_daylight_time_t *datetime)
 Gets the IRTC daylight saving time and stores it in the given time structure. More...
 

Status

static bool IRTC_HAL_GetStatusFlag (RTC_Type *base, irtc_status_flag_t statusFlag)
 Gets the IRTC status flag state. More...
 

Interrupts

static void IRTC_HAL_SetIntCmd (RTC_Type *base, irtc_int_t interrupt, bool enable)
 Enable or disable related IRTC interrupt. More...
 
static bool IRTC_HAL_GetIntCmd (RTC_Type *base, irtc_int_t interrupt)
 Whether the IRTC interrupt is enabled or not. More...
 
static bool IRTC_HAL_GetIntStatusFlag (RTC_Type *base, irtc_int_status_flag_t statusFlag)
 Gets the IRTC interrupt status flag state. More...
 
static void IRTC_HAL_ClearIntStatusFlag (RTC_Type *base, irtc_int_status_flag_t statusFlag)
 Clear the IRTC interrupt status flag. More...
 

IRTC Time Compensation

static void IRTC_HAL_SetCompensation (RTC_Type *base, bool enableFine, uint16_t compValue)
 Writes the value to the IRTC compensation register. More...
 
static uint16_t IRTC_HAL_GetCompensation (RTC_Type *base)
 Reads the time compensation register contents. More...
 

IRTC Control

static void IRTC_HAL_SetClockOutMode (RTC_Type *base, irtc_clock_output_t clock)
 Select which clock to output from SoC for use outside RTC. More...
 
static void IRTC_HAL_SoftwareReset (RTC_Type *base)
 Performs a software reset on the IRTC module. More...
 

RTC HAL API Functions

void RTC_HAL_Enable (RTC_Type *rtcBase)
 Initializes the RTC module. More...
 
void RTC_HAL_Disable (RTC_Type *rtcBase)
 Disables the RTC module. More...
 
void RTC_HAL_Init (RTC_Type *rtcBase)
 This function will clear all interrupts. More...
 
void RTC_HAL_ConvertSecsToDatetime (const uint32_t *seconds, rtc_datetime_t *datetime)
 Converts seconds to date time format data structure. More...
 
bool RTC_HAL_IsDatetimeCorrectFormat (const rtc_datetime_t *datetime)
 Checks whether the date time structure elements have the information that is within the range. More...
 
void RTC_HAL_ConvertDatetimeToSecs (const rtc_datetime_t *datetime, uint32_t *seconds)
 Converts the date time format data structure to seconds. More...
 
void RTC_HAL_SetDatetime (RTC_Type *rtcBase, const rtc_datetime_t *datetime)
 Sets the RTC date and time according to the given time structure. More...
 
void RTC_HAL_SetDatetimeInsecs (RTC_Type *rtcBase, const uint32_t seconds)
 Sets the RTC date and time according to the given time provided in seconds. More...
 
void RTC_HAL_GetDatetime (RTC_Type *rtcBase, rtc_datetime_t *datetime)
 Gets the RTC time and stores it in the given time structure. More...
 
void RTC_HAL_GetDatetimeInSecs (RTC_Type *rtcBase, uint32_t *seconds)
 Gets the RTC time and returns it in seconds. More...
 
void RTC_HAL_GetAlarm (RTC_Type *rtcBase, rtc_datetime_t *date)
 Reads the value of the time alarm. More...
 
bool RTC_HAL_SetAlarm (RTC_Type *rtcBase, const rtc_datetime_t *date)
 Sets the RTC alarm time and enables the alarm interrupt. More...
 

RTC register access functions

static uint32_t RTC_HAL_GetSecsReg (RTC_Type *rtcBase)
 Reads the value of the time seconds counter. More...
 
static void RTC_HAL_SetSecsReg (RTC_Type *rtcBase, const uint32_t seconds)
 Writes to the time seconds counter. More...
 
static void RTC_HAL_SetAlarmReg (RTC_Type *rtcBase, const uint32_t seconds)
 Sets the time alarm and clears the time alarm flag. More...
 
static uint32_t RTC_HAL_GetAlarmReg (RTC_Type *rtcBase)
 Gets the time alarm register contents. More...
 
static uint16_t RTC_HAL_GetPrescaler (RTC_Type *rtcBase)
 Reads the value of the time prescaler. More...
 
static void RTC_HAL_SetPrescaler (RTC_Type *rtcBase, const uint16_t prescale)
 Sets the time prescaler. More...
 
static uint32_t RTC_HAL_GetCompensationReg (RTC_Type *rtcBase)
 Reads the time compensation register contents. More...
 
static void RTC_HAL_SetCompensationReg (RTC_Type *rtcBase, const uint32_t compValue)
 Writes the value to the RTC TCR register. More...
 
static uint8_t RTC_HAL_GetCompensationIntervalCounter (RTC_Type *rtcBase)
 Reads the current value of the compensation interval counter, which is the field CIC in the RTC TCR register. More...
 
static uint8_t RTC_HAL_GetTimeCompensationValue (RTC_Type *rtcBase)
 Reads the current value used by the compensation logic for the present second interval. More...
 
static uint8_t RTC_HAL_GetCompensationIntervalRegister (RTC_Type *rtcBase)
 Reads the compensation interval register. More...
 
static void RTC_HAL_SetCompensationIntervalRegister (RTC_Type *rtcBase, const uint8_t value)
 Writes the compensation interval. More...
 
static uint8_t RTC_HAL_GetTimeCompensationRegister (RTC_Type *rtcBase)
 Reads the time compensation value which is the configured number of 32.768 kHz clock cycles in each second. More...
 
static void RTC_HAL_SetTimeCompensationRegister (RTC_Type *rtcBase, const uint8_t compValue)
 Writes to the field Time Compensation Register (TCR) of the RTC Time Compensation Register (RTC_TCR). More...
 
static void RTC_HAL_SetOsc2pfLoadCmd (RTC_Type *rtcBase, bool enable)
 Enables/disables the oscillator configuration for the 2pF load. More...
 
static bool RTC_HAL_GetOsc2pfLoad (RTC_Type *rtcBase)
 Reads the oscillator 2pF load configure bit. More...
 
static void RTC_HAL_SetOsc4pfLoadCmd (RTC_Type *rtcBase, bool enable)
 Enables/disables the oscillator configuration for the 4pF load. More...
 
static bool RTC_HAL_GetOsc4pfLoad (RTC_Type *rtcBase)
 Reads the oscillator 4pF load configure bit. More...
 
static void RTC_HAL_SetOsc8pfLoadCmd (RTC_Type *rtcBase, bool enable)
 Enables/disables the oscillator configuration for the 8pF load. More...
 
static bool RTC_HAL_GetOsc8pfLoad (RTC_Type *rtcBase)
 Reads the oscillator 8pF load configure bit. More...
 
static void RTC_HAL_SetOsc16pfLoadCmd (RTC_Type *rtcBase, bool enable)
 Enables/disables the oscillator configuration for the 16pF load. More...
 
static bool RTC_HAL_GetOsc16pfLoad (RTC_Type *rtcBase)
 Reads the oscillator 16pF load configure bit. More...
 
static void RTC_HAL_SetClockOutCmd (RTC_Type *rtcBase, bool enable)
 Enables/disables the 32 kHz clock output to other peripherals. More...
 
static bool RTC_HAL_GetClockOutCmd (RTC_Type *rtcBase)
 Reads the RTC_CR CLKO bit. More...
 
static void RTC_HAL_SetOscillatorCmd (RTC_Type *rtcBase, bool enable)
 Enables/disables the oscillator. More...
 
static bool RTC_HAL_IsOscillatorEnabled (RTC_Type *rtcBase)
 Reads the RTC_CR OSCE bit. More...
 
static void RTC_HAL_SoftwareReset (RTC_Type *rtcBase)
 Performs a software reset on the RTC module. More...
 
static void RTC_HAL_SoftwareResetFlagClear (RTC_Type *rtcBase)
 Clears the software reset flag. More...
 
static bool RTC_HAL_ReadSoftwareResetStatus (RTC_Type *rtcBase)
 Reads the RTC_CR SWR bit. More...
 
static bool RTC_HAL_IsCounterEnabled (RTC_Type *rtcBase)
 Reads the time counter status (enabled/disabled). More...
 
static void RTC_HAL_EnableCounter (RTC_Type *rtcBase, bool enable)
 Changes the time counter status. More...
 
static bool RTC_HAL_HasAlarmOccured (RTC_Type *rtcBase)
 Checks whether the configured time alarm has occurred. More...
 
static bool RTC_HAL_IsTimeInvalid (RTC_Type *rtcBase)
 Checks whether the time has been marked as invalid. More...
 
static bool RTC_HAL_IsSecsIntEnabled (RTC_Type *rtcBase)
 Checks whether the Time Seconds Interrupt is enabled/disabled. More...
 
static void RTC_HAL_SetSecsIntCmd (RTC_Type *rtcBase, bool enable)
 Enables/disables the Time Seconds Interrupt. More...
 
static bool RTC_HAL_ReadAlarmInt (RTC_Type *rtcBase)
 Checks whether the Time Alarm Interrupt is enabled/disabled. More...
 
static void RTC_HAL_SetAlarmIntCmd (RTC_Type *rtcBase, bool enable)
 Enables/disables the Time Alarm Interrupt. More...
 
static void RTC_HAL_SetTimeOverflowIntCmd (RTC_Type *rtcBase, bool enable)
 Enables/disables the Time Overflow Interrupt. More...
 
static void RTC_HAL_SetTimeInvalidIntCmd (RTC_Type *rtcBase, bool enable)
 Enables/disables the Time Invalid Interrupt. More...
 

Data Structure Documentation

struct irtc_datetime_t

Data Fields

uint16_t year
 Range from 1984 to 2239. More...
 
uint16_t month
 Range from 1 to 12. More...
 
uint16_t day
 Range from 1 to 31 (depending on month). More...
 
uint16_t weekDay
 Range from 0(Sunday) to 6(Saturday)
 
uint16_t hour
 Range from 0 to 23. More...
 
uint16_t minute
 Range from 0 to 59. More...
 
uint16_t second
 Range from 0 to 59. More...
 

Field Documentation

uint16_t irtc_datetime_t::year
uint16_t irtc_datetime_t::month
uint16_t irtc_datetime_t::day
uint16_t irtc_datetime_t::hour
uint16_t irtc_datetime_t::minute
uint16_t irtc_datetime_t::second
struct irtc_daylight_time_t

Data Fields

uint16_t startMonth
 Range from 1 to 12. More...
 
uint16_t endMonth
 Range from 1 to 12. More...
 
uint16_t startDay
 Range from 1 to 31 (depending on month). More...
 
uint16_t endDay
 Range from 1 to 31 (depending on month). More...
 
uint16_t startHour
 Range from 0 to 23. More...
 
uint16_t endHour
 Range from 0 to 23. More...
 

Field Documentation

uint16_t irtc_daylight_time_t::startMonth
uint16_t irtc_daylight_time_t::endMonth
uint16_t irtc_daylight_time_t::startDay
uint16_t irtc_daylight_time_t::endDay
uint16_t irtc_daylight_time_t::startHour
uint16_t irtc_daylight_time_t::endHour
struct rtc_datetime_t

Data Fields

uint16_t year
 Range from 1970 to 2099. More...
 
uint16_t month
 Range from 1 to 12. More...
 
uint16_t day
 Range from 1 to 31 (depending on month). More...
 
uint16_t hour
 Range from 0 to 23. More...
 
uint16_t minute
 Range from 0 to 59. More...
 
uint8_t second
 Range from 0 to 59. More...
 

Field Documentation

uint16_t rtc_datetime_t::year
uint16_t rtc_datetime_t::month
uint16_t rtc_datetime_t::day
uint16_t rtc_datetime_t::hour
uint16_t rtc_datetime_t::minute
uint8_t rtc_datetime_t::second

Enumeration Type Documentation

Enumerator
kIRTCNoOutputClk 

No output clock.

kIRTCFine1hzClk 

Fine 1Hz clock.

kIRTC32khzClk 

32.768 kHz clock

kIRTCCoarse1hzClck 

Coarse 1Hz clock.

Enumerator
kIRTCSecMinHour 

Generate alarm when sec/min/hour are matched.

kIRTCSecMinHourDay 

Generate alarm when sec/min/hour/day are matched.

kIRTCSecMinHourDayMon 

Generate alarm when sec/min/hour/day/month are matched.

kIRTCSecMinHourDayMonYear 

Generate alarm when sec/min/hour/day/month/year are matched.

enum irtc_int_t
Enumerator
kStatusRtcSuccess 

RTC success status.

kStatusRtcFail 

RTC error status.

Function Documentation

void IRTC_HAL_Init ( RTC_Type *  base,
const irtc_datetime_t datetime,
const irtc_datetime_t alarmDatetime,
irtc_alarm_match_t  alarmMode,
const irtc_daylight_time_t daylightTime 
)

This function initiates a soft-reset of the IRTC module to reset the IRTC registers, and configure IRTC according to user settings.

Parameters
baseThe IRTC base address pointer.
datetimeDate and time need to set, pass NULL to ignore.
alarmDatetimeAlarm of date and time need to set, pass NULL to ignore.
alarmModeAlarm mode to set when will generate alarm.
daylightTimeDaylight saving time need to set, pass NULL to ignore.
void IRTC_HAL_SetLockRegisterCmd ( RTC_Type *  base,
bool  lock 
)
Note
When the registers are unlocked, they remain in this unlocked state for a time of 2 seconds after which they get locked automatically. After power-on-reset, the registers come out as unlocked but they get locked automatically 15 seconds after power on.
Parameters
baseThe IRTC base address pointer.
lockLock(true) or unlock(false) IRTC registers.
void IRTC_HAL_SetYearMonth ( RTC_Type *  base,
uint16_t  year,
uint16_t  month 
)
Parameters
baseThe IRTC base address pointer
yearYear number from 1984 to 2239.
monthMonth number from 1 to 12.
void IRTC_HAL_GetYearMonth ( RTC_Type *  base,
uint16_t *  year,
uint16_t *  month 
)
Parameters
baseThe IRTC base address pointer
yearCurrent year number from 1984 to 2239.
monthCurrent month number from 1 to 12.
static void IRTC_HAL_SetDayWeek ( RTC_Type *  base,
uint16_t  day,
uint16_t  weekDay 
)
inlinestatic
Parameters
baseThe IRTC base address pointer
dayDay number from 1 to 31.
weekDayDay of week number from 0(Sunday) to 6(Saturday).
void IRTC_HAL_GetDayWeek ( RTC_Type *  base,
uint16_t *  day,
uint16_t *  weekDay 
)
Parameters
baseThe IRTC base address pointer
dayCurrent day number from 1 to 31.
weekDayCurrent day of week number from 0(Sunday) to 6(Saturday).
static void IRTC_HAL_SetHourMin ( RTC_Type *  base,
uint16_t  hour,
uint16_t  min 
)
inlinestatic
Parameters
baseThe IRTC base address pointer
hourHour number from 0 to 23.
minMin number from 0 to 59.
void IRTC_HAL_GetHourMin ( RTC_Type *  base,
uint16_t *  hour,
uint16_t *  min 
)
Parameters
baseThe IRTC base address pointer
hourCurrent hour number from 0 to 23.
minCurrent min number from 0 to 59.
static void IRTC_HAL_SetSec ( RTC_Type *  base,
uint16_t  sec 
)
inlinestatic
Parameters
baseThe IRTC base address pointer
secSecond number from 0 to 59.
static void IRTC_HAL_GetSec ( RTC_Type *  base,
uint16_t *  sec 
)
inlinestatic
Parameters
baseThe IRTC base address pointer
secCurrent second number from 0 to 59.
void IRTC_HAL_SetDatetime ( RTC_Type *  base,
const irtc_datetime_t datetime 
)
Parameters
baseThe IRTC base address pointer
datetimePointer to a structure where the date and time details are stored.
void IRTC_HAL_GetDatetime ( RTC_Type *  base,
irtc_datetime_t datetime 
)
Parameters
baseThe IRTC base address pointer
datetimePointer to a structure where the date and time details are stored.
static void IRTC_HAL_SetAlarmMatchMode ( RTC_Type *  base,
irtc_alarm_match_t  alarmType 
)
inlinestatic
Parameters
baseThe IRTC base address pointer
alarmTypeAlarm match selections that when an alarm will happen.
void IRTC_HAL_SetAlarmYearMonth ( RTC_Type *  base,
uint16_t  year,
uint16_t  month 
)
Parameters
baseThe IRTC base address pointer
yearYear number from 1984 to 2239.
monthMonth number from 1 to 12.
void IRTC_HAL_GetAlarmYearMonth ( RTC_Type *  base,
uint16_t *  year,
uint16_t *  month 
)
Parameters
baseThe IRTC base address pointer
yearCurrent year number from 1984 to 2239.
monthCurrent month number from 1 to 12.
static void IRTC_HAL_SetAlarmDay ( RTC_Type *  base,
uint16_t  day 
)
inlinestatic
Parameters
baseThe IRTC base address pointer
dayDay number from 1 to 31.
static void IRTC_HAL_GetAlarmDay ( RTC_Type *  base,
uint16_t *  day 
)
inlinestatic
Parameters
baseThe IRTC base address pointer
dayCurrent day number from 1984 to 2239.
static void IRTC_HAL_SetAlarmHourMin ( RTC_Type *  base,
uint16_t  hour,
uint16_t  min 
)
inlinestatic
Parameters
baseThe IRTC base address pointer
hourHour number from 0 to 23.
minMin number from 0 to 59.
void IRTC_HAL_GetAlarmHourMin ( RTC_Type *  base,
uint16_t *  hour,
uint16_t *  min 
)
Parameters
baseThe IRTC base address pointer
hourCurrent hour number from 0 to 23.
minCurrent min number from 0 to 59.
static void IRTC_HAL_SetAlarmSec ( RTC_Type *  base,
uint16_t  sec 
)
inlinestatic
Parameters
baseThe IRTC base address pointer
secSecond number from 0 to 59.
static void IRTC_HAL_GetAlarmSec ( RTC_Type *  base,
uint16_t *  sec 
)
inlinestatic
Parameters
baseThe IRTC base address pointer
secCurrent second number from 0 to 59.
void IRTC_HAL_SetAlarm ( RTC_Type *  base,
const irtc_datetime_t datetime 
)

The function checks whether the specified alarm time is greater than the present time. If not, the function does not set the alarm and returns an error.

Parameters
baseThe IRTC base address pointer.
datetimePointer to structure where the alarm date and time details will be stored at.
void IRTC_HAL_GetAlarm ( RTC_Type *  base,
irtc_datetime_t datetime 
)
Parameters
baseThe IRTC base address pointer
datetimePointer to a variable where the alarm date and time details are stored.
static void IRTC_HAL_SetDaylightMonth ( RTC_Type *  base,
uint16_t  startMonth,
uint16_t  endMonth 
)
inlinestatic
Parameters
baseThe IRTC base address pointer
startMonthDaylight saving start month number from 1 to 12.
endMonthDaylight saving end month number from 1 to 12.
void IRTC_HAL_GetDaylightMonth ( RTC_Type *  base,
uint16_t *  startMonth,
uint16_t *  endMonth 
)
Parameters
baseThe IRTC base address pointer
startMonthCurrent daylight saving start month number from 1 to 12.
endMonthCurrent daylight saving end month number from 1 to 12.
static void IRTC_HAL_SetDaylightDay ( RTC_Type *  base,
uint16_t  startDay,
uint16_t  endDay 
)
inlinestatic
Parameters
baseThe IRTC base address pointer
startDayDaylight saving day start value number from 1 to 31.
endDayDaylight saving day end value number from 1 to 31.
void IRTC_HAL_GetDaylightDay ( RTC_Type *  base,
uint16_t *  startDay,
uint16_t *  endDay 
)
Parameters
baseThe IRTC base address pointer
startDayCurrent daylight saving day start value number from 1 to 31.
endDayCurrent daylight saving day end value number from 1 to 31.
static void IRTC_HAL_SetDaylightHour ( RTC_Type *  base,
uint16_t  startHour,
uint16_t  endHour 
)
inlinestatic
Parameters
baseThe IRTC base address pointer
startHourDaylight saving hour start value.
endHourDaylight saving hour end value.
void IRTC_HAL_GetDaylightHour ( RTC_Type *  base,
uint16_t *  startHour,
uint16_t *  endHour 
)
Parameters
baseThe IRTC base address pointer
startHourCurrent daylight saving hour start value.
endHourCurrent daylight saving hour end value.
void IRTC_HAL_SetDaylightTime ( RTC_Type *  base,
const irtc_daylight_time_t datetime 
)
Parameters
baseThe IRTC base address pointer
datetimePointer to a structure where the date and time details are stored.
void IRTC_HAL_GetDaylightTime ( RTC_Type *  base,
irtc_daylight_time_t datetime 
)
Parameters
baseThe IRTC base address pointer
datetimePointer to a structure where the date and time details are stored.
static bool IRTC_HAL_GetStatusFlag ( RTC_Type *  base,
irtc_status_flag_t  statusFlag 
)
inlinestatic

base The IRTC peripheral base pointer.

Parameters
statusFlagThe status flag, defined in type irtc_status_flag_t.
Returns
State of the status flag: asserted (true) or not-asserted (false).
  • true: related status flag is being set.
  • false: related status flag is not set.
static void IRTC_HAL_SetIntCmd ( RTC_Type *  base,
irtc_int_t  interrupt,
bool  enable 
)
inlinestatic

base The IRTC peripheral base pointer.

Parameters
interruptThe interrupt name, defined in type irtc_int_t.
enableEnable(ture) or disable(false) related interrupt.
static bool IRTC_HAL_GetIntCmd ( RTC_Type *  base,
irtc_int_t  interrupt 
)
inlinestatic

base The IRTC peripheral base pointer.

Parameters
interruptThe interrupt name, defined in type irtc_int_t.
Returns
State of the interrupt: asserted (true) or not-asserted (false).
  • true: related interrupt is being enabled.
  • false: related interrupt is not enabled.
static bool IRTC_HAL_GetIntStatusFlag ( RTC_Type *  base,
irtc_int_status_flag_t  statusFlag 
)
inlinestatic

base The IRTC peripheral base pointer.

Parameters
statusFlagThe status flag, defined in type irtc_int_status_flag_t.
Returns
State of the status flag: asserted (true) or not-asserted (false).
  • true: related status flag is being set.
  • false: related status flag is not set.
static void IRTC_HAL_ClearIntStatusFlag ( RTC_Type *  base,
irtc_int_status_flag_t  statusFlag 
)
inlinestatic

Tamper interrupt status flag is cleared when TAMPER_SCR[TMPR_STS] is cleared.

base The IRTC peripheral base pointer.

Parameters
statusFlagThe status flag, defined in type irtc_int_status_flag_t.
static void IRTC_HAL_SetCompensation ( RTC_Type *  base,
bool  enableFine,
uint16_t  compValue 
)
inlinestatic
Parameters
baseThe IRTC base address pointer
enableFineEnable(true) or disable(false) fine compensation.
compValuevalue to be written to the compensation register.
static uint16_t IRTC_HAL_GetCompensation ( RTC_Type *  base)
inlinestatic
Parameters
baseThe IRTC base address pointer
Returns
time compensation register contents.
static void IRTC_HAL_SetClockOutMode ( RTC_Type *  base,
irtc_clock_output_t  clock 
)
inlinestatic
Parameters
baseThe IRTC base address pointer.
clockOUtput clock selection from list of irtc_clock_output_t.
static void IRTC_HAL_SoftwareReset ( RTC_Type *  base)
inlinestatic

This clears the contents of alarm, interrupt(status and enable except tamper interrupt enable bit) registers, STATUS[CMP_DONE], and STATUS[BUS_ERR] and has no effect on DST, calendaring, standby time and tamper detect registers.

Parameters
baseThe IRTC base address pointer
void RTC_HAL_Enable ( RTC_Type *  rtcBase)

This function enables the RTC oscillator.

Parameters
rtcBaseThe RTC base address pointer
void RTC_HAL_Disable ( RTC_Type *  rtcBase)

This function disables the RTC counter and oscillator.

Parameters
rtcBaseThe RTC base address pointer
void RTC_HAL_Init ( RTC_Type *  rtcBase)

This function initiates a soft-reset of the RTC module if the time invalid flag is set.

Parameters
rtcBaseThe RTC base address pointer.
void RTC_HAL_ConvertSecsToDatetime ( const uint32_t *  seconds,
rtc_datetime_t datetime 
)
Parameters
secondsholds the date and time information in seconds
datetimeholds the converted information from seconds in date and time format
bool RTC_HAL_IsDatetimeCorrectFormat ( const rtc_datetime_t datetime)
Parameters
datetimeholds the date and time information that needs to be converted to seconds
Returns
returns true if the datetime argument has the right format, false otherwise
void RTC_HAL_ConvertDatetimeToSecs ( const rtc_datetime_t datetime,
uint32_t *  seconds 
)
Parameters
datetimeholds the date and time information that needs to be converted to seconds
secondsholds the converted date and time in seconds
void RTC_HAL_SetDatetime ( RTC_Type *  rtcBase,
const rtc_datetime_t datetime 
)

The function converts the data from the time structure to seconds and writes the seconds value to the RTC register. The RTC counter is started after setting the time.

Parameters
rtcBaseThe RTC base address pointer
datetime[in] Pointer to structure where the date and time details to set are stored.
void RTC_HAL_SetDatetimeInsecs ( RTC_Type *  rtcBase,
const uint32_t  seconds 
)

The RTC counter is started after setting the time.

Parameters
rtcBaseThe RTC base address pointer
seconds[in] Time in seconds
void RTC_HAL_GetDatetime ( RTC_Type *  rtcBase,
rtc_datetime_t datetime 
)

The function reads the value in seconds from the RTC register. It then converts to the time structure which provides the time in date, hour, minutes and seconds.

Parameters
rtcBaseThe RTC base address pointer
datetime[out] pointer to a structure where the date and time details are stored.
void RTC_HAL_GetDatetimeInSecs ( RTC_Type *  rtcBase,
uint32_t *  seconds 
)
Parameters
rtcBaseThe RTC base address pointer
seconds[out] pointer to variable where the RTC time is stored in seconds
void RTC_HAL_GetAlarm ( RTC_Type *  rtcBase,
rtc_datetime_t date 
)
Parameters
rtcBaseThe RTC base address pointer
date[out] pointer to a variable where the alarm date and time details are stored.
bool RTC_HAL_SetAlarm ( RTC_Type *  rtcBase,
const rtc_datetime_t date 
)

The function checks whether the specified alarm time is greater than the present time. If not, the function does not set the alarm and returns an error.

Parameters
rtcBaseThe RTC base address pointer.
date[in] pointer to structure where the alarm date and time details will be stored at.
Returns
true: success in setting the RTC alarm false: error in setting the RTC alarm.
static uint32_t RTC_HAL_GetSecsReg ( RTC_Type *  rtcBase)
inlinestatic

The time counter reads as zero if either the SR[TOF] or the SR[TIF] is set.

Parameters
rtcBaseThe RTC base address pointer.
Returns
contents of the seconds register.
static void RTC_HAL_SetSecsReg ( RTC_Type *  rtcBase,
const uint32_t  seconds 
)
inlinestatic

When the time counter is enabled, the TSR is read only and increments once every second provided the SR[TOF] or SR[TIF] is not set. When the time counter is disabled, the TSR can be read or written. Writing to the TSR when the time counter is disabled clears the SR[TOF] and/or the SR[TIF]. Writing to the TSR register with zero is supported, but not recommended, since the TSR reads as zero when either the SR[TIF] or the SR[TOF] is set (indicating the time is invalid).

Parameters
rtcBaseThe RTC base address pointer.
seconds[in] seconds value.
static void RTC_HAL_SetAlarmReg ( RTC_Type *  rtcBase,
const uint32_t  seconds 
)
inlinestatic

When the time counter is enabled, the SR[TAF] is set whenever the TAR[TAR] equals the TSR[TSR] and the TSR[TSR] increments. Writing to the TAR clears the SR[TAF].

Parameters
rtcBaseThe RTC base address pointer.
seconds[in] alarm value in seconds.
static uint32_t RTC_HAL_GetAlarmReg ( RTC_Type *  rtcBase)
inlinestatic
Parameters
rtcBaseThe RTC base address pointer
Returns
contents of the alarm register.
static uint16_t RTC_HAL_GetPrescaler ( RTC_Type *  rtcBase)
inlinestatic

The time counter reads as zero when either the SR[TOF] or the SR[TIF] is set.

Parameters
rtcBaseThe RTC base address pointer
Returns
contents of the time prescaler register.
static void RTC_HAL_SetPrescaler ( RTC_Type *  rtcBase,
const uint16_t  prescale 
)
inlinestatic

When the time counter is enabled, the TPR is read only and increments every 32.768 kHz clock cycle. When the time counter is disabled, the TPR can be read or written. The TSR[TSR] increments when bit 14 of the TPR transitions from a logic one to a logic zero.

Parameters
rtcBaseThe RTC base address pointer
prescalePrescaler value
static uint32_t RTC_HAL_GetCompensationReg ( RTC_Type *  rtcBase)
inlinestatic
Parameters
rtcBaseThe RTC base address pointer
Returns
time compensation register contents.
static void RTC_HAL_SetCompensationReg ( RTC_Type *  rtcBase,
const uint32_t  compValue 
)
inlinestatic
Parameters
rtcBaseThe RTC base address pointer
compValuevalue to be written to the compensation register.
static uint8_t RTC_HAL_GetCompensationIntervalCounter ( RTC_Type *  rtcBase)
inlinestatic
Parameters
rtcBaseThe RTC base address pointer.
Returns
compensation interval value.
static uint8_t RTC_HAL_GetTimeCompensationValue ( RTC_Type *  rtcBase)
inlinestatic
Parameters
rtcBaseThe RTC base address pointer
Returns
time compensation value
static uint8_t RTC_HAL_GetCompensationIntervalRegister ( RTC_Type *  rtcBase)
inlinestatic

The value is the configured compensation interval in seconds from 1 to 256 to control how frequently the time compensation register should adjust the number of 32.768 kHz cycles in each second. The value is one less than the number of seconds (for example, zero means a configuration for a compensation interval of one second).

Parameters
rtcBaseThe RTC base address pointer.
Returns
compensation interval in seconds.
static void RTC_HAL_SetCompensationIntervalRegister ( RTC_Type *  rtcBase,
const uint8_t  value 
)
inlinestatic

This configures the compensation interval in seconds from 1 to 256 to control how frequently the TCR should adjust the number of 32.768 kHz cycles in each second. The value written should be one less than the number of seconds (for example, write zero to configure for a compensation interval of one second). This register is double buffered and writes do not take affect until the end of the current compensation interval.

Parameters
rtcBaseThe RTC base address pointer.
valuethe compensation interval value.
static uint8_t RTC_HAL_GetTimeCompensationRegister ( RTC_Type *  rtcBase)
inlinestatic
Parameters
rtcBaseThe RTC base address pointer
Returns
time compensation value.
static void RTC_HAL_SetTimeCompensationRegister ( RTC_Type *  rtcBase,
const uint8_t  compValue 
)
inlinestatic

Configures the number of 32.768 kHz clock cycles in each second. This register is double buffered and writes do not take affect until the end of the current compensation interval.

Parameters
rtcBaseThe RTC base address pointer
compValuevalue of the time compensation.
static void RTC_HAL_SetOsc2pfLoadCmd ( RTC_Type *  rtcBase,
bool  enable 
)
inlinestatic
Parameters
rtcBaseThe RTC base address pointer
enablecan be true or false -true: enables load -false: disables load.
static bool RTC_HAL_GetOsc2pfLoad ( RTC_Type *  rtcBase)
inlinestatic
Parameters
rtcBaseThe RTC base address pointer
Returns
true: 2pF additional load enabled. false: 2pF additional load disabled.
static void RTC_HAL_SetOsc4pfLoadCmd ( RTC_Type *  rtcBase,
bool  enable 
)
inlinestatic
Parameters
rtcBaseThe RTC base address pointer
enablecan be true or false -true: enables load. -false: disables load
static bool RTC_HAL_GetOsc4pfLoad ( RTC_Type *  rtcBase)
inlinestatic
Parameters
rtcBaseThe RTC base address pointer
Returns
true: 4pF additional load enabled. false: 4pF additional load disabled.
static void RTC_HAL_SetOsc8pfLoadCmd ( RTC_Type *  rtcBase,
bool  enable 
)
inlinestatic
Parameters
rtcBaseThe RTC base address pointer
enablecan be true or false -true: enables load. -false: disables load.
static bool RTC_HAL_GetOsc8pfLoad ( RTC_Type *  rtcBase)
inlinestatic
Parameters
rtcBaseThe RTC base address pointer
Returns
true: 8pF additional load enabled. false: 8pF additional load disabled.
static void RTC_HAL_SetOsc16pfLoadCmd ( RTC_Type *  rtcBase,
bool  enable 
)
inlinestatic
Parameters
rtcBaseThe RTC base address pointer
enablecan be true or false -true: enables load. -false: disables load.
static bool RTC_HAL_GetOsc16pfLoad ( RTC_Type *  rtcBase)
inlinestatic
Parameters
rtcBaseThe RTC base address pointer
Returns
true: 16pF additional load enabled. false: 16pF additional load disabled.
static void RTC_HAL_SetClockOutCmd ( RTC_Type *  rtcBase,
bool  enable 
)
inlinestatic
Parameters
rtcBaseThe RTC base address pointer
enablecan be true or false -true: enables clock out. -false: disables clock out.
static bool RTC_HAL_GetClockOutCmd ( RTC_Type *  rtcBase)
inlinestatic
Parameters
rtcBaseThe RTC base address pointer
Returns
true: 32 kHz clock is not output to other peripherals. false: 32 kHz clock is output to other peripherals.
static void RTC_HAL_SetOscillatorCmd ( RTC_Type *  rtcBase,
bool  enable 
)
inlinestatic

After enabling, waits for the oscillator startup time before enabling the time counter to allow the 32.768 kHz clock time to stabilize.

Parameters
rtcBaseThe RTC base address pointer
enablecan be true or false -true: enables oscillator. -false: disables oscillator.
static bool RTC_HAL_IsOscillatorEnabled ( RTC_Type *  rtcBase)
inlinestatic
Parameters
rtcBaseThe RTC base address pointer
Returns
true: 32.768 kHz oscillator is enabled false: 32.768 kHz oscillator is disabled.
static void RTC_HAL_SoftwareReset ( RTC_Type *  rtcBase)
inlinestatic

This resets all RTC registers except for the SWR bit and the RTC_WAR and RTC_RAR registers. The SWR bit is cleared after VBAT POR and by software explicitly clearing it. Note: access control features (RTC_WAR and RTC_RAR registers) are not available in all MCUs.

Parameters
rtcBaseThe RTC base address pointer
static void RTC_HAL_SoftwareResetFlagClear ( RTC_Type *  rtcBase)
inlinestatic
Parameters
rtcBaseThe RTC base address pointer
static bool RTC_HAL_ReadSoftwareResetStatus ( RTC_Type *  rtcBase)
inlinestatic
Parameters
rtcBaseThe RTC base address pointer
Returns
true: SWR is set. false: SWR is cleared.
static bool RTC_HAL_IsCounterEnabled ( RTC_Type *  rtcBase)
inlinestatic
Parameters
rtcBaseThe RTC base address pointer
Returns
-true: time counter is enabled, time seconds register and time prescaler register are not writeable, but increment. -false: time counter is disabled, time seconds register and time prescaler register are writeable, but do not increment.
static void RTC_HAL_EnableCounter ( RTC_Type *  rtcBase,
bool  enable 
)
inlinestatic
Parameters
rtcBaseThe RTC base address pointer
enablecan be true or false -true: enables the time counter -false: disables the time counter.
static bool RTC_HAL_HasAlarmOccured ( RTC_Type *  rtcBase)
inlinestatic

Reads time alarm flag (TAF). This flag is set when the time alarm register (TAR) equals the time seconds register (TSR) and the TSR increments. This flag is cleared by writing the TAR register.

Parameters
rtcBaseThe RTC base address pointer.
Returns
-true: time alarm has occurred. -false: no time alarm occurred.
static bool RTC_HAL_IsTimeInvalid ( RTC_Type *  rtcBase)
inlinestatic

Reads the value of RTC Status Register (RTC_SR), field Time Invalid Flag (TIF). This flag is set on VBAT POR or software reset. The TSR and TPR do not increment and read as zero when this bit is set. This flag is cleared by writing the TSR register when the time counter is disabled.

Parameters
rtcBaseThe RTC base address pointer.
Returns
-true: time is INVALID and time counter is zero. -false: time is valid.
static bool RTC_HAL_IsSecsIntEnabled ( RTC_Type *  rtcBase)
inlinestatic

Reads the value of field Time Seconds Interrupt Enable (TSIE)of the RTC Interrupt Enable Register (RTC_IER). The seconds interrupt is an edge-sensitive interrupt with a dedicated interrupt vector. It is generated once a second and requires no software overhead (there is no corresponding status flag to clear).

Parameters
rtcBaseThe RTC base address pointer
Returns
-true: Seconds interrupt is enabled. -false: Seconds interrupt is disabled.
static void RTC_HAL_SetSecsIntCmd ( RTC_Type *  rtcBase,
bool  enable 
)
inlinestatic

Writes to the field Time Seconds Interrupt Enable (TSIE) of the RTC Interrupt Enable Register (RTC_IER). Note: The seconds interrupt is an edge-sensitive interrupt with a dedicated interrupt vector. It is generated once a second and requires no software overhead (there is no corresponding status flag to clear).

Parameters
rtcBaseThe RTC base address pointer
enablecan be true or false -true: Seconds interrupt is enabled. -false: Seconds interrupt is disabled.
static bool RTC_HAL_ReadAlarmInt ( RTC_Type *  rtcBase)
inlinestatic

Reads the field Time Alarm Interrupt Enable (TAIE) value of the RTC Interrupt Enable Register (RTC_IER).

Parameters
rtcBaseThe RTC base address pointer
Returns
true: Time alarm flag does generate an interrupt. false: Time alarm flag does not generate an interrupt.
static void RTC_HAL_SetAlarmIntCmd ( RTC_Type *  rtcBase,
bool  enable 
)
inlinestatic

Writes to the field Time Alarm Interrupt Enable (TAIE) of the RTC Interrupt Enable Register (RTC_IER).

Parameters
rtcBaseThe RTC base address pointer
enablecan be true or false -true: Time alarm flag does generate an interrupt. -false: Time alarm flag does not generate an interrupt.
static void RTC_HAL_SetTimeOverflowIntCmd ( RTC_Type *  rtcBase,
bool  enable 
)
inlinestatic

Writes to the field Time Overflow Interrupt Enable (TOIE) of the RTC Interrupt Enable Register (RTC_IER).

Parameters
rtcBaseThe RTC base address pointer
enablecan be true or false -true: Time overflow flag does generate an interrupt. -false: Time overflow flag does not generate an interrupt.
static void RTC_HAL_SetTimeInvalidIntCmd ( RTC_Type *  rtcBase,
bool  enable 
)
inlinestatic

Writes to the field Time Invalid Interrupt Enable (TIIE) of the RTC Interrupt Enable Register (RTC_IER).

Parameters
rtcBaseThe RTC base address pointer
enablecan be true or false -true: Time invalid flag does generate an interrupt. -false: Time invalid flag does not generate an interrupt.