parent
6c6a841daf
commit
baaa2df765
@ -1,2 +1,2 @@ |
|||||||
idf_component_register(SRCS "main.c" |
idf_component_register(SRCS "main.c" "myTask.c" "myTask.h" |
||||||
INCLUDE_DIRS "") |
INCLUDE_DIRS "") |
||||||
|
|||||||
@ -0,0 +1,34 @@ |
|||||||
|
/*
|
||||||
|
* task.c |
||||||
|
* |
||||||
|
* Created on: 03.11.2022 |
||||||
|
* Author: jonas |
||||||
|
*/ |
||||||
|
|
||||||
|
|
||||||
|
#include "myTask.h" |
||||||
|
#include "freertos/FreeRTOS.h" |
||||||
|
#include "freertos/task.h" |
||||||
|
|
||||||
|
static TaskHandle_t myTaskHandle; |
||||||
|
|
||||||
|
static void myTask(void *pv){ |
||||||
|
uint32_t counter = 0; |
||||||
|
if(pv != NULL){ |
||||||
|
printf("task argument: %s\n", (char*)pv); |
||||||
|
} |
||||||
|
for(;;){ |
||||||
|
printf("task was called. counter=%i\n", ++counter); |
||||||
|
fflush(stdout); |
||||||
|
vTaskDelay(pdMS_TO_TICKS(1000)); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
BaseType_t res; |
||||||
|
|
||||||
|
void MyTask_Start(void){ |
||||||
|
res = xTaskCreate(myTask, "task1", 4096/sizeof(StackType_t), (void*)"hello!", tskIDLE_PRIORITY, &myTaskHandle); |
||||||
|
if(res != pdPASS){ |
||||||
|
printf("creating myTask failed!\r\n"); |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,14 @@ |
|||||||
|
/*
|
||||||
|
* task.h |
||||||
|
* |
||||||
|
* Created on: 03.11.2022 |
||||||
|
* Author: jonas |
||||||
|
*/ |
||||||
|
|
||||||
|
#ifndef MAIN_MYTASK_H_ |
||||||
|
#define MAIN_MYTASK_H_ |
||||||
|
|
||||||
|
void MyTask_Start(void); |
||||||
|
|
||||||
|
|
||||||
|
#endif /* MAIN_MYTASK_H_ */ |
||||||
Loading…
Reference in new issue