Add watchdog mode raise
This commit is contained in:
parent
10e8b8cf45
commit
146adca060
|
@ -27,12 +27,19 @@
|
|||
#include "py/runtime.h"
|
||||
#include "common-hal/watchdog/WatchDogTimer.h"
|
||||
|
||||
#include "shared-bindings/watchdog/__init__.h"
|
||||
#include "shared-bindings/microcontroller/__init__.h"
|
||||
|
||||
#include "esp_task_wdt.h"
|
||||
|
||||
void esp_task_wdt_isr_user_handler(void) {
|
||||
|
||||
mp_obj_exception_clear_traceback(MP_OBJ_FROM_PTR(&mp_watchdog_timeout_exception));
|
||||
MP_STATE_VM(mp_pending_exception) = &mp_watchdog_timeout_exception;
|
||||
#if MICROPY_ENABLE_SCHEDULER
|
||||
if (MP_STATE_VM(sched_state) == MP_SCHED_IDLE) {
|
||||
MP_STATE_VM(sched_state) = MP_SCHED_PENDING;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void common_hal_watchdog_feed(watchdog_watchdogtimer_obj_t *self) {
|
||||
|
|
|
@ -37,8 +37,7 @@ struct _watchdog_watchdogtimer_obj_t {
|
|||
watchdog_watchdogmode_t mode;
|
||||
};
|
||||
|
||||
// This needs to be called in order to disable the watchdog if it's set to
|
||||
// "RAISE". If set to "RESET", then the watchdog cannot be reset.
|
||||
// This needs to be called in order to disable the watchdog
|
||||
void watchdog_reset(void);
|
||||
|
||||
#endif // MICROPY_INCLUDED_ESP32S2_COMMON_HAL_WATCHDOG_WATCHDOGTIMER_H
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
#include "common-hal/busio/UART.h"
|
||||
#include "common-hal/pulseio/PulseIn.h"
|
||||
#include "common-hal/pwmio/PWMOut.h"
|
||||
#include "common-hal/watchdog/WatchDogTimer.h"
|
||||
#include "common-hal/wifi/__init__.h"
|
||||
#include "supervisor/memory.h"
|
||||
#include "supervisor/shared/tick.h"
|
||||
|
@ -119,6 +120,10 @@ void reset_port(void) {
|
|||
rtc_reset();
|
||||
#endif
|
||||
|
||||
#if CIRCUITPY_WATCHDOG
|
||||
watchdog_reset();
|
||||
#endif
|
||||
|
||||
#if CIRCUITPY_WIFI
|
||||
wifi_reset();
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue