Kinda works
This commit is contained in:
parent
f3d345e2e3
commit
662a7a9b12
40 changed files with 2851 additions and 26 deletions
36
components/fsl/task.h
Normal file
36
components/fsl/task.h
Normal file
|
@ -0,0 +1,36 @@
|
|||
/*
|
||||
* task.h
|
||||
*
|
||||
* Created on: Oct 29, 2021
|
||||
* Author: compi
|
||||
*/
|
||||
|
||||
#ifndef FSL_TASK_H_
|
||||
#define FSL_TASK_H_
|
||||
|
||||
#include <FreeRTOS.h>
|
||||
#include <task.h> // FreeRTOS
|
||||
#include <semphr.h> // FreeRTOS
|
||||
|
||||
namespace fsl {
|
||||
|
||||
template<typename T, uint32_t stackSize> class Task {
|
||||
public:
|
||||
Task(UBaseType_t priority) : m_priority(priority) {}
|
||||
void Start(SemaphoreHandle_t doneSem = nullptr, bool waitForInit = false) {
|
||||
m_handle = xTaskCreateStatic(T::TaskFn, getName(), sizeof(m_stack)/sizeof(m_stack[0]),
|
||||
this, m_priority, m_stack, &m_tcb);
|
||||
}
|
||||
virtual ~Task() {};
|
||||
virtual char const * getName() = 0;
|
||||
|
||||
private:
|
||||
TaskHandle_t m_handle;
|
||||
UBaseType_t m_priority;
|
||||
StaticTask_t m_tcb;
|
||||
StackType_t m_stack[stackSize];
|
||||
};
|
||||
|
||||
} /* namespace fsl */
|
||||
|
||||
#endif /* FSL_TASK_H_ */
|
Loading…
Add table
Add a link
Reference in a new issue