relay: [#9] init task

This commit is contained in:
Vasily Davydov 2023-05-12 23:25:07 +03:00
parent 2f58aad006
commit 2a42371458
4 changed files with 65 additions and 0 deletions

View File

@ -43,6 +43,7 @@
<option id="com.crt.advproject.cpp.fpu.1211390952" name="Floating point" superClass="com.crt.advproject.cpp.fpu" useByScannerDiscovery="true"/>
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="gnu.cpp.compiler.option.include.paths.417443680" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" useByScannerDiscovery="false" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/lpc_board_nxp_lpcxpresso_11u68/inc}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/src/threads/relay}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/src}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/lpc_chip_11u6x/inc}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/shoh/freertos}&quot;"/>

View File

@ -9,6 +9,7 @@
#include "Log.h"
#include "ThreadCommon.h"
#include "Rotary.h"
#include "Relay.h"
#include "Manager.h"
#include "Logging.h"
#include "UserInterface.h"
@ -108,6 +109,9 @@ void thread_master(void* pvParams) {
manager->qm->createQueue(20,
sizeof(UserInterface::InterfaceWithData),
ThreadCommon::QueueManager::ui_event_manager);
manager->qm->createQueue(10,
sizeof(Event),
ThreadCommon::QueueManager::relay_event_master);
LOG_INFO("Master created queues");
@ -121,6 +125,9 @@ void thread_master(void* pvParams) {
manager->tm->createTask(thread_user_interface, "user_interface",
configMINIMAL_STACK_SIZE * 10,tskIDLE_PRIORITY + 1UL,
static_cast<void*>(manager));
manager->tm->createTask(thread_relay, "relay",
configMINIMAL_STACK_SIZE * 10,tskIDLE_PRIORITY + 1UL,
static_cast<void*>(manager));
LOG_INFO("Master created tasks");
m.taskFunction();
}

View File

@ -0,0 +1,33 @@
/*
* Relay.cpp
*
* Created on: 12 May 2023
* Author: tylen
*/
#include "Relay.h"
#include "Event.h"
#include "Log.h"
Relay::Relay(ThreadCommon::QueueManager* qm): _qm(qm) {
LOG_DEBUG("Creating Relay");
}
Relay::~Relay() {
LOG_ERROR("Deleting Relay");
}
void Relay::taskFunction()
{
Event data(Event::Null, 0);
for(;;)
{
_qm->receive<Event>(ThreadCommon::QueueManager::relay_event_master, &data, portMAX_DELAY);
}
}
void thread_relay(void * pvParams)
{
ThreadCommon::CommonManagers * manager = static_cast<ThreadCommon::CommonManagers*>(pvParams);
Relay r(manager->qm);
}

View File

@ -0,0 +1,24 @@
/*
* Relay.h
*
* Created on: 12 May 2023
* Author: tylen
*/
#ifndef THREADS_RELAY_RELAY_H_
#define THREADS_RELAY_RELAY_H_
#include "ThreadCommon.h"
class Relay {
public:
Relay(ThreadCommon::QueueManager* qm);
virtual ~Relay();
void taskFunction();
private:
ThreadCommon::QueueManager* _qm;
};
void thread_relay(void * pvParams);
#endif /* THREADS_RELAY_RELAY_H_ */