• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ HAL_PWR_EnterSTOPMode函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中HAL_PWR_EnterSTOPMode函数的典型用法代码示例。如果您正苦于以下问题:C++ HAL_PWR_EnterSTOPMode函数的具体用法?C++ HAL_PWR_EnterSTOPMode怎么用?C++ HAL_PWR_EnterSTOPMode使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了HAL_PWR_EnterSTOPMode函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: StopMode

void StopMode(void)
{
  GPIO_InitTypeDef GPIO_InitStruct;

  /* Disable all GPIOs to reduce power */
  MX_GPIO_Deinit();

  /* Configure User push-button as external interrupt generator */
  __HAL_RCC_GPIOC_CLK_ENABLE();
  GPIO_InitStruct.Pin = B1_Pin;
  GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING;
  GPIO_InitStruct.Pull = GPIO_NOPULL;
  HAL_GPIO_Init(B1_GPIO_Port, &GPIO_InitStruct);

  HAL_UART_DeInit(&huart2);

  /* Suspend Tick increment to prevent wakeup by Systick interrupt.
     Otherwise the Systick interrupt will wake up the device within 1ms (HAL time base) */
  HAL_SuspendTick();

  /* We enable again the PWR peripheral */
  __HAL_RCC_PWR_CLK_ENABLE();
  /* Request to enter SLEEP mode */
  HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_SLEEPENTRY_WFI);

  /* Resume Tick interrupt if disabled prior to sleep mode entry*/
  HAL_ResumeTick();

  /* Reinitialize GPIOs */
  MX_GPIO_Init();

  /* Reinitialize UART2 */
  MX_USART2_UART_Init();
}
开发者ID:Shreeyak,项目名称:mastering-stm32,代码行数:34,代码来源:main-ex1.c


示例2: stopmode_entry

void
stopmode_entry()
{
    extern xSemaphoreHandle semaphore_puts;

    xSemaphoreTake(semaphore_puts, portMAX_DELAY);
    puts("modem power off\n\r");
    puts("cpu enter stop mode\n\r");
    xSemaphoreGive(semaphore_puts);

    modem_power(0);
    stopmode_gpio_configuration();

    vTaskSuspendAll();
    watchdogtimer_stop();
    rtc_backup_write(19, SYSRESET_STOP_MODE);

    HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFI);

    /* STOP here until EXTI interrupt */
    NVIC_SystemReset();

    while(1){
        vTaskDelay(1000);
    }
}
开发者ID:abit-corp,项目名称:phs-shield,代码行数:26,代码来源:power_saving.c


示例3: LowPowerStopEXTI

/**
  * @brief  Enter in stop mode and exit by pressingf the tamper button
  * @param  None
  * @note   This example enter in stop mode.  
  * @retval None
  */
void LowPowerStopEXTI(void)
{
  kWindow_Popup("STOP EXTI", LCD_COLOR_WHITE, LCD_COLOR_BLUE,        \
                "\n\nPres JOY sel to\nstart\nstop mode\n", \
                 LCD_COLOR_WHITE, LCD_COLOR_BLUE );
  HAL_Delay(100);
  user_event = JOY_UP;
  while(user_event != JOY_SEL)
  {
    user_action = 0;
  };

  kWindow_Popup("STOP EXTI", LCD_COLOR_WHITE, LCD_COLOR_BLUE,        \
                "\n\nstop mode\nstarted\npress tamper\nto exit\n", \
                 LCD_COLOR_BLUE, LCD_COLOR_WHITE );  
  
  /* User push-button (EXTI_Line0) will be used to wakeup the system from STOP mode */
  BSP_PB_Init(BUTTON_TAMPER, BUTTON_MODE_EXTI);
  /* avoid wakeup from JOY event */
  BSP_JOY_Init(JOY_MODE_GPIO);  
  
  /* Clear PWR wake up Flag */
  __HAL_PWR_CLEAR_FLAG(PWR_FLAG_WU);
  
  /* Enter Stop Mode */
  HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFI);
  
  /* Restore the clock configuration */
  SystemClock_STOPExit();
  
  /* User push-button (EXTI_Line0) will be used to wakeup the system from STOP mode */
  BSP_PB_Init(BUTTON_TAMPER, BUTTON_MODE_GPIO);  
  BSP_JOY_Init(JOY_MODE_EXTI);  
}
开发者ID:GreyCardinalRus,项目名称:stm32-cube,代码行数:40,代码来源:lowpower_app.c


