Skip to content

Commit ba61452

Browse files
committed
Allow central enabling/disabling of watchdog for SAMD within AIoTConfig.h
1 parent d766bb3 commit ba61452

File tree

3 files changed

+18
-6
lines changed

3 files changed

+18
-6
lines changed

src/AIoTC_Config.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,12 @@
8787
* AUTOMATICALLY CONFIGURED DEFINES
8888
******************************************************************************/
8989

90+
#ifdef ARDUINO_ARCH_SAMD
91+
# define WATCHDOG_ENABLED (1)
92+
#else
93+
# define WATCHDOG_ENABLED (0)
94+
#endif
95+
9096
#if defined(ARDUINO_SAMD_MKRWIFI1010) || defined(ARDUINO_SAMD_NANO_33_IOT) || \
9197
defined(ARDUINO_AVR_UNO_WIFI_REV2)
9298
#define OTA_STORAGE_SNU (1)

src/utility/watchdog/Watchdog.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@
2525
* FUNCTION DEFINITION
2626
******************************************************************************/
2727

28-
#ifdef ARDUINO_ARCH_SAMD
28+
#if WATCHDOG_ENABLED
29+
# ifdef ARDUINO_ARCH_SAMD
2930
/* This function is called within the WiFiNINA library when invoking
3031
* the method 'connectBearSSL' in order to prevent a premature bite
3132
* of the watchdog (max timeout on SAMD is 16 s). wifi_nina_feed...
@@ -36,4 +37,5 @@ void wifi_nina_feed_watchdog()
3637
{
3738
Watchdog.reset();
3839
}
39-
#endif /* ARDUINO_ARCH_SAMD */
40+
# endif /* ARDUINO_ARCH_SAMD */
41+
#endif /* WATCHDOG_ENABLED */

src/utility/watchdog/Watchdog.h

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,13 @@
2222
* INCLUDE
2323
******************************************************************************/
2424

25-
#ifdef ARDUINO_ARCH_SAMD
26-
# include <Adafruit_SleepyDog.h>
27-
# define SAMD_WATCHDOG_MAX_TIME_ms (16 * 1000)
28-
#endif /* ARDUINO_ARCH_SAMD */
25+
#include <AIoTC_Config.h>
26+
27+
#if WATCHDOG_ENABLED
28+
# ifdef ARDUINO_ARCH_SAMD
29+
# include <Adafruit_SleepyDog.h>
30+
# define SAMD_WATCHDOG_MAX_TIME_ms (16 * 1000)
31+
# endif /* ARDUINO_ARCH_SAMD */
32+
#endif /* WATCHDOG_ENABLED */
2933

3034
#endif /* ARDUINO_AIOTC_UTILITY_WATCHDOG_H_ */

0 commit comments

Comments
 (0)