コード例 #1
0
ファイル: board.c プロジェクト: Babody/openwsn-fw
void board_sleep()
{
#if 0
  uint16_t sleepTime = radiotimer_getPeriod() - radiotimer_getCapturedTime();
  DBGMCU_Config(DBGMCU_STOP, ENABLE);
  
  // Enable PWR and BKP clock
  RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR | RCC_APB1Periph_BKP, ENABLE);
  // Desable the SRAM and FLITF clock in Stop mode
  RCC_AHBPeriphClockCmd(RCC_AHBPeriph_SRAM | RCC_AHBPeriph_FLITF, DISABLE);

  PWR_EnterSTOPMode(PWR_Regulator_ON,PWR_STOPEntry_WFI);
  
  if(sleepTime > 0)
  opentimers_sleepTimeCompesation(sleepTime*2);
#endif 
}
コード例 #2
-1
ファイル: board.c プロジェクト: barriquello/iotstack
void board_sleep() {
  
#ifdef DEBUG_RUN_MODE
    // nothing need to do
#endif
  
#ifdef DEBUG_SLEEP_MODE
    DBGMCU_Config(DBGMCU_SLEEP, ENABLE);
    // Enable PWR and BKP clock
    RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR | RCC_APB1Periph_BKP, ENABLE);
    // Desable the SRAM and FLITF clock in sleep mode
    RCC_AHBPeriphClockCmd(RCC_AHBPeriph_SRAM | RCC_AHBPeriph_FLITF, DISABLE);
    // enter sleep mode
    __WFI();
#endif
  
#ifdef DEBUG_STOP_MODE
    uint16_t sleepTime = radiotimer_getPeriod() - radiotimer_getCapturedTime();
    
    DBGMCU_Config(DBGMCU_STOP, ENABLE);
    // Enable PWR and BKP clock
    RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR | RCC_APB1Periph_BKP, ENABLE);
    // Desable the SRAM and FLITF clock in Stop mode
    RCC_AHBPeriphClockCmd(RCC_AHBPeriph_SRAM | RCC_AHBPeriph_FLITF, DISABLE);
    // enter stop mode
    PWR_EnterSTOPMode(PWR_Regulator_ON,PWR_STOPEntry_WFI);
    
    if(sleepTime > 0)
    opentimers_sleepTimeCompesation(sleepTime);
#endif
}