Skip to content
This repository was archived by the owner on Sep 6, 2022. It is now read-only.

Commit c18b7ca

Browse files
committed
Create fallback xTaskCreateUniversal function
1 parent 5b1ef41 commit c18b7ca

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

src/AsyncTCP.cpp

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,12 +210,32 @@ static void _stop_async_task(){
210210
}
211211
}
212212
*/
213+
214+
static bool customTaskCreateUniversal(
215+
TaskFunction_t pxTaskCode,
216+
const char * const pcName,
217+
const uint32_t usStackDepth,
218+
void * const pvParameters,
219+
UBaseType_t uxPriority,
220+
TaskHandle_t * const pxCreatedTask,
221+
const BaseType_t xCoreID) {
222+
#ifndef CONFIG_FREERTOS_UNICORE
223+
if(xCoreID >= 0 && xCoreID < 2) {
224+
return xTaskCreatePinnedToCore(pxTaskCode, pcName, usStackDepth, pvParameters, uxPriority, pxCreatedTask, xCoreID);
225+
} else {
226+
#endif
227+
return xTaskCreate(pxTaskCode, pcName, usStackDepth, pvParameters, uxPriority, pxCreatedTask);
228+
#ifndef CONFIG_FREERTOS_UNICORE
229+
}
230+
#endif
231+
}
232+
213233
static bool _start_async_task(){
214234
if(!_init_async_event_queue()){
215235
return false;
216236
}
217237
if(!_async_service_task_handle){
218-
xTaskCreateUniversal(_async_service_task, "async_tcp", 8192 * 2, NULL, 3, &_async_service_task_handle, CONFIG_ASYNC_TCP_RUNNING_CORE);
238+
customTaskCreateUniversal(_async_service_task, "async_tcp", 8192 * 2, NULL, 3, &_async_service_task_handle, CONFIG_ASYNC_TCP_RUNNING_CORE);
219239
if(!_async_service_task_handle){
220240
return false;
221241
}

0 commit comments

Comments
 (0)