task setup

This commit is contained in:
2024-05-18 02:46:47 +02:00
parent 3869b31b03
commit e995e1bd01
3 changed files with 49 additions and 0 deletions

View File

@@ -0,0 +1,40 @@
#include "cmsis_os2.h"
#include "LightState.h"
#include "BSP_GPIO.h"
#include "BSP_INA.h"
// Create the task with a specific priority and stack size
osThreadAttr_t task_attr = {
.name = "LightStateTask",
.priority = osPriorityNormal,
.stack_size = 1024
};
// Function prototype for the task function
void LightStateTask(void *argument);
// Function to start the LightStateTask
void LightStateTask_start(void)
{
osThreadNew(LightStateTask, NULL, &task_attr);
}
// Task function
void LightStateTask(void *argument)
{
// Infinite loop to keep the task running
while (1)
{
// default state
int next_state = 0;
// check if k15 is on
// Delay the task for a certain amount of time (in milliseconds)
osDelay(500);
}
}