MPL3115A2_for_weather_shield

Dependents:   SPARKFUN_WEATHER_SHIELD

Fork of MPL3115A2 by Michael Lange

Files at this revision

API Documentation at this revision

Comitter:
isaackod
Date:
Thu Oct 20 16:47:25 2016 +0000
Parent:
3:7c7c1ea6fc33
Commit message:
Some changes to work with the weather shield;

Changed in this revision

MPL3115A2.cpp Show annotated file Show diff for this revision Revisions of this file
MPL3115A2.h Show annotated file Show diff for this revision Revisions of this file
Temperature.h Show annotated file Show diff for this revision Revisions of this file
--- a/MPL3115A2.cpp	Wed Apr 02 12:59:44 2014 +0000
+++ b/MPL3115A2.cpp	Thu Oct 20 16:47:25 2016 +0000
@@ -7,14 +7,12 @@
 {
 }
 
-// By default I set the sensor to altimeter mode. I inserted a 1ms pause 
-// between each call to allow logic capture if needed. This give a small
-// gap between captures on the bus to make working with the data easier.
+//Barometer mode default
 void MPL3115A2::init()
 {
     setModeStandby();
     wait_ms(1);
-    setModeAltimeter();
+    setModeBarometer();
     wait_ms(1);
     setOversampleRate(7);
     wait_ms(1);
--- a/MPL3115A2.h	Wed Apr 02 12:59:44 2014 +0000
+++ b/MPL3115A2.h	Thu Oct 20 16:47:25 2016 +0000
@@ -43,7 +43,7 @@
 #include "Temperature.h"
 #include "Pressure.h"
 
-#define MPL3115A2_ADDRESS   0xC0    // Shifted 7-bit I2C address for sensor
+#define MPL3115A2_ADDRESS 0xC0  // I2C address for sensor
 
 #define READ_ACK 1                  // For mbed I2C Read method.
 #define READ_NAK 0 
--- a/Temperature.h	Wed Apr 02 12:59:44 2014 +0000
+++ b/Temperature.h	Thu Oct 20 16:47:25 2016 +0000
@@ -28,7 +28,7 @@
     enum unitsType { CELSIUS, FAHRENHEIT, KELVIN };
 
     Temperature();
-    Temperature(float a, unitsType units = FAHRENHEIT);
+    Temperature(float a, unitsType units = CELSIUS);
     Temperature(const char* compressed);
     Temperature(const char msb, const char lsb);
 
@@ -37,15 +37,15 @@
     //! Same as calling temperature with FAHRENHEIT as the parameter.
     operator float(void) { return _temperature; }
 
-    float temperature(unitsType units = FAHRENHEIT);
+    float temperature(unitsType units = CELSIUS);
     //! Call to decompress the sensor data after an I2C read.
     void setTemperature();
     void setTemperature(const char* compressed);
     void setTemperature(const char msb, const char lsb);
-    void setTemperature(float a, unitsType units = FAHRENHEIT);
+    void setTemperature(float a, unitsType units = CELSIUS);
 
     //! Returns the temperature as a string in the units specified, defaulting to FAHRENHEIT if none specified.
-    const char* print(unitsType units = FAHRENHEIT);
+    const char* print(unitsType units = CELSIUS);
     
 private:
     float _temperature;