test
Fork of MPL3115A2 by
Temperature.h
- Committer:
- sophtware
- Date:
- 2014-04-01
- Revision:
- 0:beb43bc3d6d4
- Child:
- 3:7c7c1ea6fc33
File content as of revision 0:beb43bc3d6d4:
/* MPL3115A2 Barometric Pressure and Tempurature Sensor Library By: Michael Lange Date: March 31, 2014 License: This code is public domain. This class encapsulates a temperature reading from the sensor. */ #ifndef TEMPERATURE_H #define TEMPERATURE_H #include "mbed.h" class Temperature { public: static const int size = 2; enum unitsType { CELSIUS, FAHRENHEIT, KELVIN }; Temperature(); Temperature(float a, unitsType units = FAHRENHEIT); Temperature(const char* compressed); Temperature(const char msb, const char lsb); operator char*(void) { return _compressed; } operator float(void) { return _temperature; } float temperature(unitsType units = FAHRENHEIT); void setTemperature(); void setTemperature(const char* compressed); void setTemperature(const char msb, const char lsb); void setTemperature(float a, unitsType units = FAHRENHEIT); const char* print(unitsType units = FAHRENHEIT); private: float _temperature; char _compressed[2]; char _printBuffer[9]; }; #endif // TEMPERATURE_H