44 lines
832 B
C++
44 lines
832 B
C++
#include <cstdlib>
|
|
|
|
#include "freertos/FreeRTOS.h"
|
|
#include "freertos/task.h"
|
|
|
|
#include "driver/gpio.h"
|
|
#include "inc/gpio.h"
|
|
|
|
static TaskHandle_t devTaskHandle = NULL;
|
|
static void devTask(void* parameters);
|
|
static GPIO gpio0(0, GPIO_DIRECTION_OUTPUT);
|
|
static GPIO gpio1(1, GPIO_DIRECTION_OUTPUT);
|
|
|
|
extern "C" void app_main(void)
|
|
{
|
|
|
|
// Create the development task
|
|
if(xTaskCreate(devTask, "DevTask", 2048, NULL, 3, &devTaskHandle) != pdPASS)
|
|
{
|
|
printf("Task not created");
|
|
}
|
|
|
|
while (true)
|
|
{
|
|
vTaskDelay(1000);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
static void devTask(void* parameters)
|
|
{
|
|
uint32_t counter = 0;
|
|
|
|
printf("DevTask created");
|
|
while (true)
|
|
{
|
|
(void)gpio0.SetOutput((GPIO_Value_t)(counter % 2));
|
|
(void)gpio1.SetOutput((GPIO_Value_t)(counter % 7));
|
|
counter++;
|
|
vTaskDelay(100);
|
|
}
|
|
}
|