Skip to content

Commit

Permalink
update iwdg
Browse files Browse the repository at this point in the history
  • Loading branch information
PonomarevDA committed Oct 13, 2024
1 parent 605df48 commit c3ce299
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions Src/platform/stm32/iwdg/iwdg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,26 @@
extern IWDG_HandleTypeDef hiwdg;
#endif // HAL_IWDG_MODULE_ENABLED

#ifdef FDCAN1
extern FDCAN_HandleTypeDef hfdcan1;
#endif // FDCAN1

namespace HAL {

void Watchdog::refresh() {
if (!reboot_required) {
#ifdef HAL_IWDG_MODULE_ENABLED
HAL_IWDG_Refresh(&hiwdg);
if (reboot_required) {
return;
}
#endif // HAL_IWDG_MODULE_ENABLED

#if defined(HAL_IWDG_MODULE_ENABLED) && defined(FDCAN1)
if (!__HAL_FDCAN_GET_FLAG(&hfdcan1, FDCAN_FLAG_BUS_OFF)) {
HAL_IWDG_Refresh(&hiwdg);
}
#elif defined(HAL_IWDG_MODULE_ENABLED)
HAL_IWDG_Refresh(&hiwdg);
#endif // HAL_IWDG_MODULE_ENABLED
}

} // namespace HAL

0 comments on commit c3ce299

Please sign in to comment.