rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
mpu_watchdog.h
Go to the documentation of this file.
1/**
2 * @file mpu_watchdog.h
3 * @brief Hardware Independent Watchdog (IWDG) high-level API
4 *
5 * @date Nov 28, 2023
6 * @author Andrey Belomutskiy, (c) 2012-2023
7 * @author andreika <prometheus.pcb@gmail.com>
8 */
9
10#pragma once
11
12#include "main_loop.h"
13#include "engine_controller.h"
14
15// 100 ms is our empiric choice based on 2 * SLOW_CALLBACK_PERIOD_MS
16#define WATCHDOG_RESET_MS (2 * SLOW_CALLBACK_PERIOD_MS)
17// 500 ms is our default timeout
18#define WATCHDOG_TIMEOUT_MS (5 * WATCHDOG_RESET_MS)
19// 5 secs should be enough to wait until
20#define WATCHDOG_FLASH_TIMEOUT_MS 5000
21// MFS startup time in case of garbage collection can take a loooot of time
22#define WATCHDOG_MFS_START_TIMEOUT_MS 7000
23
24// we use 'int' for compatibility with addConsoleActionI()
25// can be called multiple times to change the timeout
26void startWatchdog(int timeoutMs = WATCHDOG_TIMEOUT_MS);
27
28// Can be called for debug reasons to test the watchdog
29void setWatchdogResetPeriod(int resetMs);
30
31// A reset is done only if enough time has passed since the last reset.
32void tryResetWatchdog();
Controllers package entry point header.
void setWatchdogResetPeriod(int resetMs)
void tryResetWatchdog()
void startWatchdog(int timeoutMs=WATCHDOG_TIMEOUT_MS)