Watchdog for simulator refactor
This commit is contained in:
parent
f534d11f9e
commit
b683a4f04c
|
@ -8,6 +8,5 @@ static bool isValidCanRxPin(brain_pin_e) { return true; }
|
|||
|
||||
static bool allowFlashWhileRunning() { return true; }
|
||||
static void causeHardFault() { }
|
||||
static void startWatchdog(int = 300) { }
|
||||
static void setWatchdogResetPeriod(int) { }
|
||||
static void tryResetWatchdog() { }
|
||||
|
||||
#include "sim_watchdog.h"
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
/**
|
||||
* @file sim_watchdog.h
|
||||
* @brief Simulator of Independent Watchdog (IWDG) high-level API
|
||||
*
|
||||
* @date Nov 28, 2023
|
||||
* @author Andrey Belomutskiy, (c) 2012-2023
|
||||
* @author andreika <prometheus.pcb@gmail.com>
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "engine_controller.h"
|
||||
|
||||
// 100 ms is our empiric choice based on 2 * SLOW_CALLBACK_PERIOD_MS
|
||||
#define WATCHDOG_RESET_MS (2 * SLOW_CALLBACK_PERIOD_MS)
|
||||
// 300 ms is our default timeout
|
||||
#define WATCHDOG_TIMEOUT_MS (3 * WATCHDOG_RESET_MS)
|
||||
// 5 secs should be enough to wait until
|
||||
#define WATCHDOG_FLASH_TIMEOUT_MS 5000
|
||||
|
||||
|
||||
// we use 'int' for compatibility with addConsoleActionI()
|
||||
// can be called multiple times to change the timeout
|
||||
void startWatchdog(int = WATCHDOG_TIMEOUT_MS) { }
|
||||
|
||||
// Can be called for debug reasons to test the watchdog
|
||||
void setWatchdogResetPeriod(int resetMs) { }
|
||||
|
||||
// A reset is done only if enough time has passed since the last reset.
|
||||
void tryResetWatchdog() { }
|
Loading…
Reference in New Issue