void PVD_Init (void)
{
SystemInit ();
EXTI_InitTypeDef EXTI_InitStructure;
RCC_APB1PeriphClockCmd (RCC_APB1Periph_PWR, ENABLE);//PWRe1? U
/* Configure EXTI Line16 (PVD Output) to generate an interrupt on rising and
Falling edges */
EXTI_ClearITPendingBit (EXTI_Line16);
EXTI_InitStructure. EXTI_Line=EXTI_Line16;
EXTI_InitStructure. EXTI_Mode=EXTI_Mode_Interrupt;
EXTI_InitStructure. EXTI_Trigger=EXTI_Trigger_Rising_Falling;
EXTI_InitStructure. EXTI_LineCmd=ENABLE;
EXTI_Init (& amp; EXTI_InitStructure);
}
Void PVD_NVIC (void)
{
NVIC_InitTypeDef NVIC_InitStructure;
/* Configure one bit for preemption priority */
NVIC_PriorityGroupConfig (NVIC_PriorityGroup_1);
/* the Enable the PVD Interrupt */
NVIC_InitStructure. NVIC_IRQChannel=PVD_IRQn;
NVIC_InitStructure. NVIC_IRQChannelPreemptionPriority=0;
NVIC_InitStructure. NVIC_IRQChannelSubPriority=0;
NVIC_InitStructure. NVIC_IRQChannelCmd=ENABLE;
NVIC_Init (& amp; NVIC_InitStructure);
}
Void PVD_IRQHandler (void)
{
If (EXTI_GetITStatus (EXTI_Line16)!=RESET)
{
GPIO_SetBits (GPIOA, GPIO_Pin_1);
Start ().//a serial port to send data
EXTI_ClearITPendingBit (EXTI_Line16);
}
}
Int main ()
{
.
PWR_PVDLevelConfig (PWR_PVDLevel_2V9);
PWR_PVDCmd (ENABLE);
PVD_Init ();
PVD_NVIC ();
.
While (1)
{
;
}
}
CodePudding user response:
The use of leds in instructionsCodePudding user response:
Not ah, triedCodePudding user response:
The corresponding clock open