summaryrefslogtreecommitdiff
path: root/shared-bindings
diff options
context:
space:
mode:
authorSean Cross <sean@xobs.io>2020-05-22 18:52:21 +0800
committerSean Cross <sean@xobs.io>2020-05-27 11:28:49 +0800
commitc7efc94a336091a1e6d79e94a9e80b31e5d5fc3f (patch)
tree393c4f56a319dfb6c3640322f2a86879f16f1ebc /shared-bindings
parentc5c13a8ba14490c94fd7409bae0183e59b5767f4 (diff)
watchdog: move timeout exception to shared-bindings
Make this exception globally available to all platforms that have enabled the watchdog timer. Signed-off-by: Sean Cross <sean@xobs.io>
Diffstat (limited to 'shared-bindings')
-rw-r--r--shared-bindings/watchdog/__init__.c16
-rw-r--r--shared-bindings/watchdog/__init__.h2
2 files changed, 18 insertions, 0 deletions
diff --git a/shared-bindings/watchdog/__init__.c b/shared-bindings/watchdog/__init__.c
index 36993db93..7f818b226 100644
--- a/shared-bindings/watchdog/__init__.c
+++ b/shared-bindings/watchdog/__init__.c
@@ -55,6 +55,22 @@
//| w.feed()"""
//|
+const mp_obj_type_t mp_type_WatchDogTimeout = {
+ { &mp_type_type },
+ .name = MP_QSTR_WatchDogTimeout,
+ .make_new = mp_obj_exception_make_new,
+ .attr = mp_obj_exception_attr,
+ .parent = &mp_type_Exception,
+};
+
+mp_obj_exception_t mp_watchdog_timeout_exception = {
+ .base.type = &mp_type_WatchDogTimeout,
+ .traceback_alloc = 0,
+ .traceback_len = 0,
+ .traceback_data = NULL,
+ .args = (mp_obj_tuple_t*)&mp_const_empty_tuple_obj,
+};
+
STATIC const mp_rom_map_elem_t watchdog_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_watchdog) },
{ MP_ROM_QSTR(MP_QSTR_WatchDogMode), MP_ROM_PTR(&watchdog_watchdogmode_type) },
diff --git a/shared-bindings/watchdog/__init__.h b/shared-bindings/watchdog/__init__.h
index 7203b8aa5..b5a0ad71d 100644
--- a/shared-bindings/watchdog/__init__.h
+++ b/shared-bindings/watchdog/__init__.h
@@ -28,5 +28,7 @@
#define MICROPY_INCLUDED_SHARED_BINDINGS_WATCHDOG___INIT___H
extern const mp_obj_module_t watchdog_module;
+extern mp_obj_exception_t mp_watchdog_timeout_exception;
+extern const mp_obj_type_t mp_type_WatchDogTimeout;
#endif // MICROPY_INCLUDED_SHARED_BINDINGS_WATCHDOG___INIT___H