ils
Fork of GA-Test_copy by
Watchdog/Watchdog.cpp
- Committer:
- bberabi
- Date:
- 2018-01-10
- Revision:
- 2:5adf0b785944
- Parent:
- 0:a3b83d366423
File content as of revision 2:5adf0b785944:
#include "Watchdog.h" Watchdog::Watchdog() { } // Load timeout value in watchdog timer and enable void Watchdog::kick(float s) { uint32_t clk = SystemCoreClock / 3; // found by trying. TODO: exakt values hiwdg.Instance = IWDG; hiwdg.Init.Prescaler = IWDG_PRESCALER_16; hiwdg.Init.Reload = s * (float)clk; if (HAL_IWDG_Init(&hiwdg) != HAL_OK) { // Error Handler } } // "kick" or "feed" the dog - reset the watchdog timer // by writing this required bit pattern void Watchdog::kick() { HAL_IWDG_Refresh(&hiwdg); }