diff options
author | lonkaars <loek@pipeframe.xyz> | 2022-10-02 21:42:06 +0200 |
---|---|---|
committer | lonkaars <loek@pipeframe.xyz> | 2022-10-02 21:42:06 +0200 |
commit | 2094aa7dbc69771de1669aa533deb29d940c6e50 (patch) | |
tree | 347abd135125981435905a161d61ca0d1f3438bd /stm32f091/main.c | |
parent | ad7ef8a421086b9c7085f6d149b2c555c4e7d635 (diff) |
broken makefile with hal_conf.h
Diffstat (limited to 'stm32f091/main.c')
-rw-r--r-- | stm32f091/main.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/stm32f091/main.c b/stm32f091/main.c index 848bfac..5e5071e 100644 --- a/stm32f091/main.c +++ b/stm32f091/main.c @@ -2,16 +2,13 @@ #include <task.h> #include <stm32f0xx.h> #include <stdint.h> - -#define PORT GPIOA -#define PIN 5 +#include <stm32f0xx_hal_gpio.h> void task_1() { uint8_t led = 1; while (1) { - PORT->ODR &= ~(1 << PIN); - PORT->ODR |= (led << PIN); + HAL_GPIO_WritePin(GPIOA, GPIO_PIN_5, led); led ^= 1; vTaskDelay(1000 / portTICK_RATE_MS); @@ -19,11 +16,12 @@ void task_1() { } int main() { - RCC->AHBENR |= RCC_AHBENR_GPIOAEN | RCC_AHBENR_GPIOBEN; + HAL_GPIO_Init(GPIOA, &(GPIO_InitTypeDef) { + .Mode = GPIO_MODE_OUTPUT_PP, + .Pull = GPIO_NOPULL, + .Pin = GPIO_PIN_5 + }); - PORT->MODER &= ~(0b11 << (PIN * 2)); - PORT->MODER |= (0b01 << (PIN * 2)); - xTaskCreate(task_1, "task1", 128, NULL, 1, NULL); vTaskStartScheduler(); } |