Version 5
Dependencies: BMP280 TextLCD BME280
Diff: Sampler.hpp
- Revision:
- 3:82612f4ae4c5
- Parent:
- 2:38d31b2e0956
- Child:
- 4:740cba3f2716
diff -r 38d31b2e0956 -r 82612f4ae4c5 Sampler.hpp --- a/Sampler.hpp Sun Nov 25 17:49:47 2018 +0000 +++ b/Sampler.hpp Tue Nov 27 12:33:36 2018 +0000 @@ -2,14 +2,14 @@ #define Activate_Flag 1 // Class for Sampled Data -class message_t +class sample_message { public: float temp; float pressure; int sw1State; int sw2State; - message_t(float f1, float f2, int s1, int s2) + sample_message(float f1, float f2, int s1, int s2) { temp = f1; pressure = f2; @@ -32,12 +32,12 @@ { private: Thread t1; // Sample Thread - MemoryPool<message_t, 20> mpool; //Memory Pool has 20 data blocks - Queue<message_t, 20> queue; //Message queue + MemoryPool<sample_message, 20> mpool; //Memory Pool has 20 data blocks + Queue<sample_message, 20> queue; //Message queue public: void mailqueuePush(float tsample, float psample, int switch1State, int switch2State) { - message_t *message = mpool.alloc(); // Allocate a block from the memory pool + 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 @@ -56,6 +56,11 @@ } } + void publishSample() + { + + } + void activate() { t1.signal_set(Activate_Flag); // Signal the sampling thread to move from WAITING to READY @@ -89,7 +94,6 @@ Sampler() { //Constructor - // IDs osThreadId idMain; osThreadId idSample; idMain = osThreadGetId(); // CMSIS RTOS Call @@ -101,6 +105,6 @@ //Destructor - should the instance go out of scope, this is called ~Sampler() { - + // Code } }; \ No newline at end of file