示例4: machine_sleep

STATIC mp_obj_t machine_sleep(void) {
    // takes longer to wake but reduces stop current
    HAL_PWREx_EnableFlashPowerDown();

    HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFI);

    // reconfigure the system clock after waking up

    // enable HSE
    __HAL_RCC_HSE_CONFIG(RCC_HSE_ON);
    while (!__HAL_RCC_GET_FLAG(RCC_FLAG_HSERDY)) {
    }

    // enable PLL
    __HAL_RCC_PLL_ENABLE();
    while (!__HAL_RCC_GET_FLAG(RCC_FLAG_PLLRDY)) {
    }

    // select PLL as system clock source
    MODIFY_REG(RCC->CFGR, RCC_CFGR_SW, RCC_SYSCLKSOURCE_PLLCLK);
    while (__HAL_RCC_GET_SYSCLK_SOURCE() != RCC_CFGR_SWS_PLL) {
    }

    return mp_const_none;
}
开发者ID:jaafarbarek,项目名称:pyrtos,代码行数:25,代码来源:modmachine.c


示例5: LowPowerStopRTCAlarm

/**
  * @brief  Enter in stop mode and exit by an alarm
  * @param  None
  * @note   This example enter in stop mode.  
  * @retval None
  */
void LowPowerStopRTCAlarm(void)
{
  kWindow_Popup("STOP Alarme", LCD_COLOR_WHITE, LCD_COLOR_BLUE,\
                "\nset delay time\n",                          \
                LCD_COLOR_BLUE, LCD_COLOR_WHITE ); 
  
  /* set the alarm */
  LowPowerHandleAlarm();
  
  kWindow_Popup("STOP Alarm", LCD_COLOR_WHITE, LCD_COLOR_BLUE, \
                "\n\nstop mode\nstarted\nwait alarm\nto exit\n",        \
                LCD_COLOR_BLUE, LCD_COLOR_WHITE );  
  
  BSP_JOY_Init(JOY_MODE_GPIO);  
  
  /* Enter Stop Mode */
  HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFE);
  
  /* Restore the clock configuration */
  SystemClock_STOPExit();
  
  HAL_RTC_DeactivateAlarm(&RtcHandle, RTC_ALARM_A);
  /* Clear the Alarm interrupt pending bit */
  __HAL_RTC_ALARM_CLEAR_FLAG(&RtcHandle,RTC_FLAG_ALRAF);
  /* Clear the EXTI's line Flag for RTC Alarm */
  __HAL_RTC_EXTI_CLEAR_FLAG(RTC_EXTI_LINE_ALARM_EVENT);
  
  BSP_JOY_Init(JOY_MODE_EXTI);
}
开发者ID:GreyCardinalRus,项目名称:stm32-cube,代码行数:35,代码来源:lowpower_app.c


示例6: StopSequence_Config

/**
  * @brief  Prepare the system to enter STOP mode.
  * @param  None
  * @retval None
  */
static void StopSequence_Config(void)
{
  GPIO_InitTypeDef      GPIO_InitStruct;
  
  /* PWR Peripheral clock enable */
  __HAL_RCC_PWR_CLK_ENABLE();
  
  /* Enable GPIOs clock */
  __HAL_RCC_GPIOA_CLK_ENABLE();
  __HAL_RCC_GPIOB_CLK_ENABLE();
  __HAL_RCC_GPIOC_CLK_ENABLE();
  __HAL_RCC_GPIOD_CLK_ENABLE();
  __HAL_RCC_GPIOE_CLK_ENABLE();
  __HAL_RCC_GPIOF_CLK_ENABLE();

  /* Configure all GPIO port pins in Analog mode */
  GPIO_InitStruct.Pin = GPIO_PIN_All;
  GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
  GPIO_InitStruct.Pull = GPIO_NOPULL;
  HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
  HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
  HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
  HAL_GPIO_Init(GPIOD, &GPIO_InitStruct);
  HAL_GPIO_Init(GPIOE, &GPIO_InitStruct);
  HAL_GPIO_Init(GPIOF, &GPIO_InitStruct);
  
  /* Request to enter STOP mode with regulator in low power */
  HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFI);
  EnterInStopMode = 1;
}
开发者ID:NjordCZ,项目名称:stm32cubef0,代码行数:35,代码来源:main.c


示例7: DEVICE_Handler

