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

Francisco notifications at github.com
Tue Jul 9 11:24:14 CEST 2019


> wdt_stop() will only be compiled if the application add "periph/wdt" to "USEMODULE". Adding "periph/wdt" to "FEATURES_OPTIONAL" or "FEATURES_REQUIRED" does that implicitly. (If the target board doesn't support the feature, USEMODULE or FEATURES_REQUIRED" will fail at build time, FEATURES_OPTIONAL will just not add periph_wdt to USEMODULE.).
> At that point, an application can use the wdt_* functions. The linker will ensure that unused functions won't enlarge the binary.

I'll try to explain what I meant again. For many platforms`wdt` can't be stopped, once enabled it runs until a system reset, so `wdt_stop()` does nothing. A use case examples is an application where I would want to turn-off the `wdt` before entering sleep mode. If possible that means I can just go to sleep and start it again on wake-up. But if I can't really stop the `wdt` then I must implement something(`rtc alarm`) that will wake-up just before the `wdt` ends, reset it, and the immediately go to sleep. In this case both platforms would be supporting `wdt` but one of them can `stop` it and the other not. 

In that case I could do something like:

```
 // somewhere else in the application for platforms with `wdt`
 wdt_setup_reboot(0, MAX_TIME);
 wdt_start();

#ifdef MODULE_WDT_STOP
    wdt_stop()
#else 
   // a callback that will reset the counter, etc...
   rtc_set_alarm()
#endif
```

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/11527#issuecomment-509565301
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190709/41ea1f44/attachment-0001.html>


More information about the notifications mailing list