Trident IoT SDK
Loading...
Searching...
No Matches
Calendar I/O

Direct access to the hardware calendar (Y/M/D h:m:s.ms). More...

Collaboration diagram for Calendar I/O:

Functions

void tr_rtc_calendar_get (tr_hal_rtc_date_time *date)
 Read the current hardware RTC calendar.
void tr_rtc_calendar_set (const tr_hal_rtc_date_time *date)
 Set the hardware RTC calendar safely (preserving uptime).

Detailed Description

Direct access to the hardware calendar (Y/M/D h:m:s.ms).

Function Documentation

◆ tr_rtc_calendar_get()

void tr_rtc_calendar_get ( tr_hal_rtc_date_time * date)

Read the current hardware RTC calendar.

Parameters
[out]dateFilled with the hardware calendar (Y/M/D h:m:s.ms).
Note
This is a direct read of the hardware time and does not include the wall‑clock offset.

◆ tr_rtc_calendar_set()

void tr_rtc_calendar_set ( const tr_hal_rtc_date_time * date)

Set the hardware RTC calendar safely (preserving uptime).

Parameters
[in]dateNew hardware calendar value to program.
  • Programs the calendar and waits for the hardware “load” to complete.
  • Re‑anchors (base, ref_ms) to the new hardware “now” so the computed uptime remains continuous (no backwards/forwards jump).
Warning
Use this when the hardware calendar must change (factory, service, platform policy). For typical application sync without touching HW, prefer tr_rtc_wallclock_ms_set().
Example
tr_rtc_date_time_t dt = {
.date = { .years = 2025, .months = 5, .days = 1 },
.time = { .hours = 12, .minutes = 0, .seconds = 0, .milliseconds = 0 }
};
tr_rtc_calendar_set(&dt); // uptime continuity is preserved internally
void tr_rtc_calendar_set(const tr_hal_rtc_date_time *date)
Set the hardware RTC calendar safely (preserving uptime).