40 lines
800 B
C
40 lines
800 B
C
#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);
|
|
}
|
|
} |