Version 5

Dependencies:   BMP280 TextLCD BME280

Revision:
6:b7f6e0c0f646
Parent:
5:f87129ac8bf3
Child:
7:8664a45f5ce1
--- a/main.cpp	Thu Nov 29 16:08:28 2018 +0000
+++ b/main.cpp	Thu Nov 29 18:41:57 2018 +0000
@@ -1,21 +1,72 @@
 #include "mbed.h"
 #include "sample_hardware.hpp"
 #include "Sampler.hpp"
-#include "LCD.hpp"
-#include "message.hpp"
+#include "SerialComms.hpp"
+
+void LCD_Thread(void);
+void SAMP_Thread(void);
+void SERIAL_Thread(void);
+
+Thread tLCD, tSAMP, tSERIAL, tSD;
 
-sample_message message;
+// Define member object
+Sampler m_osample;
+Serialcomms m_oserial;
 
-Thread tLCD;
-Thread tSAMP;
+int main()
+{  
+    tLCD.start(LCD_Thread);
+    tSAMP.start(SAMP_Thread);
+    tSERIAL.start(SERIAL_Thread);
+    Thread::wait(osWaitForever);
+}
 
 
+void LCD_Thread()
+{   
+    while(1)
+    {
+        m_oDisplay.LCD_Queue.call_every(1000, &m_oDisplay, &LCD_Data::display_LCD); //displays the current sensor information onto the LCD screen every x miliseconds
+        m_oDisplay.LCD_Queue.dispatch();  //dispatches the above tasks to the queue, then blocks main forever unless ' break_dispatch () ' is used 
+        while(true) 
+        {
+            redLED = 1;
+            wait(0.5);
+            redLED = 0;
+            wait(0.1);    
+        }
+    }
+}
 
-int main()
+void SAMP_Thread()
+ {
+     while(1)
+     {
+        m_osample.SAMP_Queue.call_every(1000, &m_osample, &Sampler::publishSample);     // Publish sample 
+        m_osample.SAMP_Queue.dispatch();
+        while(true) 
+        {   // Flash if the event queue is exited.
+            yellowLED = 1;
+            wait(0.5);
+            yellowLED = 0;
+            wait(0.1);    
+        }
+     }
+}
+
+void SERIAL_Thread()
 {
-    
-    tLCD.start(LCD_Thread);
-    tSAMP.start(SAMP_Thread);
-    Thread::wait(osWaitForever);
+      while(1)
+     {
+        m_oserial.SERIAL_Queue.call_every(1000, &m_oserial, &Serialcomms::updateTerminal);     // Publish sample 
+        m_oserial.SERIAL_Queue.dispatch();
+        while(true) 
+        {   // Flash if the event queue is exited.
+            yellowLED = 1;
+            wait(0.5);
+            yellowLED = 0;
+            wait(0.1);    
+        }
+     }   
 }
-    
\ No newline at end of file
+