2015-06-10 22:29:56 +01:00
|
|
|
.. _pyb.WDT:
|
|
|
|
|
|
|
|
class WDT -- watchdog timer
|
|
|
|
===========================
|
|
|
|
|
|
|
|
The WDT is used to restart the system when the application crashes and ends
|
|
|
|
up into a non recoverable state. Once started it cannot be stopped or
|
|
|
|
reconfigured in any way. After enabling, the application must "kick" the
|
|
|
|
watchdog periodically to prevent it from expiring and resetting the system.
|
|
|
|
|
|
|
|
Example usage::
|
|
|
|
|
2015-09-13 16:06:12 +01:00
|
|
|
wdt = pyb.WDT(timeout=2000) # enable with a timeout of 2s
|
|
|
|
wdt.feed()
|
2015-06-10 22:29:56 +01:00
|
|
|
|
|
|
|
Constructors
|
|
|
|
------------
|
|
|
|
|
2015-09-13 16:06:12 +01:00
|
|
|
.. class:: pyb.WDT(id=0, timeout=5000)
|
2015-06-10 22:29:56 +01:00
|
|
|
|
2015-09-13 16:06:12 +01:00
|
|
|
Create a WDT object and start it. The timeout must be given in seconds and
|
|
|
|
the minimum value that is accepted is 1 second. Once it is running the timeout
|
|
|
|
cannot be changed and the WDT cannot be stopped either.
|
2015-06-10 22:29:56 +01:00
|
|
|
|
|
|
|
Methods
|
|
|
|
-------
|
|
|
|
|
2015-09-13 16:06:12 +01:00
|
|
|
.. method:: wdt.feed()
|
2015-06-10 22:29:56 +01:00
|
|
|
|
2015-09-13 16:06:12 +01:00
|
|
|
Feed the WDT to prevent it from resetting the system. The application
|
2015-06-10 22:29:56 +01:00
|
|
|
should place this call in a sensible place ensuring that the WDT is
|
2015-09-13 16:06:12 +01:00
|
|
|
only fed after verifying that everything is functioning correctly.
|