# rtc\_if.h - [Overview](#section468934416165628) - [Summary](#section1696974119165628) - [Data Structures](#nested-classes) - [Typedefs](#typedef-members) - [Enumerations](#enum-members) - [Functions](#func-members) ## **Overview** **Related Modules:** [RTC](RTC.md) **Description:** Declares the standard RTC APIs. **Since:** 1.0 ## **Summary** ## Data Structures

Data Structure Name

Description

RtcTime

Defines the RTC information.

## Typedefs

Typedef Name

Description

RtcAlarmCallback) (enum RtcAlarmIndex)

typedef int32_t(*

Defines a callback that will be invoked when an alarm is generated at the specified time.

## Enumerations

Enumeration Name

Description

RtcAlarmIndex { RTC_ALARM_INDEX_A = 0, RTC_ALARM_INDEX_B = 1 }

Enumerates alarm indexes.

## Functions

Function

Description

RtcOpen (void)

DevHandle

Opens the RTC device to obtain its handle.

RtcClose (DevHandle handle)

void

Releases a specified handle of the RTC device.

RtcReadTime (DevHandle handle, struct RtcTime *time)

int32_t

Reads time from the RTC driver.

RtcWriteTime (DevHandle handle, const struct RtcTime *time)

int32_t

Writes format-compliant time to the RTC driver.

RtcReadAlarm (DevHandle handle, enum RtcAlarmIndex alarmIndex, struct RtcTime *time)

int32_t

Reads the RTC alarm time that was set last time.

RtcWriteAlarm (DevHandle handle, enum RtcAlarmIndex alarmIndex, const struct RtcTime *time)

int32_t

Writes the RTC alarm time based on the alarm index.

RtcRegisterAlarmCallback (DevHandle handle, enum RtcAlarmIndex alarmIndex, RtcAlarmCallback cb)

int32_t

Registers RtcAlarmCallback that will be invoked when an alarm is generated at the specified time.

RtcAlarmInterruptEnable (DevHandle handle, enum RtcAlarmIndex alarmIndex, uint8_t enable)

int32_t

Enables or disables alarm interrupts.

RtcGetFreq (DevHandle handle, uint32_t *freq)

int32_t

Reads the RTC external frequency.

RtcSetFreq (DevHandle handle, uint32_t freq)

int32_t

Sets the frequency of the external crystal oscillator connected to the RTC driver.

RtcReset (DevHandle handle)

int32_t

Resets the RTC driver.

RtcReadReg (DevHandle handle, uint8_t usrDefIndex, uint8_t *value)

int32_t

Reads the configuration of a custom RTC register based on the register index.

RtcWriteReg (DevHandle handle, uint8_t usrDefIndex, uint8_t value)

int32_t

Writes the configuration of a custom RTC register based on the register index.