Module ffi.rtc

Module for interfacing with the RTC (real time clock).

This module provides the ability to schedule wakeups through RTC.

See http://man7.org/linux/man-pages/man4/rtc.4.html for technical details.

Functions

RTC:secondsFromNowToEpoch (seconds_from_now) Adds seconds to epoch.
RTC:setWakeupAlarm (Epoch.) Set wakeup alarm.
RTC:unsetWakeupAlarm () Unset wakeup alarm.
RTC:getWakeupAlarm () Get a copy of the wakealarm we set (if any).
RTC:getWakeupAlarmSys () Get RTC wakealarm from system.
RTC:validateWakeupAlarmByProximity (task_alarm_epoch, proximity) Checks if the alarm we set matches the system alarm as well as the current time.
RTC:isWakeupAlarmScheduled () Checks if we scheduled a wakeup alarm.


Functions

RTC:secondsFromNowToEpoch (seconds_from_now)
Adds seconds to epoch.

Parameters:

  • seconds_from_now int Number of seconds.

Returns:

    int (cdata) Epoch.
RTC:setWakeupAlarm (Epoch.)
Set wakeup alarm.

If you want to set the alarm to a certain amount of time from now, you can process your value with secondsFromNowToEpoch.

Parameters:

  • Epoch. int

Returns:

  1. bool Success.
  2. re Error code (if any).
  3. err Error string (if any).
RTC:unsetWakeupAlarm ()
Unset wakeup alarm.
RTC:getWakeupAlarm ()
Get a copy of the wakealarm we set (if any).

This value is compared with getWakeupAlarmSys in validateWakeupAlarmByProximity.

Returns:

    tm (time struct)
RTC:getWakeupAlarmSys ()
Get RTC wakealarm from system.

Returns:

    tm (time struct)
RTC:validateWakeupAlarmByProximity (task_alarm_epoch, proximity)
Checks if the alarm we set matches the system alarm as well as the current time.

Parameters:

  • task_alarm_epoch
  • proximity In principle alarm time and current time should match within a second, but let's be absurdly generous and assume anything within 30 is a match.
RTC:isWakeupAlarmScheduled ()
Checks if we scheduled a wakeup alarm.

Returns:

    bool
generated by LDoc 1.4.6 Last updated 2019-11-14 14:03:21