iwdg.c 520 B

123456789101112131415161718192021222324
  1. #include "iwdg.h"
  2. IWDG_HandleTypeDef hiwdg;
  3. void IWDG_Configuration(void)
  4. {
  5. IWDG_ENABLE_WRITE_ACCESS(&hiwdg);
  6. // 4 min:0.125ms max:512ms
  7. // 8 min:0.25ms max:1024ms
  8. // 16 min:0.5ms max:2048ms
  9. // 32 min:1ms max:4096ms
  10. // 64 min:2ms max:8192ms
  11. // 128 min:4ms max:16384ms
  12. // 256 min:8ms max:32768ms
  13. hiwdg.Instance = IWDG;
  14. hiwdg.Init.Prescaler = IWDG_PRESCALER_64;
  15. hiwdg.Init.Reload = 8000;
  16. HAL_IWDG_Init(&hiwdg);
  17. }
  18. void feedDog(void)
  19. {
  20. HAL_IWDG_Refresh(&hiwdg);
  21. }