void DEVICE_Handler(void)
{
	char buf[10];
	static uint8_t _start = 1;
//	device.door->NEW = 1;

	while (1)
	{
		if (sleep)
		{
//			HAL_PCD_DevDisconnect(&hpcd_USB_FS);
			/* отключить SysTick */
			HAL_SuspendTick();

			/* Enters Stop mode */
			HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFI);

			/* выход из STOPMode и инициализация USB */
			/* включить SysTick */
			HAL_ResumeTick();
			/* Configure the system clock */
			SystemClock_Config();

//			HAL_PCD_DevConnect(&hpcd_USB_FS);
		}
		else
		{
//			HAL_Delay(200);
//			printf("test\n");
//			HAL_GPIO_TogglePin(GPIOB, GPIO_PIN_15);
		}
	}
}
开发者ID:sapfir63,项目名称:door_sensor_stm,代码行数:33,代码来源:handler.c


示例8: main

/**
  * @brief  Main program
  * @param  None
  * @retval None
  */
int main(void)
{
  GPIO_InitTypeDef GPIO_InitStruct;

  /* STM32L0xx HAL library initialization:
       - Configure the Flash prefetch, Flash preread and Buffer caches
       - Systick timer is configured by default as source of time base, but user 
             can eventually implement his proper time base source (a general purpose 
             timer for example or other time source), keeping in mind that Time base 
             duration should be kept 1ms since PPP_TIMEOUT_VALUEs are defined and 
             handled in milliseconds basis.
       - Low Level Initialization
     */
  HAL_Init();

  /* Configure the system clock to 2 MHz */
  SystemClock_Config();

  while (1)
  {
    /* Configure LED3 */
    BSP_LED_Init(LED3);

    /* Turn LED3 on */
    BSP_LED_On(LED3);

    /* Insert 5 second delay */
    HAL_Delay(5000);

    /* Turn LED3 OFF  */
    BSP_LED_Off(LED3);

    /* Configure the system Power */
    SystemPower_Config();

    /* Configure PA.12 (Arduino D2) as input with External interrupt */
    GPIO_InitStruct.Pin = GPIO_PIN_12;
    GPIO_InitStruct.Pull = GPIO_PULLUP;
    GPIO_InitStruct.Mode = GPIO_MODE_IT_FALLING; 

    /* Enable GPIOA clock */
    __HAL_RCC_GPIOA_CLK_ENABLE();

    HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
    
    /* Enable and set PA.12 (Arduino D2) EXTI Interrupt to the lowest priority */
    NVIC_SetPriority((IRQn_Type)(EXTI4_15_IRQn), 0x03);
    HAL_NVIC_EnableIRQ((IRQn_Type)(EXTI4_15_IRQn));

    /* Enable Power Control clock */
    __HAL_RCC_PWR_CLK_ENABLE();
	
    /* Enter Stop Mode */
    HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFI);
    
    /* Configures system clock after wake-up from STOP */
    SystemClock_Config();
  }
}
开发者ID:pengphei,项目名称:STM32Cube_L0,代码行数:64,代码来源:main.c


示例9: deepsleep

void deepsleep(void)
{
    // Request to enter STOP mode with regulator in low power mode
    HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFI);

    // After wake-up from STOP reconfigure the PLL
    SetSysClock();
}
开发者ID:1deus,项目名称:tmk_keyboard,代码行数:8,代码来源:sleep.c


示例10: StopMode_Measure

/**
  * @brief  This function configures the system to enter Stop mode with RTC 
  *         clocked by LSE or LSI for current consumption measurement purpose.
  *         STOP Mode with RTC clocked by LSE/LSI
  *         =====================================   
  *           - RTC Clocked by LSE or LSI
  *           - Regulator in LP mode
  *           - HSI, HSE OFF and LSI OFF if not used as RTC Clock source
  *           - No IWDG
  *           - Wakeup using EXTI Line (User push-button PC.13)
  * @param  None
  * @retval None
  */
void StopMode_Measure(void)
{
  GPIO_InitTypeDef GPIO_InitStruct;
  
  /* Configure all GPIO as analog to reduce current consumption on non used IOs */
  /* Warning : Reconfiguring all GPIO will close the connexion with the debugger */
  /* Enable GPIOs clock */

  __HAL_RCC_GPIOA_CLK_ENABLE();
  __HAL_RCC_GPIOB_CLK_ENABLE();
  __HAL_RCC_GPIOC_CLK_ENABLE();
  __HAL_RCC_GPIOD_CLK_ENABLE();
  __HAL_RCC_GPIOF_CLK_ENABLE();


  GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
  GPIO_InitStruct.Speed = GPIO_SPEED_HIGH;
  GPIO_InitStruct.Pull = GPIO_NOPULL;
  GPIO_InitStruct.Pin = GPIO_PIN_All;
  HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
  HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
  HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
  HAL_GPIO_Init(GPIOD, &GPIO_InitStruct);  
  HAL_GPIO_Init(GPIOF, &GPIO_InitStruct);


  /* Disable GPIOs clock */
  __HAL_RCC_GPIOA_CLK_DISABLE();
  __HAL_RCC_GPIOB_CLK_DISABLE();
  __HAL_RCC_GPIOC_CLK_DISABLE();
  __HAL_RCC_GPIOD_CLK_DISABLE();
  __HAL_RCC_GPIOF_CLK_DISABLE();



    /* Configure User Button */
  BSP_PB_Init(BUTTON_USER, BUTTON_MODE_EXTI);

  /* Enter Stop Mode */
  HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFI);

  /* Configures system clock after wake-up from STOP: enable HSI and PLL with HSI as source*/
  SYSCLKConfig_STOP();
  
  /* Initialize LED2 on the board */
  BSP_LED_Init(LED2);
  
  /* Turn LED2 On */
  BSP_LED_On(LED2);
  
  /* Inserted Delay */
  HAL_Delay(200);

  
}
开发者ID:jmoyerman,项目名称:stm32f0_cube,代码行数:68,代码来源:stm32f0xx_lp_modes.c


示例11: MCU_Enter_StopMode

void MCU_Enter_StopMode(void)
{

  HAL_SuspendTick();
  __HAL_PWR_CLEAR_FLAG(PWR_FLAG_WU);
  while((PWR->CSR & (uint32_t) 0x00000001)!=0);//attesa che il WUF si azzeri (via HW)

  HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFE);  /* Infinite loop */

  HAL_ResumeTick();
}
开发者ID:adibacco,项目名称:sp1ml,代码行数:11,代码来源:spirit1_appli.c


示例12: deepsleep

void deepsleep(void)
{
    // Request to enter STOP mode with regulator in low power mode
    HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFI);

    // After wake-up from STOP need to reconfigure the system clock
    SetSysClock();
    
#if DEVICE_LOWPOWERTIMER
    rtc_synchronize();
#endif
}
开发者ID:AlessandroA,项目名称:mbed,代码行数:12,代码来源:sleep.c


示例13: main

/**
* @brief  Main program
* @param  None
* @retval None
*/
int main(void)
{
  /* STM32L0xx HAL library initialization:
       - Configure the Flash prefetch, Flash preread and Buffer caches
       - Systick timer is configured by default as source of time base, but user 
             can eventually implement his proper time base source (a general purpose 
             timer for example or other time source), keeping in mind that Time base 
             duration should be kept 1ms since PPP_TIMEOUT_VALUEs are defined and 
             handled in milliseconds basis.
       - Low Level Initialization
     */
  HAL_Init();
  
  /* Configure LED2 to handle error handler */
  BSP_LED_Init(LED2);

  /* Configure the system clock @ 32 Mhz */
  SystemClock_Config();

  /* Configure the system Power */
  SystemPower_Config();

  while (1)
  {
    /* Insert 5 seconds delay */
    HAL_Delay(5000);

    /* Disable Wakeup Counter */
    HAL_RTCEx_DeactivateWakeUpTimer(&RTCHandle);

    /*## Setting the Wake up time ############################################*/
    /*  RTC Wakeup Interrupt Generation:
        Wakeup Time Base = (RTC_WAKEUPCLOCK_RTCCLK_DIV /(LSE or LSI))
        Wakeup Time = Wakeup Time Base * WakeUpCounter 
                    = (RTC_WAKEUPCLOCK_RTCCLK_DIV /(LSE or LSI)) * WakeUpCounter
        ==> WakeUpCounter = Wakeup Time / Wakeup Time Base

        To configure the wake up timer to 4s the WakeUpCounter is set to 0x1FFF:
          RTC_WAKEUPCLOCK_RTCCLK_DIV = RTCCLK_Div16 = 16 
          Wakeup Time Base = 16 /(~39.000KHz) = ~0,410 ms
          Wakeup Time = ~4s = 0,410ms  * WakeUpCounter
          ==> WakeUpCounter = ~4s/0,410ms = 9750 = 0x2616 */
    HAL_RTCEx_SetWakeUpTimer_IT(&RTCHandle, 0x2616, RTC_WAKEUPCLOCK_RTCCLK_DIV16);

    /* Enter Stop Mode */
    HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFI);

    /* Configures system clock after wake-up from STOP: enable HSI, PLL and select
    PLL as system clock source (HSI and PLL are disabled automatically in STOP mode) */
    SystemClockConfig_STOP();
  }
}
开发者ID:shjere,项目名称:common,代码行数:57,代码来源:main.c


示例14: RtcEnterLowPowerStopMode

void RtcEnterLowPowerStopMode( void )
{
  if( ( LowPowerDisableDuringTask == false ) && ( RtcTimerEventAllowsLowPower == true ) )
  {
      // Disable IRQ while the MCU is being deinitialized to prevent race issues
      __disable_irq( );

      HAL_MspDeInit();
			
      __enable_irq( );

      /* Enter Stop Mode */
      HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFI);
  }
}
开发者ID:qlcGit,项目名称:NPLink-Mote-STM32-SDK,代码行数:15,代码来源:rtc_board.c


示例15: deepsleep

void deepsleep(void)
{
    // Disable HAL tick interrupt
    TimMasterHandle.Instance = TIM5;
    __HAL_TIM_DISABLE_IT(&TimMasterHandle, TIM_IT_CC2);

    // Request to enter STOP mode with regulator in low power mode
    HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFI);

    // After wake-up from STOP reconfigure the PLL
    SetSysClock();

    // Enable HAL tick interrupt
    __HAL_TIM_ENABLE_IT(&TimMasterHandle, TIM_IT_CC2);
}
开发者ID:Sweet-Peas,项目名称:mbed,代码行数:15,代码来源:sleep.c


示例16: StopMode_Measure

/**
  * @brief  This function configures the system to enter Stop mode with RTC
  *         clocked by LSE or LSI  for current consumption measurement purpose.
  *         STOP Mode with RTC clocked by LSE/LSI
  *         =====================================
  *           - RTC Clocked by LSE or LSI
  *           - Regulator in LP mode
  *           - HSI, HSE OFF and LSI OFF if not used as RTC Clock source
  *           - No IWDG
  *           - FLASH in deep power down mode
  *           - Automatic Wakeup using RTC clocked by LSE/LSI (~20s)
  * @param  None
  * @retval None
  */
void StopMode_Measure(void)
{
#ifdef STOP_IO

    GPIO_InitTypeDef GPIO_InitStruct;

    /* Configure all GPIO as analog to reduce current consumption on non used IOs */
    /* Enable GPIOs clock */
    __HAL_RCC_GPIOA_CLK_ENABLE();
    __HAL_RCC_GPIOB_CLK_ENABLE();
    __HAL_RCC_GPIOC_CLK_ENABLE();
    __HAL_RCC_GPIOH_CLK_ENABLE();

    GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
    GPIO_InitStruct.Speed = GPIO_SPEED_HIGH;
    GPIO_InitStruct.Pull = GPIO_NOPULL;
    GPIO_InitStruct.Pin = GPIO_PIN_All;
    HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
    HAL_GPIO_Init(GPIOH, &GPIO_InitStruct);
    HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
    HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);

    /* Disable GPIOs clock */
    __HAL_RCC_GPIOA_CLK_DISABLE();
    __HAL_RCC_GPIOB_CLK_DISABLE();
    __HAL_RCC_GPIOC_CLK_DISABLE();
    __HAL_RCC_GPIOH_CLK_DISABLE();
#endif

    /* FLASH Deep Power Down Mode enabled */
    HAL_PWREx_EnableFlashPowerDown();

    /*## Enter Stop Mode #######################################################*/
    HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFE);
    /* Configures system clock after wake-up from STOP: enable HSE, PLL and select
    PLL as system clock source (HSE and PLL are disabled in STOP mode) */
    SYSCLKConfig_STOP();

    /* Disable Wake-up timer */
    if(HAL_RTCEx_DeactivateWakeUpTimer(&RTCHandle) != HAL_OK)
    {
        /* Initialization Error */
        Error_Handler();
    }
}
开发者ID:gilbertjuly,项目名称:cannon,代码行数:59,代码来源:stm32f401_lp_mode.c


