[riot-notifications] [RIOT-OS/RIOT] cpu/kinetis: use LPTMR as rtt backend (#16546)

Francisco notifications at github.com
Fri Jun 11 18:05:58 CEST 2021


### Contribution description

This pr makes `rtc` use the RTC peripheral and `rtt` use the `RTT` peripheral. This wants to remove the remaining od-ball that is `kinetis`, with this we can simply do:

```
ifneq (,$(filter ztimer_msec,$(USEMODULE))
  FEATURES_OPTIONAL += periph_rtt
  ifneq (,$(filter periph_rtt,$(FEATURES_USED)))
    USEMODULE += ztimer_periph_rtt
  endif
endif

ifneq (,$(filter stm32 nrf52 sam%,$(CPU)))
  RTT_FREQUENCY ?= RTT_MAX_FREQUENCY
  CFLAGS += -DRTT_FREQUENCY=$(RTT_FREQUENCY)
endif
```
 And have `rtt` always pulled as the `ztimer_msec` backend if available.

### Testing procedure

On all kinetis as possible run

- `tests/periph_rtt`

```
2021-06-11 17:59:01,668 # main(): This is RIOT! (Version: 2021.07-devel-322-g92924-HEAD)
2021-06-11 17:59:01,668 # 
2021-06-11 17:59:01,671 # RIOT RTT low-level driver test
2021-06-11 17:59:01,673 # RTT configuration:
2021-06-11 17:59:01,675 # RTT_MAX_VALUE: 0x0000ffff
2021-06-11 17:59:01,677 # RTT_FREQUENCY: 1024
2021-06-11 17:59:01,677 # 
2021-06-11 17:59:01,680 # Testing the tick conversion
2021-06-11 17:59:01,683 # Trying to convert 1 to seconds and back
2021-06-11 17:59:01,687 # Trying to convert 256 to seconds and back
2021-06-11 17:59:01,691 # Trying to convert 65536 to seconds and back
2021-06-11 17:59:01,694 # Trying to convert 16777216 to seconds and back
2021-06-11 17:59:01,699 # Trying to convert 2147483648 to seconds and back
2021-06-11 17:59:01,700 # All ok
2021-06-11 17:59:01,700 # 
2021-06-11 17:59:01,702 # Initializing the RTT driver
2021-06-11 17:59:01,707 # This test will now display 'Hello' every 5 seconds
2021-06-11 17:59:01,707 # 
2021-06-11 17:59:01,708 # RTT now: 4
2021-06-11 17:59:01,711 # Setting initial alarm to now + 5 s (5124)
2021-06-11 17:59:01,714 # rtt_get_alarm() PASSED
2021-06-11 17:59:01,718 # Done setting up the RTT, wait for many Hellos
2021-06-11 17:59:06,708 # Hello
2021-06-11 17:59:11,708 # Hello
2021-06-11 17:59:16,708 # Hello
2021-06-11 17:59:21,709 # Hello
2021-06-11 17:59:26,709 # Hello
2021-06-11 17:59:31,709 # Hello
2021-06-11 17:59:36,709 # Hello
2021-06-11 17:59:41,708 # Hello
2021-06-11 17:59:46,709 # Hello
`

- `tests/periph_rtc`
- 
```
main(): This is RIOT! (Version: 2021.07-devel-323-g3aa10-pr_kinetis_lptmr_rtt)

RIOT RTC low-level driver test
This test will display 'Alarm!' every 2 seconds for 4 times
  Setting clock to   2020-02-28 23:59:57
Clock value is now   2020-02-28 23:59:57
  Setting alarm to   2020-02-28 23:59:59
   Alarm is set to   2020-02-28 23:59:59
  Alarm cleared at   2020-02-28 23:59:59
       No alarm at   2020-02-28 23:59:59
  Setting alarm to   2020-02-28 23:59:61

Alarm!
Alarm!
Alarm!
Alarm!
```


### 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:

  https://github.com/RIOT-OS/RIOT/pull/16546

-- Commit Summary --

  * kinetis/rtc: use RTC directly
  * cpu/kinetis: use LPTMR as rtt backend

-- File Changes --

    M boards/common/kw41z/Makefile.features (2)
    M boards/frdm-kl43z/include/board.h (2)
    M boards/frdm-kw41z/include/board.h (2)
    M boards/openlabs-kw41z-mini/include/board.h (2)
    M boards/phynode-kw41z/include/board.h (2)
    M boards/usb-kw41z/include/board.h (2)
    M cpu/kinetis/Makefile.dep (4)
    M cpu/kinetis/Makefile.features (2)
    M cpu/kinetis/include/periph_cpu.h (36)
    M cpu/kinetis/periph/rtc.c (112)
    M cpu/kinetis/periph/rtt.c (145)
    M tests/periph_rtt/Makefile (2)

-- Patch Links --

https://github.com/RIOT-OS/RIOT/pull/16546.patch
https://github.com/RIOT-OS/RIOT/pull/16546.diff

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/16546
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20210611/1d2b4f86/attachment.htm>


More information about the notifications mailing list