Moved createTask into own .cpp file to avoid warnings
This commit is contained in:
@@ -1,5 +1,25 @@
|
|||||||
#include "taskutils.h"
|
#include "taskutils.h"
|
||||||
|
|
||||||
namespace espcpputils {
|
namespace espcpputils {
|
||||||
|
BaseType_t createTask(TaskFunction_t pvTaskCode,
|
||||||
|
const char * const pcName,
|
||||||
|
const uint32_t usStackDepth,
|
||||||
|
void * const pvParameters,
|
||||||
|
UBaseType_t uxPriority,
|
||||||
|
TaskHandle_t * const pvCreatedTask,
|
||||||
|
CoreAffinity coreAffinity)
|
||||||
|
{
|
||||||
|
switch (coreAffinity)
|
||||||
|
{
|
||||||
|
case CoreAffinity::Core0:
|
||||||
|
case CoreAffinity::Core1:
|
||||||
|
return xTaskCreatePinnedToCore(pvTaskCode, pcName, usStackDepth, pvParameters, uxPriority, pvCreatedTask, int(coreAffinity));
|
||||||
|
case CoreAffinity::Both:
|
||||||
|
return xTaskCreate(pvTaskCode, pcName, usStackDepth, pvParameters, uxPriority, pvCreatedTask);
|
||||||
|
default:
|
||||||
|
__builtin_unreachable();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
IMPLEMENT_TYPESAFE_ENUM(CoreAffinity, : uint8_t, CoreAffinityValues)
|
IMPLEMENT_TYPESAFE_ENUM(CoreAffinity, : uint8_t, CoreAffinityValues)
|
||||||
} // namespace espcpputils
|
} // namespace espcpputils
|
||||||
|
@@ -14,25 +14,11 @@ namespace espcpputils {
|
|||||||
x(Both)
|
x(Both)
|
||||||
DECLARE_TYPESAFE_ENUM(CoreAffinity, : uint8_t, CoreAffinityValues)
|
DECLARE_TYPESAFE_ENUM(CoreAffinity, : uint8_t, CoreAffinityValues)
|
||||||
|
|
||||||
namespace {
|
|
||||||
BaseType_t createTask(TaskFunction_t pvTaskCode,
|
BaseType_t createTask(TaskFunction_t pvTaskCode,
|
||||||
const char * const pcName,
|
const char * const pcName,
|
||||||
const uint32_t usStackDepth,
|
const uint32_t usStackDepth,
|
||||||
void * const pvParameters,
|
void * const pvParameters,
|
||||||
UBaseType_t uxPriority,
|
UBaseType_t uxPriority,
|
||||||
TaskHandle_t * const pvCreatedTask,
|
TaskHandle_t * const pvCreatedTask,
|
||||||
CoreAffinity coreAffinity)
|
CoreAffinity coreAffinity);
|
||||||
{
|
|
||||||
switch (coreAffinity)
|
|
||||||
{
|
|
||||||
case CoreAffinity::Core0:
|
|
||||||
case CoreAffinity::Core1:
|
|
||||||
return xTaskCreatePinnedToCore(pvTaskCode, pcName, usStackDepth, pvParameters, uxPriority, pvCreatedTask, int(coreAffinity));
|
|
||||||
case CoreAffinity::Both:
|
|
||||||
return xTaskCreate(pvTaskCode, pcName, usStackDepth, pvParameters, uxPriority, pvCreatedTask);
|
|
||||||
default:
|
|
||||||
__builtin_unreachable();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} // namespace
|
|
||||||
} // namespace espcpputils
|
} // namespace espcpputils
|
||||||
|
Reference in New Issue
Block a user