Kenji Arai / BMP180

Dependents:   LPC1114_data_logger ProjectIOT Wether_Meter LPC1114_barometer_with_data_logging

Files at this revision

API Documentation at this revision

Comitter:
kenjiArai
Date:
Sun Jun 22 06:07:52 2014 +0000
Parent:
1:23942d7b7023
Child:
3:20e0c6b19c24
Commit message:
put additional comments and small modification

Changed in this revision

BMP180.cpp Show annotated file Show diff for this revision Revisions of this file
BMP180.h Show annotated file Show diff for this revision Revisions of this file
--- a/BMP180.cpp	Fri Jun 20 21:43:29 2014 +0000
+++ b/BMP180.cpp	Sun Jun 22 06:07:52 2014 +0000
@@ -7,7 +7,7 @@
  *  http://mbed.org/users/kenjiArai/
  *      Created: August    14th, 2013   for STM32L152 
  *      Changed: May       21st, 2014   mbed LPC1114
- *      Revised: June      19th, 2014
+ *      Revised: June      22nd, 2014
  *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
  * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
@@ -27,10 +27,6 @@
 //  7bit address = 0b1110111(0x77) -> 8bit = 0b11101110(0xee) -> 0xef(Read) or 0xee(Write)
 #define BMP180ADDR  0xee        // No other choice
 
-//  Bosch barmeter ID
-#define BMP180_CHIP_ID          0x55
-#define UNKNOWN_ID              0
-
 //  register address
 #define BARO_PROM_ADDR          0xaa
 #define BARO_CHIP_ID_REG        0xd0
--- a/BMP180.h	Fri Jun 20 21:43:29 2014 +0000
+++ b/BMP180.h	Sun Jun 22 06:07:52 2014 +0000
@@ -7,7 +7,7 @@
  *  http://mbed.org/users/kenjiArai/
  *      Created: August    14th, 2013   for STM32L152 
  *      Changed: May       21st, 2014   mbed LPC1114
- *      Revised: June      15th, 2014
+ *      Revised: June      22nd, 2014
  *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
  * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
@@ -21,14 +21,73 @@
 
 #include "mbed.h"
 
+//  Bosch barmeter ID
+#define BMP180_CHIP_ID          0x55
+
+/** Interface for Bosch Pressure Sensor (I2C Interface) BMP180
+ *
+ * Measurement Air pressure (Barometer) and temperature via I2C interface.
+ *
+ *  Chip has compensation data in the sensor (inside of EEPROM).
+ *
+ *  Normalization is specified in the documentation as follows.
+ *
+ *      Bosch Sensortec BMP180 Datasheet : BST-BMP180-DS000-09 Revision: 2.5  Date: 5 April 2013
+ *
+ * @code
+ * #include "mbed.h"
+ *
+ * // I2C Communication
+ *  BMP180(PinName p_sda, PinName p_scl);   // SDA, SCL
+ * // If you connected I2C line not only this device but also other devices,
+ * //     you need to declare following method.
+ *  I2C         i2c(dp5,dp27);              // SDA, SCL
+ *  BMP180(I2C& p_i2c);
+ *
+ * int main() {
+ * float pressure, temperature;
+ *
+ *   bmp180.normalize();    // This is important function Data read from BMP180 then normalization
+ *   pressure = bmp180.read_pressure();         // just readiting data
+ *   temperature = bmp180.read_temperature();   // just readiting data
+ * }
+ * @endcode
+ */
+
 class BMP180 {
 public:
+    /** Configure data pin
+      * @param data SDA and SCL pins
+      */
     BMP180(PinName p_sda, PinName p_scl);
+    
+    /** Configure data pin (with other devices on I2C line)
+      * @param I2C previous definition
+      */
     BMP180(I2C& p_i2c);
 
+    /** Read a float type data from BMP180
+      * @param none
+      * @return temperature unit:degreeC(Celsius)
+      */
     float read_temperature();
+    
+    /** Read a float type data from BMP180
+      * @param none
+      * @return pressure unit:hPa(hectopascals)
+      */
     float read_pressure();
+    
+    /** Read a BMP180 ID number
+      * @param none
+      * @return if BMP180, it should be 0x55.
+      */
     uint8_t read_baro_id();
+
+    /** Read press and temp data from BMP180 then normalize the data.
+      * @param none
+      * @return none (The result is able to read read_temperature() or read_pressure()).
+      */
     void normalize();
 
 protected: