<h3>Contribution description</h3>
<p>This pr makes <code>rtc</code> use the RTC peripheral and <code>rtt</code> use the <code>RTT</code> peripheral. This wants to remove the remaining od-ball that is <code>kinetis</code>, with this we can simply do:</p>
<div class="snippet-clipboard-content position-relative" data-snippet-clipboard-copy-content="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
"><pre><code>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
</code></pre></div>
<p>And have <code>rtt</code> always pulled as the <code>ztimer_msec</code> backend if available.</p>
<h3>Testing procedure</h3>
<p>On all kinetis as possible run</p>
<ul>
<li><code>tests/periph_rtt</code></li>
</ul>
<div class="snippet-clipboard-content position-relative" data-snippet-clipboard-copy-content="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`

"><pre><code>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`

</code></pre></div>
<p>main(): This is RIOT! (Version: 2021.07-devel-323-g3aa10-pr_kinetis_lptmr_rtt)</p>
<p>RIOT RTC low-level driver test<br>
This test will display 'Alarm!' every 2 seconds for 4 times<br>
Setting clock to   2020-02-28 23:59:57<br>
Clock value is now   2020-02-28 23:59:57<br>
Setting alarm to   2020-02-28 23:59:59<br>
Alarm is set to   2020-02-28 23:59:59<br>
Alarm cleared at   2020-02-28 23:59:59<br>
No alarm at   2020-02-28 23:59:59<br>
Setting alarm to   2020-02-28 23:59:61</p>
<p>Alarm!<br>
Alarm!<br>
Alarm!<br>
Alarm!</p>
<div class="snippet-clipboard-content position-relative" data-snippet-clipboard-copy-content="

### 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/.
-->
"><pre><code>

### 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/.
-->
</code></pre></div>

<hr>

<h4>You can view, comment on, or merge this pull request online at:</h4>
<p>  <a href='https://github.com/RIOT-OS/RIOT/pull/16546'>https://github.com/RIOT-OS/RIOT/pull/16546</a></p>

<h4>Commit Summary</h4>
<ul>
  <li>kinetis/rtc: use RTC directly</li>
  <li>cpu/kinetis: use LPTMR as rtt backend</li>
</ul>

<h4>File Changes</h4>
<ul>
  <li>
    <strong>M</strong>
    <a href="https://github.com/RIOT-OS/RIOT/pull/16546/files#diff-5a5c224b2c1f9b965bf3371e6872a14b3ffc7d53b58462ed94b0089716e2d4de">boards/common/kw41z/Makefile.features</a>
    (2)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/RIOT-OS/RIOT/pull/16546/files#diff-9d053a35b7745bbfa4ae30aceb5382a07b23a1ed7afcc730cbdc7f9f58d0d54e">boards/frdm-kl43z/include/board.h</a>
    (2)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/RIOT-OS/RIOT/pull/16546/files#diff-17cc7b7b8e04e0099d11140ee98c9477b16ac221f44b6e684fdd5bb68e18b301">boards/frdm-kw41z/include/board.h</a>
    (2)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/RIOT-OS/RIOT/pull/16546/files#diff-a384b5ea606a45cf1b955e93da0c2135f40a1025380d8fff4b8d5a90b616f5fc">boards/openlabs-kw41z-mini/include/board.h</a>
    (2)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/RIOT-OS/RIOT/pull/16546/files#diff-4908e97894f72d50a40f356ae13807bd3a1a0522d2a37874840fad1881e3eb23">boards/phynode-kw41z/include/board.h</a>
    (2)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/RIOT-OS/RIOT/pull/16546/files#diff-bcfdd690b91ea41ba3f097f62e99e7048fb06095201f31126b5cd396a9fad5fa">boards/usb-kw41z/include/board.h</a>
    (2)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/RIOT-OS/RIOT/pull/16546/files#diff-1d5625b5f2d532c6b1d934798f8305795bdf10b1ff7a293ab9b02e2dfce5e894">cpu/kinetis/Makefile.dep</a>
    (4)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/RIOT-OS/RIOT/pull/16546/files#diff-70de7611888145d427c39103478523dc1356037971af33a681a6cfa702ac6440">cpu/kinetis/Makefile.features</a>
    (2)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/RIOT-OS/RIOT/pull/16546/files#diff-6a14b6a59eb8108b5274c945ccdc24d356e14c304974bfd41982b3234ed984f4">cpu/kinetis/include/periph_cpu.h</a>
    (36)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/RIOT-OS/RIOT/pull/16546/files#diff-34103fb1b46b520a05446b542637ec379e4ee7c3ce945f78720a330c2dcf77b3">cpu/kinetis/periph/rtc.c</a>
    (112)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/RIOT-OS/RIOT/pull/16546/files#diff-4a24d70c37c233d00e4ee24fdca334669523c728f0fac6d4d2dd8f8c6a13e310">cpu/kinetis/periph/rtt.c</a>
    (145)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/RIOT-OS/RIOT/pull/16546/files#diff-46b6d488246e1461a4fb0b8ed1cd86a506418dbfa541a53db47614959a17d3a6">tests/periph_rtt/Makefile</a>
    (2)
  </li>
</ul>

<h4>Patch Links:</h4>
<ul>
  <li><a href='https://github.com/RIOT-OS/RIOT/pull/16546.patch'>https://github.com/RIOT-OS/RIOT/pull/16546.patch</a></li>
  <li><a href='https://github.com/RIOT-OS/RIOT/pull/16546.diff'>https://github.com/RIOT-OS/RIOT/pull/16546.diff</a></li>
</ul>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/RIOT-OS/RIOT/pull/16546">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/ABE7WYCMMWRPE74FPFGABC3TSIX6NANCNFSM46RBBLUA">unsubscribe</a>.<img src="https://github.com/notifications/beacon/ABE7WYHUTUEJE55BRL5NDGLTSIX6NA5CNFSM46RBBLUKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4NWF2VFQ.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/RIOT-OS/RIOT/pull/16546",
"url": "https://github.com/RIOT-OS/RIOT/pull/16546",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>