Custom Channel Plan version of MTDOT Box firmware

Dependencies:   DOGS102 GpsParser ISL29011 MMA845x MPL3115A2 MTS-Serial NCP5623B libmDot-Custom mDot_Channel_Plans

Fork of MTDOT-BOX-EVB-Factory-Firmware by MultiTech

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers SensorHandler.h Source File

SensorHandler.h

Go to the documentation of this file.
00001 /* Copyright (c) <2016> <MultiTech Systems>, MIT License
00002  *
00003  * Permission is hereby granted, free of charge, to any person obtaining a copy of this software 
00004  * and associated documentation files (the "Software"), to deal in the Software without restriction, 
00005  * including without limitation the rights to use, copy, modify, merge, publish, distribute, 
00006  * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is 
00007  * furnished to do so, subject to the following conditions:
00008  *
00009  * The above copyright notice and this permission notice shall be included in all copies or 
00010  * substantial portions of the Software.
00011  *
00012  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING 
00013  * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 
00014  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 
00015  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 
00016  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00017  */
00018 
00019 /**
00020  * @file    SensorHandler.h
00021  * @brief   Reads on board sensors... acceleration, pressure, light and temperture.
00022  * @author  Leon Lindenfelser
00023  * @version 1.0
00024  *
00025  */
00026 
00027 #ifndef SENSORHANDLER_H
00028 #define SENSORHANDLER_H
00029 
00030 #include "mbed.h"
00031 #include "MMA845x.h"
00032 #include "MPL3115A2.h"
00033 #include "ISL29011.h"
00034 #include "DOGS102.h"
00035 #include "rtos.h"
00036 #include <string>
00037 #include <vector>
00038 #define START_THREAD 1
00039 
00040 class SensorHandler
00041 {
00042 public:
00043     enum Scale{CELSIUS, FAHRENHEIT};
00044     SensorHandler(void);
00045     ~SensorHandler(void);
00046     MMA845x_DATA getAcceleration(void);
00047     float getLight(void);
00048     uint16_t getLightRaw(void);
00049     float getPressure(void);
00050     uint32_t getPressureRaw(void);
00051     float getTemp(Scale);
00052     float getAltitude(void);
00053     MPL3115A2_DATA getBarometer(void);
00054         
00055 private:
00056     Thread _getSensorThread;
00057     static void startSensorThread (void const *p);  
00058     void readSensors(void);
00059     void initSensors(void); 
00060     I2C _mDoti2c;
00061     MMA845x _accelerometer;
00062     MPL3115A2 _barometricSensor;
00063     ISL29011 _lightSensor;
00064     MMA845x_DATA _accelerometerData;
00065     MPL3115A2_DATA _barometerData;
00066     uint16_t _light;
00067     uint32_t _pressure;
00068     Mutex _mutex;   
00069 };
00070     
00071 #endif //SENSORHANDLER_H