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

Marian Buschsieweke notifications at github.com
Wed Apr 10 12:47:20 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);

> I think that `cd` may be NULL. When `rtc_set_alarm()` use for wake up after standby callback not need.

You're right. Also, `void isr_rtc(void)` does properly check if `cb` is `NULL` prior to calling, so there is no risk of calling a `NULL`-function pointer :-)

> Alarm time save in standby mode. In alarm time in past may encode several bytes data. It is possible to save several bytes in the standby mode. Maybe it can be useful for processor who do not have EEPROM.

Someone re-purposing an RTC alarm to store and retrieve data would very likely not use the RTC API. But no other RTC implementation in RIOT does check for alarm time in the past nor is it required by the API doc. Therefore it would indeed be more consistent to not check here is well.

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/c1c27c5c/attachment-0001.html>

More information about the notifications mailing list