Forked Changes to Pressure sensor

Dependents:   WiFiDipCortexSensor

Fork of MPL3115A2 by Michael Lange

Committer:
sophtware
Date:
Tue Apr 01 21:35:23 2014 +0000
Revision:
0:beb43bc3d6d4
Child:
3:7c7c1ea6fc33
Initial Checkin

Who changed what in which revision?

UserRevisionLine numberNew contents of line
sophtware 0:beb43bc3d6d4 1 /*
sophtware 0:beb43bc3d6d4 2 MPL3115A2 Barometric Pressure and Tempurature Sensor Library
sophtware 0:beb43bc3d6d4 3 By: Michael Lange
sophtware 0:beb43bc3d6d4 4 Date: March 31, 2014
sophtware 0:beb43bc3d6d4 5 License: This code is public domain.
sophtware 0:beb43bc3d6d4 6
sophtware 0:beb43bc3d6d4 7 This class encapsulates a temperature reading from the sensor.
sophtware 0:beb43bc3d6d4 8
sophtware 0:beb43bc3d6d4 9 */
sophtware 0:beb43bc3d6d4 10
sophtware 0:beb43bc3d6d4 11
sophtware 0:beb43bc3d6d4 12 #ifndef TEMPERATURE_H
sophtware 0:beb43bc3d6d4 13 #define TEMPERATURE_H
sophtware 0:beb43bc3d6d4 14
sophtware 0:beb43bc3d6d4 15 #include "mbed.h"
sophtware 0:beb43bc3d6d4 16
sophtware 0:beb43bc3d6d4 17 class Temperature
sophtware 0:beb43bc3d6d4 18 {
sophtware 0:beb43bc3d6d4 19 public:
sophtware 0:beb43bc3d6d4 20
sophtware 0:beb43bc3d6d4 21 static const int size = 2;
sophtware 0:beb43bc3d6d4 22 enum unitsType { CELSIUS, FAHRENHEIT, KELVIN };
sophtware 0:beb43bc3d6d4 23
sophtware 0:beb43bc3d6d4 24 Temperature();
sophtware 0:beb43bc3d6d4 25 Temperature(float a, unitsType units = FAHRENHEIT);
sophtware 0:beb43bc3d6d4 26 Temperature(const char* compressed);
sophtware 0:beb43bc3d6d4 27 Temperature(const char msb, const char lsb);
sophtware 0:beb43bc3d6d4 28
sophtware 0:beb43bc3d6d4 29 operator char*(void) { return _compressed; }
sophtware 0:beb43bc3d6d4 30 operator float(void) { return _temperature; }
sophtware 0:beb43bc3d6d4 31
sophtware 0:beb43bc3d6d4 32 float temperature(unitsType units = FAHRENHEIT);
sophtware 0:beb43bc3d6d4 33 void setTemperature();
sophtware 0:beb43bc3d6d4 34 void setTemperature(const char* compressed);
sophtware 0:beb43bc3d6d4 35 void setTemperature(const char msb, const char lsb);
sophtware 0:beb43bc3d6d4 36 void setTemperature(float a, unitsType units = FAHRENHEIT);
sophtware 0:beb43bc3d6d4 37
sophtware 0:beb43bc3d6d4 38 const char* print(unitsType units = FAHRENHEIT);
sophtware 0:beb43bc3d6d4 39
sophtware 0:beb43bc3d6d4 40 private:
sophtware 0:beb43bc3d6d4 41 float _temperature;
sophtware 0:beb43bc3d6d4 42 char _compressed[2];
sophtware 0:beb43bc3d6d4 43 char _printBuffer[9];
sophtware 0:beb43bc3d6d4 44 };
sophtware 0:beb43bc3d6d4 45
sophtware 0:beb43bc3d6d4 46 #endif // TEMPERATURE_H