aboutsummaryrefslogtreecommitdiff
path: root/stm32f091/main.c
blob: 5e5071e5d8421f43ee14a4eefea1c94437b5aaf7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include <FreeRTOS.h>
#include <task.h>
#include <stm32f0xx.h>
#include <stdint.h>
#include <stm32f0xx_hal_gpio.h>

void task_1() {
	uint8_t led = 1;

	while (1) {
		HAL_GPIO_WritePin(GPIOA, GPIO_PIN_5, led);
		led ^= 1;

		vTaskDelay(1000 / portTICK_RATE_MS);
	}
}

int main() {
	HAL_GPIO_Init(GPIOA, &(GPIO_InitTypeDef) {
		.Mode = GPIO_MODE_OUTPUT_PP,
		.Pull = GPIO_NOPULL,
		.Pin = GPIO_PIN_5
	});

	xTaskCreate(task_1, "task1", 128, NULL, 1, NULL);
	vTaskStartScheduler();
}