From ae950bc050fc9c7ee675d0a4d52f352ebc24a369 Mon Sep 17 00:00:00 2001 From: Sean Cross Date: Thu, 21 May 2020 20:45:03 +0800 Subject: add WatchDogTimeout exception This adds an exception to be raised when the WatchDogTimer times out. Note that this currently causes a HardFault, and it's not clear why it's not behaving properly. Signed-off-by: Sean Cross --- py/runtime.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'py/runtime.c') diff --git a/py/runtime.c b/py/runtime.c index 59dcbc7a1..02352ea6c 100644 --- a/py/runtime.c +++ b/py/runtime.c @@ -86,6 +86,15 @@ void mp_init(void) { MP_STATE_VM(mp_kbd_exception).args = (mp_obj_tuple_t*)&mp_const_empty_tuple_obj; #endif + #if CIRCUITPY_WATCHDOG + // initialise the exception object for raising WatchDogTimeout + MP_STATE_VM(mp_kbd_exception).base.type = &mp_type_WatchDogTimeout; + MP_STATE_VM(mp_kbd_exception).traceback_alloc = 0; + MP_STATE_VM(mp_kbd_exception).traceback_len = 0; + MP_STATE_VM(mp_kbd_exception).traceback_data = NULL; + MP_STATE_VM(mp_kbd_exception).args = (mp_obj_tuple_t*)&mp_const_empty_tuple_obj; + #endif + MP_STATE_VM(mp_reload_exception).base.type = &mp_type_ReloadException; MP_STATE_VM(mp_reload_exception).traceback_alloc = 0; MP_STATE_VM(mp_reload_exception).traceback_len = 0; -- cgit v1.2.3