#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "driver/gpio.h"
#define BLINK_GPIO 2
void blink_task(void *pvParameter)
{
gpio_reset_pin(BLINK_GPIO);
gpio_set_direction(BLINK_GPIO, GPIO_MODE_OUTPUT);
while (1) {
gpio_set_level(BLINK_GPIO, 1);
vTaskDelay(pdMS_TO_TICKS(2000));
gpio_set_level(BLINK_GPIO, 0);
vTaskDelay(pdMS_TO_TICKS(2000));
}
}
void app_main(void)
{
xTaskCreate(blink_task, "blink_task", 2048, NULL, 5, NULL);
}
/* XTaskCreate(task_function, name_to idendity the task,stack size,parameter to the function (task),task_priority,task handler)
task handler - This is where FreeRTOS will store the Task Handle—like an ID for your task.
- we can use that handle to:
- Suspend/resume the task
- Delete it (vTaskDelete(handle))
- Notify it with xTaskNotify()
if i do care we want to provid the address of the taskhandler
*/