Skip to content

Commit 80b3235

Browse files
committed
[EFR32] add watchdog timer
1 parent 043aed9 commit 80b3235

File tree

1 file changed

+12
-2
lines changed
  • software/firmware/source/SoftRF/src/platform

1 file changed

+12
-2
lines changed

software/firmware/source/SoftRF/src/platform/EFR32.cpp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
#include "../protocol/data/D1090.h"
3535

3636
#include <ArduinoLowPower.h>
37+
#include <WatchdogTimer.h>
3738

3839
// SX127x pin mapping
3940
lmic_pinmap lmic_pins = {
@@ -285,6 +286,10 @@ static unsigned long rx_led_time_marker = 0;
285286

286287
static void EFR32_loop()
287288
{
289+
if (wdt_is_active) {
290+
WatchdogTimer.feed();
291+
}
292+
288293
#if SOC_GPIO_RADIO_LED_TX != SOC_UNUSED_PIN
289294
if (digitalRead(SOC_GPIO_RADIO_LED_TX) != LED_STATE_ON) {
290295
if (tx_packets_counter != prev_tx_packets_counter) {
@@ -586,12 +591,17 @@ static void EFR32_UATModule_restart()
586591

587592
static void EFR32_WDT_setup()
588593
{
589-
/* TBD */
594+
WatchdogTimer.begin(WDOG_PERIOD_8_S);
595+
wdt_is_active = true;
590596
}
591597

592598
static void EFR32_WDT_fini()
593599
{
594-
/* TBD */
600+
if (wdt_is_active) {
601+
WatchdogTimer.setWatchdogOffWhileSleeping(true);
602+
WatchdogTimer.end();
603+
wdt_is_active = false;
604+
}
595605
}
596606

597607
#if SOC_GPIO_PIN_BUTTON != SOC_UNUSED_PIN

0 commit comments

Comments
 (0)