[riot-notifications] [RIOT-OS/RIOT] rtt_rtc: allow to use RTC emulation together with RTT alarms (#15763)

benpicco notifications at github.com
Wed Jan 13 20:52:55 CET 2021

### Contribution description

Some RTT implementations provide a separate overflow callback.
`rtt_rtc` was originally designed to work with the most basic RTT: It only needs a monotonic counter and an alarm callback that is shared between overflow and RTC alarm.

If we use the overflow callback, this frees up the alarm callback for direct use with the RTT API.

This means that if an RTT provides the alarm callback and the user treads it as a monotonic counter (no calls to `rtt_set_counter()`), both `rtc_rtt` and the `periph_rtt` API can be used together.

The user also must make sure to either use RTC or RTT alarms as they will overwrite each other.

But this allows to track & adjust the time without having to re-calculate RTT alarms if the time is changed due to synchronization.

### Testing procedure

So far I only tested `tests/periph_rtc` with `rtt_rtc` instead of `periph_rtc` both with and without the overflow callback support.
Both worked as expected.  

### Issues/PRs references

Examples: Fixes #1234. See also #5678. Depends on PR #9876.

Please use keywords (e.g., fixes, resolve) with the links to the issues you
resolved, this way they will be automatically closed when your pull request
is merged. See https://help.github.com/articles/closing-issues-using-keywords/.

You can view, comment on, or merge this pull request online at:


-- Commit Summary --

  * cpu/sam0_common: only include RTC/RTT symbols if module is used
  * rtt_rtc: make use of RTT overflow callback when available
  * cpu: add periph_rtt_overflow feature

-- File Changes --

    M cpu/atmega_common/Kconfig (1)
    M cpu/atmega_common/Makefile.features (1)
    M cpu/cc2538/Kconfig (1)
    M cpu/cc2538/Makefile.features (1)
    M cpu/efm32/Kconfig (1)
    M cpu/efm32/Makefile.features (1)
    M cpu/esp32/Kconfig (1)
    M cpu/esp32/Makefile.features (1)
    M cpu/kinetis/Kconfig (1)
    M cpu/kinetis/Makefile.features (1)
    M cpu/nrf5x_common/Kconfig (1)
    M cpu/nrf5x_common/Makefile.features (1)
    M cpu/sam0_common/Kconfig (1)
    M cpu/sam0_common/Makefile.features (1)
    M cpu/sam0_common/periph/rtc_rtt.c (122)
    M cpu/stm32/Kconfig (1)
    M cpu/stm32/Makefile.features (1)
    M drivers/rtt_rtc/Makefile.dep (1)
    M drivers/rtt_rtc/rtt_rtc.c (47)
    M kconfigs/Kconfig.features (5)

-- Patch Links --


You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20210113/088fe5df/attachment.htm>

More information about the notifications mailing list