aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2022-10-04 13:38:26 +0200
committerlonkaars <loek@pipeframe.xyz>2022-10-04 13:38:26 +0200
commitca7c9c3987a807f347d19976f63769a46ad7db83 (patch)
tree8410546c77937506f8d2ec25731eba336ec44399
parent4a1a7be27fd359309672393446f146fefb3507c0 (diff)
led blink example working with HAL libraries
-rw-r--r--stm32f091/main.c13
1 files 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();