Version 5

Dependencies:   BMP280 TextLCD BME280

Revision:
4:740cba3f2716
Parent:
3:82612f4ae4c5
Child:
5:f87129ac8bf3
--- a/Sampler.hpp	Tue Nov 27 12:33:36 2018 +0000
+++ b/Sampler.hpp	Tue Nov 27 12:51:34 2018 +0000
@@ -34,28 +34,8 @@
         Thread t1;                              // Sample Thread
         MemoryPool<sample_message, 20> mpool;        //Memory Pool has 20 data blocks
         Queue<sample_message, 20> queue;             //Message queue
+        EventQueue sampEQueue;                        //Initialise the EventQueue
 public: 
-    void mailqueuePush(float tsample, float psample, int switch1State, int switch2State)
-    {
-        sample_message *message = mpool.alloc();         // Allocate a block from the memory pool
-        if (message == NULL)                        // Catch the error if the pool is full
-        {                  
-            printf("Memory Full");                  // Complete the handling of this
-            return;
-        }
-        message->temp = tsample;                    // Load data into the message object
-        message->pressure = psample;
-        message->sw1State = switch1State;
-        message->sw2State = switch2State;
-        osStatus stat = queue.put(message);         // Write the pointer of the message to the queue
-        if (stat == osErrorResource)                // Catch the error if the 'put' failed
-        {
-            printf("queue->put() Error code: %4Xh\r\n", stat);
-            mpool.free(message);
-            return;       
-        }
-    }
-    
     void publishSample()
     {
         
@@ -91,7 +71,6 @@
             mailqueuePush(temp, pressure, sw1State, sw2state);  // Place onto the mailqueue
         }
     }
-        
     Sampler() 
     {   //Constructor 
         osThreadId idMain;
@@ -100,8 +79,7 @@
         idSample = t1.gettid();                 // Assign the id to the thread handle (Check this)
         t1.start(this, &Sampler::samplingThread);               // Start the sampling thread
         // NVIC_SetPriority(TIMER0_IRQn,osPriorityHigh);     // Uncomment for priority setting in the NVIC
-    } 
-    
+    }
     //Destructor - should the instance go out of scope, this is called
     ~Sampler() 
     {