mbed MPL115A1 (Barometric Pressure Sensor) Library
Dependents: MPL115A1_HelloWorld
Revision 1:b2adf1b62898, committed 2012-04-17
- Comitter:
- mk
- Date:
- Tue Apr 17 15:35:24 2012 +0000
- Parent:
- 0:f8ee2a5e377a
- Commit message:
Changed in this revision
MPL115A1.cpp | Show annotated file Show diff for this revision Revisions of this file |
MPL115A1.h | Show annotated file Show diff for this revision Revisions of this file |
diff -r f8ee2a5e377a -r b2adf1b62898 MPL115A1.cpp --- a/MPL115A1.cpp Tue Apr 17 07:44:48 2012 +0000 +++ b/MPL115A1.cpp Tue Apr 17 15:35:24 2012 +0000 @@ -217,5 +217,5 @@ // Tadc is 472 counts at 25degC, -5.35 counts/degC // return ((float)uiTadc - 472.0)/(-5.35) + 25 - return (605.75-uiTadc)/5.35; + return (605.75-uiTadc)*0.186916; } \ No newline at end of file
diff -r f8ee2a5e377a -r b2adf1b62898 MPL115A1.h --- a/MPL115A1.h Tue Apr 17 07:44:48 2012 +0000 +++ b/MPL115A1.h Tue Apr 17 15:35:24 2012 +0000 @@ -55,8 +55,15 @@ //DigitalOut sdn; // shutdown pin, high=on, low=off public: + /** Create a barometer object connected to the SPI bus and specified chip select pin + * + * @param spi SPI master object + * @param ncs chip select pin + */ MPL115A1(SPI& spi, PinName ncs); + /** start measurement, read registers, calculate and return pressure */ float readPressure(); + /** start measurement, read registers, calculate and return temperature */ float readTemperature(); private: