threads: add Event class for master communication #6

This commit is contained in:
Vasily Davydov 2023-04-13 19:20:38 +03:00
parent 409fb44d2c
commit b88a1dd2ee
2 changed files with 43 additions and 0 deletions

View File

@ -0,0 +1,41 @@
/*
* ThreadCommon.h
*
* Created on: 13 Apr 2023
* Author: tylen
*/
#include "board.h"
namespace ThreadCommon
{
typedef enum EventType
{
Rotary,
Temperature,
Manager
};
class Event
{
public:
Event(ThreadCommon::EventType type, uint8_t data)
{
_type = type;
_data = data;
}
ThreadCommon::EventType getType() const
{
return _type;
}
uint8_t getData() const
{
return _data;
}
private:
ThreadCommon::EventType _type;
uint8_t _data;
};
}

View File

@ -12,6 +12,7 @@
#include "board.h" #include "board.h"
#include "FreeRTOSCPP/Task.hpp" #include "FreeRTOSCPP/Task.hpp"
#include "FreeRTOSCPP/Kernel.hpp" #include "FreeRTOSCPP/Kernel.hpp"
#include "threads/common/ThreadCommon.h"
#include "task.h" #include "task.h"
@ -28,6 +29,7 @@ public:
void taskFunction(); void taskFunction();
private: private:
int led; int led;
std::shared_ptr<ThreadCommon::Event> message;
}; };