task setup
This commit is contained in:
40
Application/Tasks/LightState.c
Normal file
40
Application/Tasks/LightState.c
Normal 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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user