RTC Interface

RTC Platform interface

RTC Overview

A Real-Time Clock (RTC) is a hardware module or integrated circuit designed to keep track of the current time and date, even when the main system is powered off. It provides accurate timekeeping functionality for electronic systems and embedded devices, ensuring consistent tracking of time over extended periods.

RTC BUS Interface

The RTC bus interface specifies how the RTC is connected to the system for communication and operation:

  • RTC Interface Internal: The RTC is integrated within the internal memory of the device.

  • RTC Interface I2C : The RTC is connected externally via the I2C (Inter-Integrated Circuit) protocol.

  • RTC Interface SPI : The RTC is connected externally via the SPI (Serial Peripheral Interface) protocol.

Application Interface

The below table captures the functions that are to be called from the application layer.

API Functions

Function

Description

rs_rtc_open

To open the RTC interface.

rs_rtc_set_config

To configure the RTC time and interface.

rs_rtc_start

To starts the RTC timer

rs_rtc_set_time

To updates the RTC time with the given time

rs_rtc_get_time

To reads the current time from the RTC time and returns it.

rs_rtc_get_ticks

To reads the current time from the RTC Ticks and returns it.

rs_rtc_stop

To stops the RTC timer

rs_rtc_register_completion_callback

To registers the given callback function for completion of transfer function.

rs_rtc_convert_ticks_to_date_time

To convert ticks to the date time format.

rs_rtc_convert_date_time_to_sec

To convert the date time to seconds.

rs_rtc_convert_date_time_to_milisec

To convert the date time to milli seconds.

rs_rtc_close

To close the RTC interface.

Implementation Guide

Users can directly call the API’s though most of them will be called by device drivers.

  • Open the RTC Interface and configure the RTC.

  • Register the callback.

  • Read time when needed

  • Write time when needed

  • Close the RTC unit

Error Code

  • Every API’s for the RTC returns some success or failure values. Please refer below section,

Documentation from the relevant header as follows:

Warning

doxygenfile: Cannot find file “rs_rtc.h