休眠函数里代码:
PWR->CSR2 = 0x2;
PWR_UltraLowPowerCmd(ENABLE);
RTC_WakeUpCmd(ENABLE);
RTC_ITConfig(RTC_IT_WUT, ENABLE);
CLK_HSICmd(DISABLE);
SPI_Cmd(SPI1, DISABLE);//禁用SPI1
CLK_PeripheralClockConfig(CLK_Peripheral_SPI1,DISABLE);//禁用外设时钟SPI1
PWR_PVDCmd(DISABLE);
RTC_SetWakeUpCounter(500);
halt();
CLK_PeripheralClockConfig(CLK_Peripheral_SPI1,ENABLE);//启用外设时钟SPI1
SPI_Cmd(SPI1, ENABLE); //启用SPI1
RTC_WakeUpCmd(DISABLE);
CLK_PeripheralClockConfig(CLK_Peripheral_RTC,ENABLE);
PWR_PVDCmd(ENABLE);
|