move port specific check
This commit is contained in:
parent
6c59836c5d
commit
10e8b8cf45
@ -93,6 +93,9 @@ void common_hal_watchdog_feed(watchdog_watchdogtimer_obj_t *self) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void common_hal_watchdog_deinit(watchdog_watchdogtimer_obj_t *self) {
|
void common_hal_watchdog_deinit(watchdog_watchdogtimer_obj_t *self) {
|
||||||
|
if (self->mode == WATCHDOGMODE_RESET) {
|
||||||
|
mp_raise_NotImplementedError(translate("WatchDogTimer cannot be deinitialized once mode is set to RESET"));
|
||||||
|
}
|
||||||
if (timer) {
|
if (timer) {
|
||||||
timer_free();
|
timer_free();
|
||||||
}
|
}
|
||||||
|
@ -66,6 +66,7 @@ STATIC mp_obj_t watchdog_watchdogtimer_feed(mp_obj_t self_in) {
|
|||||||
if (current_mode == WATCHDOGMODE_NONE) {
|
if (current_mode == WATCHDOGMODE_NONE) {
|
||||||
mp_raise_ValueError(translate("WatchDogTimer is not currently running"));
|
mp_raise_ValueError(translate("WatchDogTimer is not currently running"));
|
||||||
}
|
}
|
||||||
|
|
||||||
common_hal_watchdog_feed(self);
|
common_hal_watchdog_feed(self);
|
||||||
return mp_const_none;
|
return mp_const_none;
|
||||||
}
|
}
|
||||||
@ -78,12 +79,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(watchdog_watchdogtimer_feed_obj, watchdog_watch
|
|||||||
//|
|
//|
|
||||||
STATIC mp_obj_t watchdog_watchdogtimer_deinit(mp_obj_t self_in) {
|
STATIC mp_obj_t watchdog_watchdogtimer_deinit(mp_obj_t self_in) {
|
||||||
watchdog_watchdogtimer_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
watchdog_watchdogtimer_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||||
watchdog_watchdogmode_t current_mode = common_hal_watchdog_get_mode(self);
|
|
||||||
|
|
||||||
if (current_mode == WATCHDOGMODE_RESET) {
|
|
||||||
mp_raise_NotImplementedError(translate("WatchDogTimer cannot be deinitialized once mode is set to RESET"));
|
|
||||||
}
|
|
||||||
|
|
||||||
common_hal_watchdog_deinit(self);
|
common_hal_watchdog_deinit(self);
|
||||||
return mp_const_none;
|
return mp_const_none;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user