/* * task.h * * Created on: Oct 29, 2021 * Author: compi */ #ifndef FSL_TASK_H_ #define FSL_TASK_H_ #include #include // FreeRTOS #include // FreeRTOS namespace fsl { template 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_ */