fuck this

Dependencies:   BMP280

Revision:
7:bf9f92ff02e8
Parent:
6:8e1795a5886b
Child:
8:dbb57b4d5ba4
--- a/Sampling.h	Wed Jan 03 16:37:33 2018 +0000
+++ b/Sampling.h	Thu Jan 04 17:34:57 2018 +0000
@@ -17,26 +17,34 @@
 extern BMP280 sensor;
 #endif
 
+AnalogIn LDRSensor; //Input pin for LDR
+
 //Thread Sync Tools
 Mutex tempReadingsLock;
 Mutex presReadingsLock;
 Mutex LDRReadingsLock;
+Mutex timeReadingsLock;
 
 //Buffers
 float tempReadings[BUFFERSIZE];
 float presReadings[BUFFERSIZE];
 float LDRReadings[BUFFERSIZE];
+float timeReadings[BUFFERSIZE];
 
-unsigned short newestTempIndex;
+unsigned short newestIndex;
 //Position in the buffer of the newest sample
-unsigned short oldestTempIndex;
+unsigned short oldestIndex;
 //Position in the buffer of the oldest sample
 
+bool firstSample;
+//Used to indicate this is the first sample to be taken. used in IncrementIndex func
+
 Thread t1; //Sample Enviromental Sensor
 Thread t2; //Sample LDR Sensor
 
 Ticker sampleRate;
 AnalogIn LDR(A13);  //LDR Pin
+DigitalOut SamplingLED(LED1); //Onboard LED showing when a sample happens
 
 /*These can be deleted I think
 extern float fLatestTemp;
@@ -44,8 +52,8 @@
 extern float fLatestPres;
 */
 
-extern bool NewEnvSample;  //Is there new data from the envirom sensor to output?
-extern bool NewLDRSample;  //Is there new data from the LDR to output?
+bool NewEnvSample;  //Is there new data from the envirom sensor to output?
+bool NewLDRSample;  //Is there new data from the LDR to output?
 
 void SampleTimerISR(void);
 //Called by ticker. Calls the sample funcs of each device by flagging the threads
@@ -53,19 +61,26 @@
 void ConfigThreadsAndIR(void);
 //Setup Interrupts and Threads
 
-void threadSampleEnvSensor(void);
+void ThreadSampleEnvSensor(void);
 //when flagged by interrupt will capture a sample then calls the addtobufferfuncs
 
-void AddTempSample(float* Temp);
+void AddTempSample(float temp);
 //Producer function
 
-void AddPresSample(float* Pres);
+void AddPresSample(float pres);
 //Producer Function
 
 void ThreadSampleLDR(void);
-//When flagged by interrupt will read LDR value.
+//When flagged by interrupt will read time and LDR value.
 
-void AddLDRSample(float* LDR);
+void AddLDRSample(float LDR);
 //Poducer Function
 
+void AddTimeSample(/*Whatever time*/);
+//Producer Function
+
+void IncrementIndex(void);
+//Called after samples are added. Increments the index and moves the oldest
+//along if necessary
+
 #endif
\ No newline at end of file