低功耗模式中除了低功耗运行模式之外 Low-power modes (except for Low-power run mode) 都通过执行WFI(Wait For Interrupt)或者 WFE (Wait for Event)指令来进入低功耗模式, 该指令会停止mcu核心来节省电量, 然后等待唤醒中断或者事件。
voidReduceIOPowerConsumption(void){
LL_GPIO_InitTypeDef gpio_initstruct ={
LL_GPIO_PIN_ALL, LL_GPIO_MODE_ANALOG,
LL_GPIO_SPEED_FREQ_HIGH, LL_GPIO_OUTPUT_PUSHPULL,
LL_GPIO_PULL_NO, LL_GPIO_AF_0};/* Set all GPIO in analog state to reduce power consumption, *//* Note: Debug using ST-Link is not possible during the execution of this *//* example because communication between ST-link and the device *//* under test is done through UART. All GPIO pins are disabled (set *//* to analog input mode) including UART I/O pins. */LL_IOP_GRP1_EnableClock(LL_IOP_GRP1_PERIPH_GPIOA |
LL_IOP_GRP1_PERIPH_GPIOB |
LL_IOP_GRP1_PERIPH_GPIOC);LL_GPIO_Init(GPIOA,&gpio_initstruct);LL_GPIO_Init(GPIOB,&gpio_initstruct);LL_GPIO_Init