summaryrefslogtreecommitdiff
path: root/shared-bindings
diff options
context:
space:
mode:
authorScott Shawcroft <scott@tannewt.org>2020-05-27 10:58:21 -0700
committerScott Shawcroft <scott@tannewt.org>2020-05-27 10:58:21 -0700
commit1ed4978620091179dbb082f1848bc221eb6d09bf (patch)
treed32baab95719a9ed72a561f246584412eebd4e52 /shared-bindings
parent9380c34cf744fb7d3a0a3116a4779f4e897c2ee1 (diff)
Remove NONE from mode enum and doc tweaks
Diffstat (limited to 'shared-bindings')
-rw-r--r--shared-bindings/watchdog/WatchDogMode.c3
-rw-r--r--shared-bindings/watchdog/WatchDogTimer.c14
-rw-r--r--shared-bindings/watchdog/__init__.c10
3 files changed, 18 insertions, 9 deletions
diff --git a/shared-bindings/watchdog/WatchDogMode.c b/shared-bindings/watchdog/WatchDogMode.c
index cc75a6ea4..369454c11 100644
--- a/shared-bindings/watchdog/WatchDogMode.c
+++ b/shared-bindings/watchdog/WatchDogMode.c
@@ -74,14 +74,13 @@ mp_obj_t watchdog_watchdogmode_type_to_obj(watchdog_watchdogmode_t mode) {
}
STATIC const mp_rom_map_elem_t watchdog_watchdogmode_locals_dict_table[] = {
- {MP_ROM_QSTR(MP_QSTR_NONE), MP_ROM_PTR(&mp_const_none_obj)},
{MP_ROM_QSTR(MP_QSTR_RAISE), MP_ROM_PTR(&watchdog_watchdogmode_raise_obj)},
{MP_ROM_QSTR(MP_QSTR_RESET), MP_ROM_PTR(&watchdog_watchdogmode_reset_obj)},
};
STATIC MP_DEFINE_CONST_DICT(watchdog_watchdogmode_locals_dict, watchdog_watchdogmode_locals_dict_table);
STATIC void watchdog_watchdogmode_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
- qstr runmode = MP_QSTR_NONE;
+ qstr runmode = MP_QSTR_None;
if (MP_OBJ_TO_PTR(self_in) == MP_ROM_PTR(&watchdog_watchdogmode_raise_obj)) {
runmode = MP_QSTR_RAISE;
}
diff --git a/shared-bindings/watchdog/WatchDogTimer.c b/shared-bindings/watchdog/WatchDogTimer.c
index 5411d0bef..52bda4c77 100644
--- a/shared-bindings/watchdog/WatchDogTimer.c
+++ b/shared-bindings/watchdog/WatchDogTimer.c
@@ -40,6 +40,20 @@
#include "supervisor/port.h"
+//| class WatchDogTimer:
+//| """Timer that is used to detect code lock ups and automatically reset the microcontroller
+//| when one is detected.
+//|
+//| A lock up is detected when the watchdog hasn't been fed after a given duration. So, make
+//| sure to call `feed` within the timeout.
+//| """
+//|
+
+//| def __init__(self, ):
+//| """Not currently dynamically supported. Access the sole instance through `microcontroller.watchdog`."""
+//| ...
+//|
+
//| def feed(self):
//| """Feed the watchdog timer. This must be called regularly, otherwise
//| the timer will expire."""
diff --git a/shared-bindings/watchdog/__init__.c b/shared-bindings/watchdog/__init__.c
index d0704b7cf..76e631729 100644
--- a/shared-bindings/watchdog/__init__.c
+++ b/shared-bindings/watchdog/__init__.c
@@ -34,18 +34,14 @@
//|
//| The `watchdog` module provides support for a Watchdog Timer. This timer will reset the device
//| if it hasn't been fed after a specified amount of time. This is useful to ensure the board
-//| has not crashed or locked up. You can enable the watchdog timer using :class:`wdt.WDT`.
-//| Note that on some platforms the watchdog timer cannot be disabled once it has been enabled.
+//| has not crashed or locked up. Note that on some platforms the watchdog timer cannot be disabled
+//| once it has been enabled.
//|
-//| The WatchDogTimer is used to restart the system when the application crashes and ends
+//| The `WatchDogTimer` is used to restart the system when the application crashes and ends
//| up into a non recoverable state. Once started it cannot be stopped or
//| reconfigured in any way. After enabling, the application must "feed" the
//| watchdog periodically to prevent it from expiring and resetting the system.
//|
-//| Note that this module can't be imported and used directly. The sole
-//| instance of :class:`WatchDogTimer` is available at
-//| :attr:`microcontroller.watchdog`.
-//|
//| Example usage::
//|
//| from microcontroller import watchdog as w