MPL3115A2_for_weather_shield
Dependents: SPARKFUN_WEATHER_SHIELD
Fork of MPL3115A2 by
Diff: MPL3115A2.h
- Revision:
- 3:7c7c1ea6fc33
- Parent:
- 2:2ebc9c0d4a54
- Child:
- 4:9ba8fde79093
--- a/MPL3115A2.h Wed Apr 02 12:22:45 2014 +0000 +++ b/MPL3115A2.h Wed Apr 02 12:59:44 2014 +0000 @@ -105,19 +105,32 @@ { public: //! Constructs an MPL3115A2 object and associates an I2C and optional Serial debug object. + //! @param *i2c The I2C object to use for the sensor. + //! @param *pc An optional serial debug connection object. MPL3115A2(I2C *i2c, Serial *pc = NULL); - //! Call from main to initialize the sensor, defaulting to Altitude mode. + //! Initializes the sensor, defaulting to Altitude mode. This should be called before using + //! the sensor for the first time. void init(); - //! Returns the fixed device ID number (usually equal to 0xC4). + //! Queries the value from the WHO_AM_I register (usually equal to 0xC4). + //! @return The fixed device ID from the sensor. char whoAmI() { return i2cRead(WHO_AM_I); } - //! Returns the passed in altitude object with altitude data. + //! Reads Altitude data from the sensor and returns it in the Altitude object passed in. If + //! no data could be read, the Altitude object is left as is. + //! @param a A pointer to an Altitude object that will receive the sensor data. + //! @returns The Altitude pointer that was passed in. Altitude* readAltitude(Altitude* a); - //! Returns the passed in pressure object with barometric pressure data. + //! Reads Pressure data from the sensor and returns it in the Pressure object passed in. If + //! no data could be read, the Pressure object is left as is. + //! @param a A pointer to a Pressure object that will receive the sensor data. + //! @returns The Pressure pointer that was passed in. Pressure* readPressure(Pressure* p); - //! Returns the passed in temperature object with temperature data. + //! Reads Temperature data from the sensor and returns it in the Temperature object passed in. If + //! no data could be read, the Temperature object is left as is. + //! @param a A pointer to an Temperature object that will receive the sensor data. + //! @returns The Temperature pointer that was passed in. Temperature* readTemperature(Temperature* t); // Use these methods to set the sensor's offsets to increase its accuracy. You can generally @@ -126,6 +139,7 @@ // pressure from the web for your area is generally not close enough to help with calibration. // You may need to play with the setting to achieve good accuracy. I found the offset steps // were not 100% accurate to the datasheet and had to adjust accordingly. + //! Returns the altitude offset stored in the sensor. char offsetAltitude() { return i2cRead(OFF_H); } //! Sets the altitude offset stored in the sensor. The allowed offset range is from -128 to 127 meters.