39
39
# define EDGE_CONTROL_WATCHDOG_MAX_TIMEOUT_ms (65536 )
40
40
#endif /* ARDUINO_ARCH_MBED */
41
41
42
- #include < Arduino_ConnectionHandler.h>
43
-
44
42
/* *****************************************************************************
45
43
* GLOBAL VARIABLES
46
44
******************************************************************************/
@@ -66,24 +64,18 @@ static void samd_watchdog_reset()
66
64
}
67
65
}
68
66
69
- /* This function is called within the WiFiNINA library when invoking
70
- * the method 'connectBearSSL' in order to prevent a premature bite
71
- * of the watchdog (max timeout on SAMD is 16 s). wifi_nina_feed...
67
+ /* This function is called within the GSMConnectionHandler. mkr_gsm_feed...
72
68
* is defined a weak function there and overwritten by this "strong"
73
69
* function here.
74
70
*/
75
- #ifndef WIFI_HAS_FEED_WATCHDOG_FUNC
76
- void wifi_nina_feed_watchdog ()
77
- {
78
- samd_watchdog_reset ();
79
- }
80
- #endif
81
-
82
71
void mkr_gsm_feed_watchdog ()
83
72
{
84
73
samd_watchdog_reset ();
85
74
}
86
-
75
+ /* This function is called within the GSMConnectionHandler. mkr_nb_feed...
76
+ * is defined a weak function there and overwritten by this "strong"
77
+ * function here.
78
+ */
87
79
void mkr_nb_feed_watchdog ()
88
80
{
89
81
samd_watchdog_reset ();
@@ -119,18 +111,26 @@ static void mbed_watchdog_reset()
119
111
}
120
112
}
121
113
122
- #if defined (ARDUINO_PORTENTA_H7_WIFI_HAS_FEED_WATCHDOG_FUNC)
123
- static void mbed_watchdog_enable_network_feed (const bool use_ethernet)
114
+ static void mbed_watchdog_enable_network_feed (NetworkAdapter ni)
124
115
{
116
+ if (ni == NetworkAdapter::ETHERNET) {
125
117
#if defined(BOARD_HAS_ETHERNET)
126
- if (use_ethernet) {
127
118
Ethernet.setFeedWatchdogFunc (watchdog_reset);
128
- } else
129
119
#endif
120
+ }
121
+
122
+ if (ni == NetworkAdapter::WIFI) {
123
+ #if defined(ARDUINO_PORTENTA_H7_WIFI_HAS_FEED_WATCHDOG_FUNC) && defined(BOARD_HAS_WIFI)
130
124
WiFi.setFeedWatchdogFunc (watchdog_reset);
125
+ #endif
126
+ }
131
127
132
- }
128
+ if (ni == NetworkAdapter::CATM1) {
129
+ #if defined(BOARD_HAS_CATM1_NBIOT)
130
+ GSM.setFeedWatchdogFunc (watchdog_reset);
133
131
#endif
132
+ }
133
+ }
134
134
135
135
void mbed_watchdog_trigger_reset ()
136
136
{
@@ -167,15 +167,17 @@ void watchdog_reset()
167
167
#endif
168
168
}
169
169
170
- void watchdog_enable_network_feed (const bool use_ethernet )
170
+ void watchdog_enable_network_feed (NetworkAdapter ni )
171
171
{
172
- #ifdef WIFI_HAS_FEED_WATCHDOG_FUNC
173
- (void )use_ethernet;
172
+ /* Setup WiFi NINA watchdog feed callback function */
173
+ #if defined(ARDUINO_ARCH_SAMD) && defined(WIFI_HAS_FEED_WATCHDOG_FUNC)
174
+ (void )ni;
174
175
WiFi.setFeedWatchdogFunc (watchdog_reset);
175
176
#endif
176
177
177
- #ifdef ARDUINO_PORTENTA_H7_WIFI_HAS_FEED_WATCHDOG_FUNC
178
- mbed_watchdog_enable_network_feed (use_ethernet);
178
+ /* Setup mbed sockets watchdog feed callback function */
179
+ #if defined(ARDUINO_ARCH_MBED)
180
+ mbed_watchdog_enable_network_feed (ni);
179
181
#endif
180
182
}
181
183
#endif /* (ARDUINO_ARCH_SAMD) || (ARDUINO_ARCH_MBED) */
0 commit comments