[riot-notifications] [RIOT-OS/RIOT] cpu: RTC implementation for STM32F1 (#11258)

Marian Buschsieweke notifications at github.com
Wed Apr 10 14:07:04 CEST 2019

maribu commented on this pull request.

> +}
+int rtc_set_alarm(struct tm *time, rtc_alarm_cb_t cb, void *arg)
+    /* enable global RTC interrupt */
+    if (cb && !NVIC_GetEnableIRQ(RTC_IRQn)) {
+        NVIC_EnableIRQ(RTC_IRQn);
+        DEBUG("%s enable RTC IRQ\n", __func__);
+    }
+    /* save callback and argument */
+    isr_ctx.cb = cb;
+    isr_ctx.arg = arg;
+    /* set wakeup time */
+    time_t timestamp = mktime(time);

> STM32f103 do not have EEPROM and RTC->BKP0R. Use rtc_set_alarm() is not good hack, but this may be one of the last chances.

There is nothing wrong with resorting to `RTC->BKP0R` for storing non-RTC data. But I strongly believe that the RTC-API is not to be used for that. Instead a different API could be provided to use that, if someone wants to do that. (Feel free to open a separate PR to just do that, if you have a use case for that. This PR should also handle that the register is not used simultaneously as RTC alarm and as storage - maybe as simple as having `rtc_set_alarm()` return `-1` if the RTC-storage-API is used.)

You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190410/27e5f27d/attachment-0001.html>

More information about the notifications mailing list