Remove NONE from mode enum and doc tweaks
This commit is contained in:
parent
9380c34cf7
commit
1ed4978620
@ -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;
|
||||
}
|
||||
|
@ -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."""
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user