FreeRTOS: Removed FreeRTOSCPP and fixed build.

*Rewritten Master class to create C-style FreeRTOS task.
This commit is contained in:
RedHawk
2023-04-24 20:49:41 +03:00
parent ed426e4736
commit f85bf8ef8d
17 changed files with 48 additions and 6184 deletions

View File

@@ -5,6 +5,8 @@
* Author: tylen
*/
#include "board.h"
#include "FreeRTOS.h"
#include "queue.h"
namespace ThreadCommon
{
@@ -38,4 +40,13 @@ namespace ThreadCommon
ThreadCommon::EventType _type;
uint8_t _data;
};
/* global variables */
/* 'receiver'_'what'_'sender'_q */
extern QueueHandle_t master_event_all_q;
extern QueueHandle_t relay_event_master_q;
extern QueueHandle_t manager_event_master_q;
extern QueueHandle_t ui_event_manager_q;
}

View File

@@ -7,6 +7,14 @@
#include "Master.h"
Master::Master(std::string name, size_t stack_size, void* pvParams, size_t task_priority)
: name(name), stack_size(stack_size), pvParams(pvParams), task_priority(task_priority)
{
xTaskCreate (Master::taskWrapper, "Master_thread", this->stack_size, this->pvParams, this->task_priority, this->master_task_handle);
}
Master::~Master(){}
void Master::taskFunction() {
bool LedState = true;
for (;;) {
@@ -19,4 +27,3 @@ void Master::taskFunction() {
vTaskDelay(1000);
}
}

View File

@@ -10,25 +10,30 @@
#include "chip.h"
#include "board.h"
#include "FreeRTOSCPP/Task.hpp"
#include "FreeRTOSCPP/Kernel.hpp"
#include "threads/common/ThreadCommon.h"
#include "task.h"
#include <string>
class Master : public FreeRTOS::Task {
class Master {
public:
Master(): FreeRTOS::Task((tskIDLE_PRIORITY + 1UL),
configMINIMAL_STACK_SIZE * 10,
"master"){};
virtual ~Master() = default;
Master(Master&&) noexcept = default;
Master& operator=(Master&&) noexcept = default;
Master(std::string name, size_t stack_size, void* pvParams, size_t task_priority);
virtual ~Master();
void taskFunction();
static void taskWrapper(void *pvParams) {
Master* pSelf = reinterpret_cast<Master*>(pvParams);
pSelf->taskFunction();
}
//Master(Master&&) noexcept = default;
//Master& operator=(Master&&) noexcept = default;
private:
int led;
std::string name;
size_t stack_size;
void* pvParams;
size_t task_priority;
TaskHandle_t* master_task_handle;
//std::shared_ptr<ThreadCommon::Event> message;
};