Beispiel #1
0
void LowPower_Init(void)
{
  LowPower_CLK_Config();
  CLK_HaltConfig(CLK_Halt_FastWakeup,ENABLE);//快速唤醒
  LowPower_GPIO_Config(); 
  PWR_UltraLowPowerCmd(ENABLE);   
}
Beispiel #2
0
static void Goto_HALT()
{
  // Prepare for HALT mode
  LED_OFF;
  RFM_OFF;
  btn_pressed = 0;
  CLK->PCKENR1 = 0x00; //Stop all peripheral clocks
  CLK->PCKENR2 = 0x00;
  CLK->PCKENR3 = 0x00;
  PWR_FastWakeUpCmd(ENABLE);     //Enables or disables the Fast WakeUp from Ultra Low Power mode, system does not wait for VrefINT to stabilize (around 3ms)
  PWR_UltraLowPowerCmd(ENABLE);  //Enables or disables the Ultra Low Power mode, disable VrefINT during Halt or Active-Halt modes
  CLK_HaltConfig(CLK_Halt_FastWakeup, ENABLE);  //Configures clock during halt and active halt modes
                                                  //Fast wakeup from Halt/Active-halt modes enabled: HSI/8 used as system clock source after wakeup from Halt/Active-halt
  CLK_HaltConfig(CLK_Halt_SlowWakeup, ENABLE);  //When it is set, the main voltage regulator is powered off as soon as the MCU enters Active-halt mode, so the wakeup time is longer
                                                  //1: MVR regulator OFF in Active-halt mode
  halt(); /* go to HALT mode */
}
Beispiel #3
0
/***********************************************************************
  * @brief  IdleTask
  * @param  None
  * @retval None
************************************************************************/
void IdleTask(void)
{	
	#ifdef DEBUG
		printf("IdleTask ...\r\n");
		AppTrace_DeInit();
	#endif

	PWR_UltraLowPowerCmd(ENABLE);
	CLK_HaltConfig(CLK_Halt_FastWakeup, ENABLE);
	PWR_FastWakeUpCmd(ENABLE);
    halt();

	#ifdef DEBUG
		AppTrace_Init();
		printf("Wakeup ...\r\n");
	#endif
}