STM32H750XB_RT-THREAD/42-PWR—电源管理/PWR—PVD监控/User/pvd/bsp_pvd.c
2025-07-21 14:34:29 +08:00

48 lines
1.2 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
******************************************************************************
* @file bsp_pvd.c
* @author fire
* @version V1.0
* @date 2017-xx-xx
* @brief pvd监控配置
******************************************************************************
* @attention
*
* 实验平台:野火 STM32F767 开发板
* 论坛 :http://www.firebbs.cn
* 淘宝 :http://firestm32.taobao.com
*
******************************************************************************
*/
#include "./pvd/bsp_pvd.h"
/**
* @brief 配置PVD.
* @param None
* @retval None
*/
void PVD_Config(void)
{
PWR_PVDTypeDef sConfigPVD;
/*使能 PWR 时钟 */
HAL_PWR_EnablePVD();
/* 配置 PVD 中断 */
/*中断设置抢占优先级0子优先级为0*/
HAL_NVIC_SetPriority(PVD_IRQn, 0 ,0);
HAL_NVIC_EnableIRQ(PVD_IRQn);
/* 配置PVD级别5 (PVD检测电压的阈值为2.8V
VDD电压低于2.8V时产生PVD中断具体数据
可查询数据手册获知) 具体级别根据自己的
实际应用要求配置*/
sConfigPVD.PVDLevel = PWR_PVDLEVEL_5;
sConfigPVD.Mode = PWR_PVD_MODE_IT_RISING_FALLING;
HAL_PWR_ConfigPVD(&sConfigPVD);
/* 使能PVD输出 */
HAL_PWR_EnablePVD();
}
/*********************************************END OF FILE**********************/