mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-10-28 00:53:45 +08:00
22a8575199
Keep official openpilot ancestry and dependency licenses. Store resources directly in Git, remove LFS setup requirements, and leave the downloadable big model outside the source tree.
24 lines
547 B
C
24 lines
547 B
C
#pragma once
|
|
|
|
#include "board/drivers/drivers.h"
|
|
|
|
static simple_watchdog_state_t wd_state;
|
|
|
|
void simple_watchdog_kick(void) {
|
|
uint32_t ts = microsecond_timer_get();
|
|
|
|
uint32_t et = get_ts_elapsed(ts, wd_state.last_ts);
|
|
if (et > wd_state.threshold) {
|
|
print("WD timeout 0x"); puth(et); print("\n");
|
|
fault_occurred(wd_state.fault);
|
|
}
|
|
|
|
wd_state.last_ts = ts;
|
|
}
|
|
|
|
void simple_watchdog_init(uint32_t fault, uint32_t threshold) {
|
|
wd_state.fault = fault;
|
|
wd_state.threshold = threshold;
|
|
wd_state.last_ts = microsecond_timer_get();
|
|
}
|