Home > other >  Just do it! Was in line for a great god taught!!!!! How to write code STM32L0 stop model
Just do it! Was in line for a great god taught!!!!! How to write code STM32L0 stop model

Time:09-27

You need to implement
LED1, LED2 light click into the stop mode,
Click the awakening, LED1, LED2 bright,
Press enter to stop mode again,,,

Below is my code to fill in part,

 

/* the USER CODE BEGIN PFP */
Void HAL_GPIO_EXTI_Callback (uint16_t GPIO_Pin);
/* the USER CODE END PFP */

USER CODE BEGIN 0/* */
__IO uint8_t UserButtonStatus=0;
/* the USER CODE END 0 */

While (1)
{
/* the USER CODE END WHILE */

/* USER CODE BEGIN 3 */
UserButtonStatus=0;
/* Loop while the User button is maintained pressed */
While (UserButtonStatus==0)
{
HAL_GPIO_WritePin (GPIOA, LED1_Pin | LED2_Pin GPIO_PIN_RESET);
}
While (UserButtonStatus==1)
{
HAL_GPIO_WritePin (GPIOA, LED1_Pin | LED2_Pin GPIO_PIN_SET);
//HAL_GPIO_TogglePin (GPIOA, LED1_Pin | LED2_Pin);
//HAL_Delay (200);
HAL_PWR_EnterSTOPMode (PWR_LOWPOWERREGULATOR_ON PWR_STOPENTRY_WFI);
UserButtonStatus=0;
}

}
/* USER CODE END 3 */

Void HAL_GPIO_EXTI_Callback (uint16_t GPIO_Pin)
{
UserButtonStatus=1;
}
  • Related