int main(void)
{
GPIO_InitTypeDef GPIO_InitStruct;
/* STM32L4xx HAL library initialization:
- Configure the Flash prefetch
- 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
*/
HAL_Init();
/* Configure LED4 */
BSP_LED_Init(LED4);
/* Configure the system clock to 80 MHz */
SystemClock_80MHz();
/* User push-button (External line 13) will be used to enable or not the SMPS mode */
BSP_PB_Init(BUTTON_USER, BUTTON_MODE_EXTI);
/* ------------------------------------------ */
/* Insert 5 seconds delay */
HAL_Delay(5000);
/********************************/
/* 80 MHZ */
/* PWR_REGULATOR_VOLTAGE_SCALE1 */
/* SMPS IS OFF */
/********************************/
/* ------------------ GPIO ------------------ */
BSP_LED_Off(LED4);
GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
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(GPIOE, &GPIO_InitStruct);
HAL_GPIO_Init(GPIOH, &GPIO_InitStruct);
__HAL_RCC_GPIOA_CLK_DISABLE();
__HAL_RCC_GPIOB_CLK_DISABLE();
__HAL_RCC_GPIOC_CLK_DISABLE();
__HAL_RCC_GPIOD_CLK_DISABLE();
__HAL_RCC_GPIOE_CLK_DISABLE();
__HAL_RCC_GPIOH_CLK_DISABLE();
if (button_pressed == 1)
{
test_run_range2_80mhz_SMPS();
}
else
{
}
whileloop1();
}
|