stop代码:
void Sys_Stop(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
RCC_APB2PeriphResetCmd(0X01FC,DISABLE); //复位所有IO
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_All;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AIN;
//GPIO_Init(GPIOA, &GPIO_InitStructure);
GPIO_Init(GPIOB, &GPIO_InitStructure);
GPIO_Init(GPIOC, &GPIO_InitStructure);
RCC_APB2PeriphClockCmd( RCC_APB2Periph_USART1|
RCC_APB2Periph_ADC1|RCC_APB2Periph_ADC2,
DISABLE); // RCC_APB1Periph_SPI1
RCC_APB1PeriphClockCmd( RCC_APB1Periph_SPI2|RCC_APB1Periph_TIM2|RCC_APB1Periph_USART3,
DISABLE);
NVIC_SystemLPConfig(NVIC_LP_SLEEPDEEP,ENABLE);
RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR, ENABLE); //使能PWR和BKP外设时钟
// RTC_ITConfig(RTC_IT_ALR, ENABLE);
// RTC_WaitForLastTask();
SetAlarm(RTC_GetCounter() + 950);
RTC_WaitForLastTask();
PWR_EnterSTOPMode(PWR_Regulator_LowPower, PWR_STOPEntry_WFI);
RCC_Configurationb();
// SysTick_Configuration();
}
|