File tree Expand file tree Collapse file tree 4 files changed +25
-23
lines changed
ports/nrf/common-hal/watchdog Expand file tree Collapse file tree 4 files changed +25
-23
lines changed Original file line number Diff line number Diff line change @@ -50,22 +50,6 @@ STATIC nrfx_timer_t *timer = NULL;
50
50
STATIC nrfx_wdt_t wdt = NRFX_WDT_INSTANCE (0 );
51
51
STATIC nrfx_wdt_channel_id wdt_channel_id ;
52
52
53
- const mp_obj_type_t mp_type_WatchDogTimeout = {
54
- { & mp_type_type },
55
- .name = MP_QSTR_WatchDogTimeout ,
56
- .make_new = mp_obj_exception_make_new ,
57
- .attr = mp_obj_exception_attr ,
58
- .parent = & mp_type_Exception ,
59
- };
60
-
61
- mp_obj_exception_t mp_watchdog_timeout_exception = {
62
- .base .type = & mp_type_WatchDogTimeout ,
63
- .traceback_alloc = 0 ,
64
- .traceback_len = 0 ,
65
- .traceback_data = NULL ,
66
- .args = (mp_obj_tuple_t * )& mp_const_empty_tuple_obj ,
67
- };
68
-
69
53
STATIC void watchdogtimer_timer_event_handler (nrf_timer_event_t event_type , void * p_context ) {
70
54
watchdog_watchdogtimer_obj_t * self = MP_OBJ_TO_PTR (p_context );
71
55
if (event_type != NRF_TIMER_EVENT_COMPARE0 ) {
Original file line number Diff line number Diff line change 55
55
//| w.feed()"""
56
56
//|
57
57
58
+ const mp_obj_type_t mp_type_WatchDogTimeout = {
59
+ { & mp_type_type },
60
+ .name = MP_QSTR_WatchDogTimeout ,
61
+ .make_new = mp_obj_exception_make_new ,
62
+ .attr = mp_obj_exception_attr ,
63
+ .parent = & mp_type_Exception ,
64
+ };
65
+
66
+ mp_obj_exception_t mp_watchdog_timeout_exception = {
67
+ .base .type = & mp_type_WatchDogTimeout ,
68
+ .traceback_alloc = 0 ,
69
+ .traceback_len = 0 ,
70
+ .traceback_data = NULL ,
71
+ .args = (mp_obj_tuple_t * )& mp_const_empty_tuple_obj ,
72
+ };
73
+
58
74
STATIC const mp_rom_map_elem_t watchdog_module_globals_table [] = {
59
75
{ MP_ROM_QSTR (MP_QSTR___name__ ), MP_ROM_QSTR (MP_QSTR_watchdog ) },
60
76
{ MP_ROM_QSTR (MP_QSTR_WatchDogMode ), MP_ROM_PTR (& watchdog_watchdogmode_type ) },
Original file line number Diff line number Diff line change 28
28
#define MICROPY_INCLUDED_SHARED_BINDINGS_WATCHDOG___INIT___H
29
29
30
30
extern const mp_obj_module_t watchdog_module ;
31
+ extern mp_obj_exception_t mp_watchdog_timeout_exception ;
32
+ extern const mp_obj_type_t mp_type_WatchDogTimeout ;
31
33
32
34
#endif // MICROPY_INCLUDED_SHARED_BINDINGS_WATCHDOG___INIT___H
Original file line number Diff line number Diff line change @@ -44,6 +44,13 @@ static volatile uint64_t PLACE_IN_DTCM_BSS(background_ticks);
44
44
45
45
#include "shared-bindings/microcontroller/__init__.h"
46
46
47
+ #ifdef CIRCUITPY_WATCHDOG
48
+ #include "shared-bindings/watchdog/__init__.h"
49
+ #define WATCHDOG_EXCEPTION_CHECK () (MP_STATE_VM(mp_pending_exception) == &mp_watchdog_timeout_exception)
50
+ #else
51
+ #define WATCHDOG_EXCEPTION_CHECK () 0
52
+ #endif
53
+
47
54
void supervisor_tick (void ) {
48
55
#if CIRCUITPY_FILESYSTEM_FLUSH_INTERVAL_MS > 0
49
56
filesystem_tick ();
@@ -86,13 +93,6 @@ void PLACE_IN_ITCM(supervisor_run_background_tasks_if_tick)() {
86
93
run_background_tasks ();
87
94
}
88
95
89
- #ifdef CIRCUITPY_WATCHDOG
90
- extern mp_obj_exception_t mp_watchdog_timeout_exception ;
91
- #define WATCHDOG_EXCEPTION_CHECK () (MP_STATE_VM(mp_pending_exception) == &mp_watchdog_timeout_exception)
92
- #else
93
- #define WATCHDOG_EXCEPTION_CHECK () 0
94
- #endif
95
-
96
96
void mp_hal_delay_ms (mp_uint_t delay ) {
97
97
uint64_t start_tick = port_get_raw_ticks (NULL );
98
98
// Adjust the delay to ticks vs ms.
You can’t perform that action at this time.
0 commit comments