AP_HAL_ChibiOS: support external watchdog gpio

Co-authored-by: Randy Mackay <rmackay9@yahoo.com>

optional support to toggle GPIO pin at 10hz
This commit is contained in:
jfbblue0922 2023-05-11 16:06:28 +09:00 committed by Randy Mackay
parent 7b2e103ec3
commit 4b31fe20df
2 changed files with 21 additions and 0 deletions

View File

@ -764,8 +764,23 @@ void Scheduler::watchdog_pat(void)
{
stm32_watchdog_pat();
last_watchdog_pat_ms = AP_HAL::millis();
#if defined(HAL_GPIO_PIN_EXT_WDOG)
ext_watchdog_pat(last_watchdog_pat_ms);
#endif
}
#if defined(HAL_GPIO_PIN_EXT_WDOG)
// toggle the external watchdog gpio pin
void Scheduler::ext_watchdog_pat(uint32_t now_ms)
{
// toggle watchdog GPIO every WDI_OUT_INTERVAL_TIME_MS
if ((now_ms - last_ext_watchdog_ms) >= EXT_WDOG_INTERVAL_MS) {
palToggleLine(HAL_GPIO_PIN_EXT_WDOG);
last_ext_watchdog_ms = now_ms;
}
}
#endif
#if CH_DBG_ENABLE_STACK_CHECK == TRUE
/*
check we have enough stack free on all threads and the ISR stack

View File

@ -193,5 +193,11 @@ private:
// check for free stack space
void check_stack_free(void);
#if defined(HAL_GPIO_PIN_EXT_WDOG)
// external watchdog GPIO support
void ext_watchdog_pat(uint32_t now_ms);
uint32_t last_ext_watchdog_ms;
#endif
};
#endif