-
-
Notifications
You must be signed in to change notification settings - Fork 8.2k
ports/RTC: Attempt to reduce the inconsistencies between the port's RTC implementation. #10607
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
f2a106f
to
0c50a73
Compare
This is an automated heads-up that we've just merged a Pull Request See #13763 A search suggests this PR might apply the STATIC macro to some C code. If it Although this is an automated message, feel free to @-reply to me directly if |
@robert-hh thanks for working on this, sorry I didn't take proper notice of it until now. I think we should merge this. It fixes obvious inconsistencies and makes the docs match the code behaviour. Eventually we would bring all ports up to the same level of functionality (eg stm32) but for now this PR fixes things in a good way. My only comment/question is: does it make sense to remove the |
Thanks for looking into this. I was patient since you told to defer that until v2. Looking into the documentation for RTC.init(), it allows for a tuple between 3 and 8 items. The code for ESP32, MIMXRT and then SAMD requires ATM 8 items. Should I change the code or the documentation? Edit: rtc,.init() is missing as well at the ESP8266 port. Could be added there. |
If it's not much work, would be good to make samd work this way.
Supporting a variable number of arguments won't be easy, because the ports need to set all values at once. So I suggest to change the documentation, to make 8 arguments required. A variable number of arguments never worked anyway, so this doesn't break existing code. |
Updated. I noticed that ESP8266 does not have the rtc.init() method. I could add it, if it's worth the code size increase. |
Code size report:
|
I don't think it's worth it, so let's leave that out. |
Such that it matches the implementation and the documentation of the `machine.RTC` class. Signed-off-by: robert-hh <robert@hammelrath.com>
This is not part of the common machine API. It's dropped on the mimxrt port and kept only on the cc3200 port for legacy. Also show the port availability of `RTC.now()` in the documentation. Signed-off-by: robert-hh <robert@hammelrath.com>
This commit makes the argument ordering of `machine.RTC.init()` the same for all the ports that implement arguments to this method: cc3200, esp32, mimxrt and samd. The cc3200 argument ordering is used, which matches the documentation. Also document the availability and the differing semantics for the stm32 and renesas-ra port. Signed-off-by: robert-hh <robert@hammelrath.com>
Thanks for updating, now merged. |
Thank you. |
This PR follows the issue #10578 and #5553 and other discussions about the topic. It consists of the commits:
docs/quickref: Fix the documentation of rtc.datetime()
, which makes the documentation of rtc.datetime() consistent to the implementation for all ports.mimxrt/machine_rtc.c: Drop rtc.now()
Keep it at the WiPy port for legacy,ports/RTC: Rework the availability and interface of rtc.init()
, which drops rtc.init() from the SAMD port and makes it consistent to the documentation and the WiPy port for the ports ESP32 and MIMXRT. But rtc.init() could as well be dropped for the latter ones and just kept for WiPy.