diff --git a/source/shoh/.cproject b/source/shoh/.cproject
index aa180f6..c20b11d 100644
--- a/source/shoh/.cproject
+++ b/source/shoh/.cproject
@@ -50,6 +50,7 @@
+
@@ -303,31 +304,31 @@
- <?xml version="1.0" encoding="UTF-8"?>
-<TargetConfig>
-<Properties property_2="LPC11U6x_256K.cfx" property_3="NXP" property_4="LPC11U68" property_count="5" version="100300"/>
-<infoList vendor="NXP">
-<info chip="LPC11U68" flash_driver="LPC11U6x_256K.cfx" match_id="0x0" name="LPC11U68" stub="crt_emu_cm3_gen">
-<chip>
-<name>LPC11U68</name>
-<family>LPC11U6x</family>
-<vendor>NXP (formerly Philips)</vendor>
-<reset board="None" core="Real" sys="Real"/>
-<clock changeable="TRUE" freq="12MHz" is_accurate="TRUE"/>
-<memory can_program="true" id="Flash" is_ro="true" type="Flash"/>
-<memory id="RAM" type="RAM"/>
-<memory id="Periph" is_volatile="true" type="Peripheral"/>
-<memoryInstance derived_from="Flash" id="MFlash256" location="0x0" size="0x40000"/>
-<memoryInstance derived_from="RAM" id="Ram0_32" location="0x10000000" size="0x8000"/>
-<memoryInstance derived_from="RAM" id="Ram1_2" location="0x20000000" size="0x800"/>
-<memoryInstance derived_from="RAM" id="Ram2USB_2" location="0x20004000" size="0x800"/>
-</chip>
-<processor>
-<name gcc_name="cortex-m0">Cortex-M0</name>
-<family>Cortex-M</family>
-</processor>
-</info>
-</infoList>
+ <?xml version="1.0" encoding="UTF-8"?>
+<TargetConfig>
+<Properties property_2="LPC11U6x_256K.cfx" property_3="NXP" property_4="LPC11U68" property_count="5" version="100300"/>
+<infoList vendor="NXP">
+<info chip="LPC11U68" flash_driver="LPC11U6x_256K.cfx" match_id="0x0" name="LPC11U68" stub="crt_emu_cm3_gen">
+<chip>
+<name>LPC11U68</name>
+<family>LPC11U6x</family>
+<vendor>NXP (formerly Philips)</vendor>
+<reset board="None" core="Real" sys="Real"/>
+<clock changeable="TRUE" freq="12MHz" is_accurate="TRUE"/>
+<memory can_program="true" id="Flash" is_ro="true" type="Flash"/>
+<memory id="RAM" type="RAM"/>
+<memory id="Periph" is_volatile="true" type="Peripheral"/>
+<memoryInstance derived_from="Flash" id="MFlash256" location="0x0" size="0x40000"/>
+<memoryInstance derived_from="RAM" id="Ram0_32" location="0x10000000" size="0x8000"/>
+<memoryInstance derived_from="RAM" id="Ram1_2" location="0x20000000" size="0x800"/>
+<memoryInstance derived_from="RAM" id="Ram2USB_2" location="0x20004000" size="0x800"/>
+</chip>
+<processor>
+<name gcc_name="cortex-m0">Cortex-M0</name>
+<family>Cortex-M</family>
+</processor>
+</info>
+</infoList>
</TargetConfig>
diff --git a/source/shoh/src/main.cpp b/source/shoh/src/main.cpp
index bf1f949..91d24cd 100644
--- a/source/shoh/src/main.cpp
+++ b/source/shoh/src/main.cpp
@@ -5,6 +5,7 @@
#include
#include "ThreadCommon.h"
#include "Master.h"
+#include "Rotary.h"
int main(void)
@@ -17,20 +18,15 @@ int main(void)
qmanager->createQueue(100,
sizeof(Event),
ThreadCommon::QueueManager::master_event_all);
-
//Creating tasks
manager->createTask(master_thread, "master",
- configMINIMAL_STACK_SIZE * 10,tskIDLE_PRIORITY + 1UL,
- static_cast(qmanager));
+ configMINIMAL_STACK_SIZE * 10,tskIDLE_PRIORITY + 1UL,
+ static_cast(qmanager));
+ manager->createTask(rotary_thread, "rotary",
+ configMINIMAL_STACK_SIZE * 10,tskIDLE_PRIORITY + 1UL,
+ static_cast(qmanager));
- //
- Event* e = new Event(Event::Rotary, 1);
-
- qmanager->send(ThreadCommon::QueueManager::master_event_all, e, 1000);
- //
-
// Start the real time kernel with preemption.
- //FreeRTOS::Kernel::startScheduler();
vTaskStartScheduler ();
return 1;
diff --git a/source/shoh/src/threads/common/ThreadCommon.h b/source/shoh/src/threads/common/ThreadCommon.h
index 73a5b72..2e6040b 100644
--- a/source/shoh/src/threads/common/ThreadCommon.h
+++ b/source/shoh/src/threads/common/ThreadCommon.h
@@ -18,6 +18,13 @@
namespace ThreadCommon
{
+ enum RotaryAction
+ {
+ Right,
+ Left,
+ Press,
+ Idle
+ };
class ThreadManager
{
public:
diff --git a/source/shoh/src/threads/master/Master.cpp b/source/shoh/src/threads/master/Master.cpp
index 34f86d9..e761e1e 100644
--- a/source/shoh/src/threads/master/Master.cpp
+++ b/source/shoh/src/threads/master/Master.cpp
@@ -18,7 +18,7 @@ void Master::taskFunction() {
bool LedState = true;
for (;;) {
_qm->receive(ThreadCommon::QueueManager::master_event_all, &data, portMAX_DELAY);
- if(data.getDataOf(Event::Rotary) == 1){
+ if(data.getDataOf(Event::Rotary) == ThreadCommon::RotaryAction::Idle){
Board_LED_Set(led, LedState);
}
}
diff --git a/source/shoh/src/threads/rotary/Rotary.cpp b/source/shoh/src/threads/rotary/Rotary.cpp
new file mode 100644
index 0000000..9d5e952
--- /dev/null
+++ b/source/shoh/src/threads/rotary/Rotary.cpp
@@ -0,0 +1,26 @@
+/*
+ * Rotary.cpp
+ *
+ * Created on: 26 Apr 2023
+ * Author: tylen
+ */
+
+#include "Rotary.h"
+
+Rotary::Rotary(ThreadCommon::QueueManager* qm) : _qm(qm) {}
+
+Rotary::~Rotary() {}
+
+void Rotary::taskFunction()
+{
+Event data(Event::Null, 0);
+ Event* e = new Event(Event::Rotary, ThreadCommon::RotaryAction::Idle);
+ _qm->send(ThreadCommon::QueueManager::master_event_all, e, 10);
+ for (;;) {}
+}
+
+void rotary_thread(void* pvParams)
+{
+ Rotary r(static_cast(pvParams));
+ r.taskFunction();
+}
diff --git a/source/shoh/src/threads/rotary/Rotary.h b/source/shoh/src/threads/rotary/Rotary.h
new file mode 100644
index 0000000..4c97f41
--- /dev/null
+++ b/source/shoh/src/threads/rotary/Rotary.h
@@ -0,0 +1,26 @@
+/*
+ * Rotary.h
+ *
+ * Created on: 26 Apr 2023
+ * Author: tylen
+ */
+
+#ifndef THREADS_ROTARY_ROTARY_H_
+#define THREADS_ROTARY_ROTARY_H_
+
+#include "Event.h"
+#include "ThreadCommon.h"
+
+class Rotary {
+public:
+ Rotary(ThreadCommon::QueueManager* qm);
+ virtual ~Rotary();
+ void taskFunction();
+private:
+ Event* message;
+ ThreadCommon::QueueManager* _qm;
+};
+
+void rotary_thread(void* pvParams);
+
+#endif /* THREADS_ROTARY_ROTARY_H_ */