machine.WDT.rst 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. .. currentmodule:: machine
  2. .. _machine.WDT:
  3. class WDT -- watchdog timer
  4. ===========================
  5. The WDT is used to restart the system when the application crashes and ends
  6. up into a non recoverable state. Once started it cannot be stopped or
  7. reconfigured in any way. After enabling, the application must "feed" the
  8. watchdog periodically to prevent it from expiring and resetting the system.
  9. Example usage::
  10. from machine import WDT
  11. wdt = WDT(timeout=2000) # enable it with a timeout of 2s
  12. wdt.feed()
  13. Availability of this class: pyboard, WiPy.
  14. Constructors
  15. ------------
  16. .. class:: WDT(id=0, timeout=5000)
  17. Create a WDT object and start it. The timeout must be given in seconds and
  18. the minimum value that is accepted is 1 second. Once it is running the timeout
  19. cannot be changed and the WDT cannot be stopped either.
  20. Methods
  21. -------
  22. .. method:: wdt.feed()
  23. Feed the WDT to prevent it from resetting the system. The application
  24. should place this call in a sensible place ensuring that the WDT is
  25. only fed after verifying that everything is functioning correctly.