25 lines
944 B
C
25 lines
944 B
C
#include "freertos/idf_additions.h"
|
|
#include "freertos/projdefs.h"
|
|
#include "tasks.h"
|
|
#include <stdbool.h>
|
|
|
|
extern QueueHandle_t blink_cmd_q;
|
|
|
|
void app_main(void) {
|
|
TaskHandle_t task_handle_blink;
|
|
TaskHandle_t task_handle_blink_cycle;
|
|
|
|
blink_cmd_q = xQueueCreate(10, sizeof(BlinkCmd_t));
|
|
|
|
// Static here, since main exits, this becomes a dead pointer almost instantly
|
|
static BlinkCmd_t initial_command = {.variant = BLINK_STATE, .state = 1};
|
|
|
|
if (xTaskCreate(task_blink, "task_blink", 1 << 11, (void *)&initial_command, 0, &task_handle_blink) != pdPASS)
|
|
printf("Error creating task: task_blink");
|
|
|
|
if (xTaskCreate(task_blink_cycle, "task_blink_cycle", 1 << 11, NULL, 0, &task_handle_blink_cycle) != pdPASS)
|
|
printf("Error creating task: task_blink_cycle");
|
|
|
|
if (xTaskCreate(vPeriodicTask, "task_periodic", 1 << 11, NULL, 0, NULL) != pdPASS)
|
|
printf("Error creating task: task_periodic");
|
|
}
|