Skip to content

Conversation

@multiplemonomials
Copy link
Collaborator

Summary of changes

My previous PR, #502, identified some issues with the RTC driver's isenabled() method and added a new test. However, turns out I kinda half-assed it: the test was failing on the targets that I have set up for CI, and I also didn't properly update the documentation.

This PR fixes that problem, at least for the targets I have ready access to. I updated the documentation to better explain the new behavior and updated the target code to fix all the test failures.

Note that there may still be some targets with inconsistent behavior of this function, but I expect to catch those as more targets are added to the CI tests. Also, this function's behavior was never very consistent to begin with, so I am not really sure if this is a behavior "change" as much as a behavior "clarification".

Impact of changes

  • Updated defined behavior of rtc_isenabled()
  • On Freescale Kinetis MCUs, STM32 MCUs, and LPC1768, the rtc_isenabled() function now conforms to the new defined behavior instead of (in most cases) only returning true once the RTC time has been set on the current boot

Migration actions required

If you were using RealTimeClock::isenabled() to detect whether the time had been set yet on the current boot, you will need to instead track that with a flag at the application level. (the behavior of this function was not consistent across targets but on many targets it used to have that behavior)

Documentation

Code docs updated


Pull request type

[] Patch update (Bug fix / Target update / Docs update / Test update / Refactor)
[] Feature update (New feature / Functionality change / New API)
[X] Major update (Breaking change E.g. Return code change / API behaviour change)

Test results

[] No Tests required for this change (E.g docs only update)
[] Covered by existing mbed-os tests (Greentea or Unittest)
[X] Tests / results supplied as part of this PR

Ran the RTC tests on my six CI boards and they all pass now!


* - Verified by test rtc_write_read_test.
* * The functions ::rtc_isenabled returns 1 if the RTC is counting and the time has been set,
* 0 otherwise - Verified by test rtc_enabled_test.
* * The function ::rtc_isenabled returns 1 if the RTC has been initialized and 0 otherwise - Verified by test rtc_enabled_test.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Defined behaviour says: “returns 1 if the RTC has been initialized and 0 otherwise.”
Function says: “retval 1 The RTC has been initialized and is counting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants