fuck this
Dependencies: BMP280
Sampling.h
- Committer:
- Swaggie
- Date:
- 2018-01-03
- Revision:
- 6:8e1795a5886b
- Parent:
- 5:bea93c8e50b7
- Child:
- 7:bf9f92ff02e8
File content as of revision 6:8e1795a5886b:
#ifndef __Sampling__ #define __Sampling__ #include "mbed.h" #ifdef BME #include "BME280.h" #else #include "BMP280.h" #endif #define BUFFERSIZE 120 #ifdef BME extern BME280 sensor; #else extern BMP280 sensor; #endif //Thread Sync Tools Mutex tempReadingsLock; Mutex presReadingsLock; Mutex LDRReadingsLock; //Buffers float tempReadings[BUFFERSIZE]; float presReadings[BUFFERSIZE]; float LDRReadings[BUFFERSIZE]; unsigned short newestTempIndex; //Position in the buffer of the newest sample unsigned short oldestTempIndex; //Position in the buffer of the oldest sample Thread t1; //Sample Enviromental Sensor Thread t2; //Sample LDR Sensor Ticker sampleRate; AnalogIn LDR(A13); //LDR Pin /*These can be deleted I think extern float fLatestTemp; extern float fLatestLDR; 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? void SampleTimerISR(void); //Called by ticker. Calls the sample funcs of each device by flagging the threads void ConfigThreadsAndIR(void); //Setup Interrupts and Threads void threadSampleEnvSensor(void); //when flagged by interrupt will capture a sample then calls the addtobufferfuncs void AddTempSample(float* Temp); //Producer function void AddPresSample(float* Pres); //Producer Function void ThreadSampleLDR(void); //When flagged by interrupt will read LDR value. void AddLDRSample(float* LDR); //Poducer Function #endif