void PVD_Init(void)
{
PWR_PVDTypeDef PWR_PVDStruct;
__HAL_RCC_PWR_CLK_ENABLE();
PWR_PVDStruct.PVDLevel = PWR_PVDLEVEL_7; // 2.9V
PWR_PVDStruct.Mode = PWR_PVD_MODE_IT_RISING;
//PWR_PVDStruct.Mode = PWR_PVD_MODE_IT_RISING_FALLING;
HAL_PWR_ConfigPVD(&PWR_PVDStruct);
HAL_NVIC_SetPriority(PVD_IRQn,4,0);
HAL_NVIC_EnableIRQ(PVD_IRQn);
HAL_PWR_EnablePVD();
}
这样写就可以了 |