Remove NONE from mode enum and doc tweaks

This commit is contained in:
Scott Shawcroft 2020-05-27 10:58:21 -07:00
parent 9380c34cf7
commit 1ed4978620
No known key found for this signature in database
GPG Key ID: 9349BC7E64B1921E
3 changed files with 18 additions and 9 deletions

View File

@ -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;
}

View File

@ -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."""

View File

@ -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