示例17: main

/**
  * @brief  Main program
  * @param  None
  * @retval None
  */
int main(void)
{

  /* STM32F4xx HAL library initialization:
       - Configure the Flash prefetch, instruction and Data caches
       - Systick timer is configured by default as source of time base, but user
         can eventually implement his proper time base source (a general purpose
         timer for example or other time source), keeping in mind that Time base
         duration should be kept 1ms since PPP_TIMEOUT_VALUEs are defined and
         handled in milliseconds basis.
       - Set NVIC Group Priority to 4
       - Low Level Initialization: global MSP (MCU Support Package) initialization
     */
  HAL_Init();

  /* Configure the system clock to 180 MHz */
  SystemClock_Config();

  /* Configure LED3 */
  BSP_LED_Init(LED3);

  while (1)
  {
    /* Configure LED1 */
    BSP_LED_Init(LED1);

    /* Turn LED1 on */
    BSP_LED_On(LED1);

    /* Insert 5 second delay */
    HAL_Delay(5000);

    /* Turn LED1 OFF  */
    BSP_LED_Off(LED1);

    /* Tamper push-button (lines 15 to 10) will be used to wakeup the system from STOP mode */
    BSP_PB_Init(BUTTON_TAMPER, BUTTON_MODE_EXTI);

    /* Enter Stop Mode */
    HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFI);

    /* Configures system clock after wake-up from STOP */
    SystemClock_Config();
  }
}
开发者ID:Joe-Merten,项目名称:Stm32-Tools-Evaluation,代码行数:50,代码来源:main.c


示例18: RtcEnterLowPowerStopMode

void RtcEnterLowPowerStopMode( void )
{
    if( ( LowPowerDisableDuringTask == false ) && ( RtcTimerEventAllowsLowPower == true ) )
    {
        BoardDeInitMcu( );

        // Disable the Power Voltage Detector
        HAL_PWR_DisablePVD( );

        SET_BIT( PWR->CR, PWR_CR_CWUF );

        // Enable Ultra low power mode
        HAL_PWREx_EnableUltraLowPower( );

        // Enable the fast wake up from Ultra low power mode
        HAL_PWREx_EnableFastWakeUp( );

        // Enter Stop Mode
        HAL_PWR_EnterSTOPMode( PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFI );
    }
}
开发者ID:Lora-net,项目名称:LoRaMac-node,代码行数:21,代码来源:rtc-board.c


示例19: deepsleep

void deepsleep(void)
{
    // Stop HAL systick
    HAL_SuspendTick();

    // Request to enter STOP mode with regulator in low power mode
#if TARGET_STM32L4
    HAL_PWREx_EnterSTOP2Mode(PWR_STOPENTRY_WFI);
#else /* TARGET_STM32L4 */
    HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFI);
#endif /* TARGET_STM32L4 */

    // Restart HAL systick
    HAL_ResumeTick();

    // After wake-up from STOP reconfigure the PLL
    SetSysClock();

#if DEVICE_LOWPOWERTIMER
    rtc_synchronize();
#endif
}
开发者ID:SolarTeamEindhoven,项目名称:mbed,代码行数:22,代码来源:sleep.c


示例20: pyb_stop

/// \function stop()
STATIC mp_obj_t pyb_stop(void) {
    HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFI);

    // reconfigure the system clock after waking up

    // enable HSE
    __HAL_RCC_HSE_CONFIG(RCC_HSE_ON);
    while (!__HAL_RCC_GET_FLAG(RCC_FLAG_HSERDY)) {
    }

    // enable PLL
    __HAL_RCC_PLL_ENABLE();
    while (!__HAL_RCC_GET_FLAG(RCC_FLAG_PLLRDY)) {
    }

    // select PLL as system clock source
    MODIFY_REG(RCC->CFGR, RCC_CFGR_SW, RCC_SYSCLKSOURCE_PLLCLK);
    while (__HAL_RCC_GET_SYSCLK_SOURCE() != RCC_CFGR_SWS_PLL) {
    }

    return mp_const_none;
}
开发者ID:mrmichalis,项目名称:micropython,代码行数:23,代码来源:modpyb.c



注:本文中的HAL_PWR_EnterSTOPMode函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ HAL_RCC_GetClockConfig函数代码示例发布时间:2022-05-30
下一篇:
C++ HAL_PWR_EnableBkUpAccess函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap