BMP180

Fork of BMP180 by Kevin Gillepsie

Files at this revision

API Documentation at this revision

Comitter:
brdarji
Date:
Tue Jul 05 07:09:02 2016 +0000
Parent:
0:b2219e6e444b
Commit message:
BMP180 ;

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
diff -r b2219e6e444b -r 817fb4e66714 BMP180.cpp
--- a/BMP180.cpp	Fri Apr 17 09:31:09 2015 -0500
+++ b/BMP180.cpp	Tue Jul 05 07:09:02 2016 +0000
@@ -1,53 +1,5 @@
-/*******************************************************************************
- * Copyright (C) 2015 Maxim Integrated Products, Inc., All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * 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 AND NONINFRINGEMENT.
- * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES
- * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- * Except as contained in this notice, the name of Maxim Integrated
- * Products, Inc. shall not be used except as stated in the Maxim Integrated
- * Products, Inc. Branding Policy.
- *
- * The mere transfer of this software does not imply any licenses
- * of trade secrets, proprietary technology, copyrights, patents,
- * trademarks, maskwork rights, or any other form of intellectual
- * property whatsoever. Maxim Integrated Products, Inc. retains all
- * ownership rights.
- *******************************************************************************
- */
-
 #include "BMP180.h"
 
-/***** Definitions *****/
-#define I2C_ADDR            (0xEE) // 1110111x
-
-#define REG_ADDR_RESET      (0xE0)
-#define REG_ADDR_ID         (0xD0)
-#define REG_ADDR_CTRL       (0xF4)
-#define REG_ADDR_DATA       (0xF6)
-#define REG_ADDR_AC1        (0xAA)
-
-#define CTRL_REG_TEMP       (0x2E)
-#define CTRL_REG_PRESS_0    (0x34)
-#define CTRL_REG_PRESS_1    (0x74)
-#define CTRL_REG_PRESS_2    (0xB4)
-#define CTRL_REG_PRESS_3    (0xF4)
-
 //******************************************************************************
 BMP180::BMP180(PinName sda, PinName scl)
 {
@@ -80,6 +32,7 @@
     int i;
 
     if (checkId() != 0) {
+      
         return -1;
     }
 
diff -r b2219e6e444b -r 817fb4e66714 BMP180.h
--- a/BMP180.h	Fri Apr 17 09:31:09 2015 -0500
+++ b/BMP180.h	Tue Jul 05 07:09:02 2016 +0000
@@ -1,87 +1,21 @@
-/*******************************************************************************
- * Copyright (C) 2015 Maxim Integrated Products, Inc., All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * 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 AND NONINFRINGEMENT.
- * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES
- * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- * Except as contained in this notice, the name of Maxim Integrated
- * Products, Inc. shall not be used except as stated in the Maxim Integrated
- * Products, Inc. Branding Policy.
- *
- * The mere transfer of this software does not imply any licenses
- * of trade secrets, proprietary technology, copyrights, patents,
- * trademarks, maskwork rights, or any other form of intellectual
- * property whatsoever. Maxim Integrated Products, Inc. retains all
- * ownership rights.
- *******************************************************************************
- */
-
-#ifndef _BMP180_H_
-#define _BMP180_H_
-
 #include "mbed.h"
 
-/**
- * Bosch BMP180 Digital Pressure Sensor
- *
- * @code
- * #include <stdio.h>
- * #include "mbed.h"
- * #include "BMP180.h"
- *
- * I2C i2c(I2C_SDA, I2C_SCL);
- * BMP180 bmp180(&i2c);
- *
- * int main(void) {
- *
- *     while(1) {
- *         if (bmp180.init() != 0) {
- *             printf("Error communicating with BMP180\n");
- *         } else {
- *             printf("Initialized BMP180\n");
- *             break;
- *         }
- *         wait(1);
- *     }
- *
- *     while(1) {
- *         bmp180.startTemperature();
- *         wait_ms(5);     // Wait for conversion to complete
- *         float temp;
- *         if(bmp180.getTemperature(&temp) != 0) {
- *             printf("Error getting temperature\n");
- *             continue;
- *         }
- *
- *         bmp180.startPressure(BMP180::ULTRA_LOW_POWER);
- *         wait_ms(10);    // Wait for conversion to complete
- *         int pressure;
- *         if(bmp180.getPressure(&pressure) != 0) {
- *             printf("Error getting pressure\n");
- *             continue;
- *         }
- *
- *         printf("Pressure = %d Pa Temperature = %f C\n", pressure, temp);
- *         wait(1);
- *     }
- * }
- * @endcode
- */
+/***** Definitions *****/
+#define I2C_ADDR            (0xEE) // 1110111x
+
+#define REG_ADDR_RESET      (0xE0)
+#define REG_ADDR_ID         (0xD0)
+#define REG_ADDR_CTRL       (0xF4)
+#define REG_ADDR_DATA       (0xF6)
+#define REG_ADDR_AC1        (0xAA)
+
+#define CTRL_REG_TEMP       (0x2E)
+#define CTRL_REG_PRESS_0    (0x34)
+#define CTRL_REG_PRESS_1    (0x74)
+#define CTRL_REG_PRESS_2    (0xB4)
+#define CTRL_REG_PRESS_3    (0xF4)
+
+
 class BMP180
 {
 
@@ -225,6 +159,4 @@
     BMP180::calibration_t calib;
     int32_t b5;
     BMP180::oversampling_t oss_;
-};
-
-#endif /* _BMP180_H_ */
+};
\ No newline at end of file