relay: [#9] init task
This commit is contained in:
parent
2f58aad006
commit
2a42371458
@ -43,6 +43,7 @@
|
|||||||
<option id="com.crt.advproject.cpp.fpu.1211390952" name="Floating point" superClass="com.crt.advproject.cpp.fpu" useByScannerDiscovery="true"/>
|
<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">
|
<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=""${workspace_loc:/lpc_board_nxp_lpcxpresso_11u68/inc}""/>
|
<listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_11u68/inc}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/src/threads/relay}""/>
|
||||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/src}""/>
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/src}""/>
|
||||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_11u6x/inc}""/>
|
<listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_11u6x/inc}""/>
|
||||||
<listOptionValue builtIn="false" value=""${workspace_loc:/shoh/freertos}""/>
|
<listOptionValue builtIn="false" value=""${workspace_loc:/shoh/freertos}""/>
|
||||||
|
|||||||
@ -9,6 +9,7 @@
|
|||||||
#include "Log.h"
|
#include "Log.h"
|
||||||
#include "ThreadCommon.h"
|
#include "ThreadCommon.h"
|
||||||
#include "Rotary.h"
|
#include "Rotary.h"
|
||||||
|
#include "Relay.h"
|
||||||
#include "Manager.h"
|
#include "Manager.h"
|
||||||
#include "Logging.h"
|
#include "Logging.h"
|
||||||
#include "UserInterface.h"
|
#include "UserInterface.h"
|
||||||
@ -108,6 +109,9 @@ void thread_master(void* pvParams) {
|
|||||||
manager->qm->createQueue(20,
|
manager->qm->createQueue(20,
|
||||||
sizeof(UserInterface::InterfaceWithData),
|
sizeof(UserInterface::InterfaceWithData),
|
||||||
ThreadCommon::QueueManager::ui_event_manager);
|
ThreadCommon::QueueManager::ui_event_manager);
|
||||||
|
manager->qm->createQueue(10,
|
||||||
|
sizeof(Event),
|
||||||
|
ThreadCommon::QueueManager::relay_event_master);
|
||||||
LOG_INFO("Master created queues");
|
LOG_INFO("Master created queues");
|
||||||
|
|
||||||
|
|
||||||
@ -121,6 +125,9 @@ void thread_master(void* pvParams) {
|
|||||||
manager->tm->createTask(thread_user_interface, "user_interface",
|
manager->tm->createTask(thread_user_interface, "user_interface",
|
||||||
configMINIMAL_STACK_SIZE * 10,tskIDLE_PRIORITY + 1UL,
|
configMINIMAL_STACK_SIZE * 10,tskIDLE_PRIORITY + 1UL,
|
||||||
static_cast<void*>(manager));
|
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");
|
LOG_INFO("Master created tasks");
|
||||||
m.taskFunction();
|
m.taskFunction();
|
||||||
}
|
}
|
||||||
|
|||||||
33
source/shoh/src/threads/relay/Relay.cpp
Normal file
33
source/shoh/src/threads/relay/Relay.cpp
Normal 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);
|
||||||
|
}
|
||||||
24
source/shoh/src/threads/relay/Relay.h
Normal file
24
source/shoh/src/threads/relay/Relay.h
Normal 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_ */
|
||||||
Loading…
x
Reference in New Issue
Block a user