Loading...
Searching...
No Matches
tasklist.c
1/***********************************************************************************
2 * @file tasklist.c *
3 * @author Matt Ricci *
4 * @addtogroup Task_Management *
5 * *
6 * @{ *
7 ***********************************************************************************/
8
9#include "tasklist.h"
10
11#include "string.h"
12
13static TaskHandle_t tasklist[MAX_TASKS];
14
15/* ============================================================================================== */
24TaskHandle_t *TaskList_getTaskByName(char *name) {
25 // Iterate through task handle list
26 for (int i = 0; i < MAX_TASKS; i++) {
27 if (!strcmp(pcTaskGetName(tasklist[i]), name))
28 // Return task handle if name matches
29 return &tasklist[i];
30 }
31 // Otherwise, return NULL if not found
32 return NULL;
33}
34
35/* ============================================================================================== */
42TaskHandle_t *TaskList_new() {
43 // Iterate through task handle list
44 for (int i = 0; i < MAX_TASKS; i++) {
45 if (tasklist[i] == NULL)
46 // Return first empty handle
47 return &tasklist[i];
48 }
49 // Return NULL if list is full
50 return NULL;
51}
52
TaskHandle_t * TaskList_new()
Retrieve a pointer to the first empty task handle in list.
Definition tasklist.c:42
TaskHandle_t * TaskList_getTaskByName(char *name)
Retrieve task handle from list by name string.
Definition tasklist.c:24