[riot-notifications] [RIOT-OS/RIOT] drivers/include: add header definition for wdt (#11527)

Francisco notifications at github.com
Thu May 16 18:19:13 CEST 2019

fjmolinas commented on this pull request.

> +void wdt_setup_reboot(uint32_t min_time, uint32_t max_time);
+ * @brief    Set up the wdt timer, only use max_time if normal operation
+ *           set min_time and max_time for windowed timer.
+ *
+ * @param[in] min_time       lower bound for windowed watchdog in ms, has to be 0
+ *                           for normal mode operation
+ * @param[in] max_time       upper bound for windowed watchdog in ms, time before
+ *                           reset for normal watchdog
+ * @param[in] wdt_cb         wdt callback, can be NULL
+ * @param[in] arg            optional argument which is passed to the
+ *                           callback, can be NULL
+ */
+void wdt_setup_callback(uint32_t min_time, uint32_t max_time, wdt_cb_t wdt_cb, void* arg);

> I think this can be misleading: The watchdog will still trigger a reboot and behave just like with wdt_setup_reboot, the only difference being that wdt_cb is executed before the watchdog timer expires.

> BTW, we need an additional define for the time difference between warning callback and actual 

For sam21 its configurable in normal mode but matches the start of the window in windowed mode (which seems useless to me), for nrf52 its a different configurable value and for stm32 its fixed at when the downcounter hits 0x40. A define would work for stm32, nrf52 but would not work in the case of windowed operation for sam21, but proper DEBUG messages could state this behavior. 

> Having two functions for it make it seem like wdt_setup_callback would cause the callback to be called instead of the reboot, not in addition to it.

Splitting into two functions makes sense to me since we really have very different behaviors for the callback according to each platform, while normal operation is pretty uniform.

> Can we get away with asserts and log messages?


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/20190516/711795e7/attachment.html>

More information about the notifications mailing list