Skip to content

File syn_port_rtc.h

FileList > port > syn_port_rtc.h

Go to the source code of this file

Platform port: Real-Time Clock (RTC). More...

  • #include "../common/syn_defs.h"
  • #include <stdint.h>

Classes

Type Name
struct SYN_RTC_DateTime
Calendar date and time representation.

Public Functions

Type Name
SYN_Status syn_port_rtc_get (SYN_RTC_DateTime * dt)
Read the current date/time from the hardware RTC.
SYN_Status syn_port_rtc_init (void)
Initialize the RTC peripheral.
SYN_Status syn_port_rtc_set (const SYN_RTC_DateTime * dt)
Set the hardware RTC to the given date/time.
SYN_Status syn_port_rtc_set_alarm (const SYN_RTC_DateTime * dt)
Set hardware RTC alarm target date/time for low-power wakeup.
void syn_port_rtc_set_drift_ppm (int32_t drift_ppm)
Set the hardware/software RTC clock drift compensation in PPM.

Detailed Description

Implementors provide these three functions for the target hardware RTC. On host (tests) they are backed by mock_port.c.

Public Functions Documentation

function syn_port_rtc_get

Read the current date/time from the hardware RTC.

SYN_Status syn_port_rtc_get (
    SYN_RTC_DateTime * dt
) 

Parameters:

  • dt Output parameter, filled by the port. Must not be NULL.

Returns:

SYN_OK on success, SYN_ERROR on read failure.


function syn_port_rtc_init

Initialize the RTC peripheral.

SYN_Status syn_port_rtc_init (
    void
) 

Returns:

SYN_OK on success, SYN_ERROR if the peripheral cannot be started.


function syn_port_rtc_set

Set the hardware RTC to the given date/time.

SYN_Status syn_port_rtc_set (
    const SYN_RTC_DateTime * dt
) 

Parameters:

  • dt New time to program. Must not be NULL.

Returns:

SYN_OK on success, SYN_ERROR on write failure.


function syn_port_rtc_set_alarm

Set hardware RTC alarm target date/time for low-power wakeup.

SYN_Status syn_port_rtc_set_alarm (
    const SYN_RTC_DateTime * dt
) 

Parameters:

  • dt Target alarm date/time.

Returns:

SYN_OK on success, error code otherwise.


function syn_port_rtc_set_drift_ppm

Set the hardware/software RTC clock drift compensation in PPM.

void syn_port_rtc_set_drift_ppm (
    int32_t drift_ppm
) 

Parameters:

  • drift_ppm Drift in Parts-Per-Million (+ = fast, - = slow).


The documentation for this class was generated from the following file src/syntropic/port/syn_port_rtc.h