Skip to content

Commit 10e8b8c

Browse files
committed
move port specific check
1 parent 6c59836 commit 10e8b8c

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

ports/nrf/common-hal/watchdog/WatchDogTimer.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,9 @@ void common_hal_watchdog_feed(watchdog_watchdogtimer_obj_t *self) {
9393
}
9494

9595
void common_hal_watchdog_deinit(watchdog_watchdogtimer_obj_t *self) {
96+
if (self->mode == WATCHDOGMODE_RESET) {
97+
mp_raise_NotImplementedError(translate("WatchDogTimer cannot be deinitialized once mode is set to RESET"));
98+
}
9699
if (timer) {
97100
timer_free();
98101
}

shared-bindings/watchdog/WatchDogTimer.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ STATIC mp_obj_t watchdog_watchdogtimer_feed(mp_obj_t self_in) {
6666
if (current_mode == WATCHDOGMODE_NONE) {
6767
mp_raise_ValueError(translate("WatchDogTimer is not currently running"));
6868
}
69+
6970
common_hal_watchdog_feed(self);
7071
return mp_const_none;
7172
}
@@ -78,12 +79,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(watchdog_watchdogtimer_feed_obj, watchdog_watch
7879
//|
7980
STATIC mp_obj_t watchdog_watchdogtimer_deinit(mp_obj_t self_in) {
8081
watchdog_watchdogtimer_obj_t *self = MP_OBJ_TO_PTR(self_in);
81-
watchdog_watchdogmode_t current_mode = common_hal_watchdog_get_mode(self);
82-
83-
if (current_mode == WATCHDOGMODE_RESET) {
84-
mp_raise_NotImplementedError(translate("WatchDogTimer cannot be deinitialized once mode is set to RESET"));
85-
}
86-
8782
common_hal_watchdog_deinit(self);
8883
return mp_const_none;
8984
}

0 commit comments

Comments
 (0)