Add monotonic time

Ferdinand Bachmann requested to merge yrlf/firmware:add-monotonic-time into master

This merge request adds a monotonic time function to epicardium and pycardium as discussed in #146 (closed).

The monotonic time is maintained by accumulating an offset to the RTC every time it is changed.

Epicardium APIs added:

  • API_RTC_GET_MONOTONIC_SECONDS, epic_rtc_get_monotonic_seconds()
  • API_RTC_GET_MONOTONIC_MILLISECONDS epic_rtc_get_monotonic_milliseconds()

Pycardium APIs added:

  • utime.monotonic()
  • utime.monotonic_ms()

It also fixes the decoding function from subseconds to milliseconds in epic_rtc_get_milliseconds(). The previous version was not numerically stable. See explanation in the commit message of 756c13df.

Edited by Ferdinand Bachmann

Merge request reports