Merge pull request #6324 from tekktrik/doc/add-watchdog-timeout-docs

Add documentation for watchdog.WatchDogTimeout
This commit is contained in:
Mark 2022-04-29 23:35:36 -05:00 committed by GitHub
commit b598ec0ddb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 26 additions and 0 deletions

View File

@ -49,7 +49,33 @@
//| w.timeout=2.5 # Set a timeout of 2.5 seconds //| w.timeout=2.5 # Set a timeout of 2.5 seconds
//| w.mode = WatchDogMode.RAISE //| w.mode = WatchDogMode.RAISE
//| w.feed()""" //| w.feed()"""
//| class WatchDogTimeout(Exception):
//| """Exception raised when the watchdog timer is set to
//| ``WatchDogMode.RAISE`` and expires.
//| //|
//| Example::
//|
//| import microcontroller
//| import watchdog
//| import time
//|
//| wdt = microcontroller.watchdog
//| wdt.timeout = 5
//|
//| while True:
//| wdt.mode = watchdog.WatchDogMode.RAISE
//| print("Starting loop -- should exit after five seconds")
//| try:
//| while True:
//| time.sleep(10) # Also works with pass
//| except watchdog.WatchDogTimeout as e:
//| print("Watchdog expired")
//| except Exception as e:
//| print("Other exception")
//|
//| print("Exited loop")
//| """
const mp_obj_type_t mp_type_WatchDogTimeout = { const mp_obj_type_t mp_type_WatchDogTimeout = {
{ &mp_type_type }, { &mp_type_type },