Add documentation for watchdog.WatchDogTimeout

This commit is contained in:
Alec Delaney 2022-04-29 11:41:22 -06:00
parent 816a26e8b7
commit 9a23923b2d
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.mode = WatchDogMode.RAISE
//| 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 = {
{ &mp_type_type },