From ca7c9c3987a807f347d19976f63769a46ad7db83 Mon Sep 17 00:00:00 2001 From: lonkaars Date: Tue, 4 Oct 2022 13:38:26 +0200 Subject: led blink example working with HAL libraries --- stm32f091/main.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/stm32f091/main.c b/stm32f091/main.c index 3ada476..344c3de 100644 --- a/stm32f091/main.c +++ b/stm32f091/main.c @@ -18,12 +18,13 @@ void task_1() { int main() { HAL_Init(); - GPIO_InitTypeDef GPIO_InitStruct; - GPIO_InitStruct.Pin = GPIO_PIN_5; - GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; - GPIO_InitStruct.Pull = GPIO_NOPULL; - GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; - HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); + __HAL_RCC_GPIOA_CLK_ENABLE(); + + HAL_GPIO_Init(GPIOA, &(GPIO_InitTypeDef) { + .Pin = GPIO_PIN_5, + .Mode = GPIO_MODE_OUTPUT_PP, + .Pull = GPIO_NOPULL + }); xTaskCreate(task_1, "task1", 128, NULL, 1, NULL); vTaskStartScheduler(); -- cgit v1.2.3