add firmware
This commit is contained in:
18
drv/iwdg.cpp
Normal file
18
drv/iwdg.cpp
Normal file
@ -0,0 +1,18 @@
|
||||
#include "stm32g4xx.h"
|
||||
|
||||
#include "iwdg.h"
|
||||
|
||||
void InitIWDG(unsigned short Reload)
|
||||
{
|
||||
IWDG->KR=0x0000CCCC;
|
||||
IWDG->KR=0x00005555;
|
||||
IWDG->PR=0;
|
||||
IWDG->RLR=Reload;
|
||||
while(IWDG->SR) { asm volatile("NOP"); }
|
||||
IWDG->KR=0x0000AAAA;
|
||||
}
|
||||
|
||||
void PingIWDG()
|
||||
{
|
||||
IWDG->KR=0x0000AAAA;
|
||||
}
|
Reference in New Issue
Block a user