fuck this

Dependencies:   BMP280

Revision:
6:8e1795a5886b
Parent:
5:bea93c8e50b7
Child:
7:bf9f92ff02e8
--- a/Sampling.cpp	Tue Jan 02 13:29:00 2018 +0000
+++ b/Sampling.cpp	Wed Jan 03 16:37:33 2018 +0000
@@ -1,13 +1,42 @@
 #include "Sampling.h"
 #include "mbed.h"
 
+//Thread Sync Tools
+Mutex tempReadingsLock;
+Mutex presReadingsLock;
+Mutex LDRReadingsLock;
+
+//Buffers
+float tempReadings[BUFFERSIZE];
+float presReadings[BUFFERSIZE];
+float LDRReadings[BUFFERSIZE];
+
+unsigned short newestTempIndex = BUFFERSIZE-1;
+unsigned short oldestTempIndex = BUFFERSIZE-1;
+
+bool NewEnvSample = false;  //Is there new data from the envirom sensor to output?
+bool NewLDRSample = false;  //Is there new data from the LDR to output?
+
 void SampleTimerISR(void)
 {
     //Flag Threads
 }
     
-
 void ConfigThreadsAndIR(void)
 {
-   
-}
\ No newline at end of file
+   sampleRate.attach(SampleTimerISR, 15); //15 second interval
+}
+
+void AddPresSample(float* Pres)
+{
+   tempReadingsLock.lock(); //Take the key
+   tempReadings[newestTempIndex+1] = Pres; //Add the sample after the most recet
+   tempReadingsLock.unlock(); // Release the key
+}
+
+void threadSampleEnvSensor(void)
+{
+    //Get readings
+    //float temp =
+    //float pres = 
+    AddPresSample(pres);
\ No newline at end of file