33
33
#endif /* ARDUINO_ARCH_SAMD */
34
34
35
35
#ifdef ARDUINO_ARCH_MBED
36
- # include < watchdog_api .h>
36
+ # include < drivers/Watchdog .h>
37
37
# define PORTENTA_H7_WATCHDOG_MAX_TIMEOUT_ms (32760 )
38
38
# define NANO_RP2040_WATCHDOG_MAX_TIMEOUT_ms (8389 )
39
39
# define EDGE_CONTROL_WATCHDOG_MAX_TIMEOUT_ms (65536 )
42
42
/* *****************************************************************************
43
43
* GLOBAL VARIABLES
44
44
******************************************************************************/
45
- #if defined(ARDUINO_ARCH_SAMD) || defined(ARDUINO_ARCH_MBED)
45
+ #if defined(ARDUINO_ARCH_SAMD)
46
46
static bool is_watchdog_enabled = false ;
47
47
#endif
48
48
@@ -96,18 +96,15 @@ static void mbed_watchdog_enable()
96
96
# error "You need to define the maximum possible timeout for this architecture."
97
97
#endif
98
98
99
- if (hal_watchdog_init (&cfg) == WATCHDOG_STATUS_OK) {
100
- is_watchdog_enabled = true ;
101
- }
102
- else {
99
+ if (!mbed::Watchdog::get_instance ().start (cfg.timeout_ms )) {
103
100
DEBUG_WARNING (" %s: watchdog could not be enabled" , __FUNCTION__);
104
101
}
105
102
}
106
103
107
104
static void mbed_watchdog_reset ()
108
105
{
109
- if (is_watchdog_enabled ) {
110
- hal_watchdog_kick ();
106
+ if (mbed::Watchdog::get_instance (). is_running () ) {
107
+ mbed::Watchdog::get_instance (). kick ();
111
108
}
112
109
}
113
110
@@ -131,21 +128,6 @@ static void mbed_watchdog_enable_network_feed(NetworkAdapter ni)
131
128
#endif
132
129
}
133
130
}
134
-
135
- void mbed_watchdog_trigger_reset ()
136
- {
137
- watchdog_config_t cfg;
138
- cfg.timeout_ms = 1 ;
139
-
140
- if (hal_watchdog_init (&cfg) == WATCHDOG_STATUS_OK) {
141
- is_watchdog_enabled = true ;
142
- while (1 ){}
143
- }
144
- else {
145
- DEBUG_WARNING (" %s: watchdog could not be reconfigured" , __FUNCTION__);
146
- }
147
-
148
- }
149
131
#endif /* ARDUINO_ARCH_MBED */
150
132
151
133
#if defined (ARDUINO_ARCH_SAMD) || defined (ARDUINO_ARCH_MBED)
0 commit comments