@@ -44,8 +44,7 @@ extern "C" {
4444 * * Shutdown mode doesn't stop RTC from counting - Not verified.
4545 * * The functions ::rtc_write/::rtc_read provides availability to set/get RTC time
4646 * - Verified by test rtc_write_read_test.
47- * * The functions ::rtc_isenabled returns 1 if the RTC is counting and the time has been set,
48- * 0 otherwise - Verified by test rtc_enabled_test.
47+ * * The function ::rtc_isenabled returns 1 if the RTC has been initialized and is counting and 0 otherwise - Verified by test rtc_enabled_test.
4948 * * ::rtc_read may be called before rtc_write. If the RTC time has not been set, this will return the
5049 * time since some arbitrary epoch. If the RTC time was set on a previous boot, this will return time
5150 * based on what was set then.
@@ -115,13 +114,23 @@ void rtc_init(void);
115114 * POWER_CTRL &= ~POWER_CTRL_RTC_Msk;
116115 * }
117116 * @endcode
117+ *
118+ * @note Implementations are allowed to not implement this function if it's impossible or there is
119+ * no significant benefit to disabling the RTC. As such, the RTC is allowed to remain initialized
120+ * after this function is called if freeing the RTC is not implemented.
118121 */
119122void rtc_free (void );
120123
121- /** Check if the RTC has the time set and is counting
124+ /** Check if the RTC has been initialized and is counting
122125 *
123126 * @retval 0 The time reported by the RTC is not valid
124- * @retval 1 The time has been set the RTC is counting
127+ * @retval 1 The RTC has been initialized and is counting
128+ *
129+ * @note In versions of Mbed before 7.0, this function claimed to return false "if the time had not been set."
130+ * However, this was flawed because, in most implementations, it only returned true if the time had been
131+ * set *on this boot*. There wasn't, and isn't, a way to detect whether the time was set correctly by a previous
132+ * boot. To answer that question, you may wish to check if the time is approximately valid (in the 21st
133+ * century), or add another flag at the application level.
125134 *
126135 * Example Implementation Pseudo Code:
127136 * @code
0 commit comments