update Scheduler.startLoop() for prio and name
This commit is contained in:
1 parent
62e766d05d
commit
42ad38b9ce
2 files changed
+7
-17
No files matched your search
+6
-15
@@ -45,6 +45,7 @@ static void _redirect_task(void* arg)
|
||||
while(1)
|
||||
{
|
||||
taskfunc();
|
||||
delay(0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,25 +54,15 @@ SchedulerRTOS::SchedulerRTOS(void)
|
||||
_num = 1; // loop is already created by default
|
||||
}
|
||||
|
||||
bool SchedulerRTOS::startLoop(taskfunc_t task, uint32_t stack_size)
|
||||
bool SchedulerRTOS::startLoop(taskfunc_t task, uint32_t stack_size, uint32_t prio, const char* name)
|
||||
{
|
||||
char name[8] = "loop0";
|
||||
name[4] += _num;
|
||||
|
||||
if ( startLoop(task, name, stack_size) )
|
||||
static char const * const name_default = "unnamed_task";
|
||||
if (name == NULL)
|
||||
{
|
||||
_num++;
|
||||
return true;
|
||||
}else
|
||||
{
|
||||
return false;
|
||||
name = name_default;
|
||||
}
|
||||
}
|
||||
|
||||
bool SchedulerRTOS::startLoop(taskfunc_t task, const char* name, uint32_t stack_size)
|
||||
{
|
||||
TaskHandle_t handle;
|
||||
return pdPASS == xTaskCreate( _redirect_task, name, stack_size, (void*) task, TASK_PRIO_LOW, &handle);
|
||||
return pdPASS == xTaskCreate( _redirect_task, name, stack_size, (void*) task, prio, &handle);
|
||||
}
|
||||
|
||||
|
||||
|
||||
+1
-2
@@ -93,8 +93,7 @@ public:
|
||||
|
||||
SchedulerRTOS(void);
|
||||
|
||||
bool startLoop(taskfunc_t task, uint32_t stack_size = SCHEDULER_STACK_SIZE_DFLT);
|
||||
bool startLoop(taskfunc_t task, const char* name, uint32_t stack_size = SCHEDULER_STACK_SIZE_DFLT);
|
||||
bool startLoop(taskfunc_t task, uint32_t stack_size = SCHEDULER_STACK_SIZE_DFLT, uint32_t prio = TASK_PRIO_LOW, const char* name = NULL);
|
||||
};
|
||||
|
||||
extern SchedulerRTOS Scheduler;
|
||||
|
||||
Reference in new issue
Block a user