diff options
Diffstat (limited to 'stm32f091/main.c')
| -rw-r--r-- | stm32f091/main.c | 33 | 
1 files changed, 13 insertions, 20 deletions
| diff --git a/stm32f091/main.c b/stm32f091/main.c index 848bfac..68e8dd4 100644 --- a/stm32f091/main.c +++ b/stm32f091/main.c @@ -1,29 +1,22 @@  #include <FreeRTOS.h>  #include <task.h> -#include <stm32f0xx.h> -#include <stdint.h> +#include <stm32f0xx_hal.h> -#define PORT GPIOA -#define PIN 5 +#include "main.h" +#include "setup.h" +#include "sensor.h" -void task_1() { -	uint8_t led = 1; - -	while (1) { -		PORT->ODR &= ~(1 << PIN); -		PORT->ODR |= (led << PIN); -		led ^= 1; - -		vTaskDelay(1000 / portTICK_RATE_MS); -	} -} +I2C_HandleTypeDef hi2c2; +UART_HandleTypeDef huart2;  int main() { -	RCC->AHBENR |= RCC_AHBENR_GPIOAEN | RCC_AHBENR_GPIOBEN; +	HAL_Init(); + +	SystemClock_Config(); +	MX_GPIO_Init(); +	MX_USART2_UART_Init(); +	MX_I2C2_Init(); -	PORT->MODER &= ~(0b11 << (PIN * 2)); -	PORT->MODER |= (0b01 << (PIN * 2)); -	 -	xTaskCreate(task_1, "task1", 128, NULL, 1, NULL); +	xTaskCreate(ws_sensor_read_task, "sensor", 128, NULL, 1, NULL);  	vTaskStartScheduler();  } |