Skip to content

Commit

Permalink
watchdog
Browse files Browse the repository at this point in the history
  • Loading branch information
mvladic committed Nov 6, 2020
1 parent 43dfc8c commit 42f8470
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
2 changes: 2 additions & 0 deletions src/eez/modules/dib-dcp405/dib-dcp405.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,8 @@ struct DcpChannel : public Channel {
}
delay(1);
}

WATCHDOG_RESET(WATCHDOG_LONG_OPERATION);
#endif
}

Expand Down
14 changes: 9 additions & 5 deletions src/eez/system.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,22 @@

#include <stdio.h>

#include <main.h>
#include <iwdg.h>

#include <eez/system.h>

#if defined(EEZ_PLATFORM_STM32)
#include <main.h>
#include <iwdg.h>

volatile uint32_t g_tickCount;
#endif

int g_watchdogExpectingTask = WATCHDOG_HIGH_PRIORITY_THREAD;

namespace eez {
extern bool g_isBooted;
}

void doWatchdogReset(int fromTask) {
if (fromTask == WATCHDOG_LONG_OPERATION) {
if (fromTask == WATCHDOG_LONG_OPERATION || !eez::g_isBooted) {
HAL_IWDG_Refresh(&hiwdg);
} else if (fromTask == WATCHDOG_HIGH_PRIORITY_THREAD) {
if (g_watchdogExpectingTask == WATCHDOG_HIGH_PRIORITY_THREAD) {
Expand All @@ -44,6 +47,7 @@ void doWatchdogReset(int fromTask) {
}
}
}
#endif

namespace eez {

Expand Down

0 comments on commit 42f8470

Please sign in to comment.