diff --git a/BMP085.cpp b/Adafruit_BMP085.cpp similarity index 83% rename from BMP085.cpp rename to Adafruit_BMP085.cpp index 922094f..06a6082 100644 --- a/BMP085.cpp +++ b/Adafruit_BMP085.cpp @@ -1,16 +1,27 @@ -// This is a simple but accurate BMP085 sensor library that doesn't suck -// Does high res temperature, pressure and altitude calculations based on -// the datasheet documentation -// (c) adafruit - MIT license - https://github.com/adafruit/BMP085-Library +/*************************************************** + This is a library for the BMP085 Barometric Pressure & Temp Sensor -#include "BMP085.h" + Designed specifically to work with the Adafruit BMP085 Breakout + ----> https://www.adafruit.com/products/391 + + These displays use I2C to communicate, 2 pins are required to + interface + Adafruit invests time and resources providing this open source code, + please support Adafruit and open-source hardware by purchasing + products from Adafruit! + + Written by Limor Fried/Ladyada for Adafruit Industries. + BSD license, all text above must be included in any redistribution + ****************************************************/ + +#include "Adafruit_BMP085.h" #include -BMP085::BMP085() { +Adafruit_BMP085::Adafruit_BMP085() { } -void BMP085::begin(uint8_t mode) { +void Adafruit_BMP085::begin(uint8_t mode) { if (mode > BMP085_ULTRAHIGHRES) mode = BMP085_ULTRAHIGHRES; oversampling = mode; @@ -48,7 +59,7 @@ void BMP085::begin(uint8_t mode) { #endif } -uint16_t BMP085::readRawTemperature(void) { +uint16_t Adafruit_BMP085::readRawTemperature(void) { write8(BMP085_CONTROL, BMP085_READTEMPCMD); _delay_ms(5); #if BMP085_DEBUG == 1 @@ -57,7 +68,7 @@ uint16_t BMP085::readRawTemperature(void) { return read16(BMP085_TEMPDATA); } -uint32_t BMP085::readRawPressure(void) { +uint32_t Adafruit_BMP085::readRawPressure(void) { uint32_t raw; write8(BMP085_CONTROL, BMP085_READPRESSURECMD + (oversampling << 6)); @@ -82,7 +93,7 @@ uint32_t BMP085::readRawPressure(void) { } -int32_t BMP085::readPressure(void) { +int32_t Adafruit_BMP085::readPressure(void) { int32_t UT, UP, B3, B5, B6, X1, X2, X3, p; uint32_t B4, B7; @@ -168,7 +179,7 @@ int32_t BMP085::readPressure(void) { } -float BMP085::readTemperature(void) { +float Adafruit_BMP085::readTemperature(void) { int32_t UT, X1, X2, B5; // following ds convention float temp; @@ -193,7 +204,7 @@ float BMP085::readTemperature(void) { return temp; } -float BMP085::readAltitude(float sealevelPressure) { +float Adafruit_BMP085::readAltitude(float sealevelPressure) { float altitude; float pressure = readPressure(); @@ -206,7 +217,7 @@ float BMP085::readAltitude(float sealevelPressure) { /*********************************************************************/ -uint8_t BMP085::read8(uint8_t a) { +uint8_t Adafruit_BMP085::read8(uint8_t a) { uint8_t ret; Wire.beginTransmission(BMP085_I2CADDR); // start transmission to device @@ -229,7 +240,7 @@ uint8_t BMP085::read8(uint8_t a) { return ret; } -uint16_t BMP085::read16(uint8_t a) { +uint16_t Adafruit_BMP085::read16(uint8_t a) { uint16_t ret; Wire.beginTransmission(BMP085_I2CADDR); // start transmission to device @@ -256,7 +267,7 @@ uint16_t BMP085::read16(uint8_t a) { return ret; } -void BMP085::write8(uint8_t a, uint8_t d) { +void Adafruit_BMP085::write8(uint8_t a, uint8_t d) { Wire.beginTransmission(BMP085_I2CADDR); // start transmission to device #if (ARDUINO >= 100) Wire.write(a); // sends register address to read from diff --git a/BMP085.h b/Adafruit_BMP085.h similarity index 71% rename from BMP085.h rename to Adafruit_BMP085.h index aba953e..c2f6657 100644 --- a/BMP085.h +++ b/Adafruit_BMP085.h @@ -1,6 +1,18 @@ -// BMP085 Pressure/Temperature (Altimeter) sensor +/*************************************************** + This is a library for the BMP085 Barometric Pressure & Temp Sensor -// MIT license + Designed specifically to work with the Adafruit BMP085 Breakout + ----> https://www.adafruit.com/products/391 + + These displays use I2C to communicate, 2 pins are required to + interface + Adafruit invests time and resources providing this open source code, + please support Adafruit and open-source hardware by purchasing + products from Adafruit! + + Written by Limor Fried/Ladyada for Adafruit Industries. + BSD license, all text above must be included in any redistribution + ****************************************************/ #if (ARDUINO >= 100) #include "Arduino.h" @@ -36,9 +48,9 @@ #define BMP085_READPRESSURECMD 0x34 -class BMP085 { +class Adafruit_BMP085 { public: - BMP085(); + Adafruit_BMP085(); void begin(uint8_t mode = BMP085_ULTRAHIGHRES); // by default go highres float readTemperature(void); int32_t readPressure(void); diff --git a/README.txt b/README.txt index 77be005..f254d8c 100644 --- a/README.txt +++ b/README.txt @@ -1,7 +1,22 @@ -This is an Arduino library for the BMP085 barometric pressure/temperature/altitude sensors. +This is a library for the Adafruit BMP085 Barometric Pressure + Temp sensor -Pick one up at http://www.adafruit.com/products/391 +Designed specifically to work with the Adafruit BMP085 Breakout + ----> https://www.adafruit.com/products/391 -To download. click the DOWNLOADS button in the top right corner, rename the uncompressed folder BMP085. Check that the BMP085 folder contains BMP085.cpp and BMP085.h +These displays use I2C to communicate, 2 pins are required to interface +Adafruit invests time and resources providing this open source code, +please support Adafruit and open-source hardware by purchasing +products from Adafruit! -Place the BMP085 library folder your /libraries/ folder. You may need to create the libraries subfolder if its your first library. Restart the IDE. \ No newline at end of file +Check out the links above for our tutorials and wiring diagrams + +Adafruit invests time and resources providing this open source code, +please support Adafruit and open-source hardware by purchasing +products from Adafruit! + +Written by Limor Fried/Ladyada for Adafruit Industries. +BSD license, all text above must be included in any redistribution + +To download. click the DOWNLOADS button in the top right corner, rename the uncompressed folder Adafruit_BMP085. Check that the Adafruit_BMP085 folder contains Adafruit_BMP085.cpp and Adafruit_BMP085.h + +Place the Adafruit_BMP085 library folder your /libraries/ folder. You may need to create the libraries subfolder if its your first library. Restart the IDE. \ No newline at end of file diff --git a/examples/BMP085test/BMP085test.pde b/examples/BMP085test/BMP085test.pde index d7349f1..5c04c09 100644 --- a/examples/BMP085test/BMP085test.pde +++ b/examples/BMP085test/BMP085test.pde @@ -1,6 +1,21 @@ #include -#include +#include +/*************************************************** + This is an example for the BMP085 Barometric Pressure & Temp Sensor + + Designed specifically to work with the Adafruit BMP085 Breakout + ----> https://www.adafruit.com/products/391 + + These displays use I2C to communicate, 2 pins are required to + interface + Adafruit invests time and resources providing this open source code, + please support Adafruit and open-source hardware by purchasing + products from Adafruit! + + Written by Limor Fried/Ladyada for Adafruit Industries. + BSD license, all text above must be included in any redistribution + ****************************************************/ // Connect VCC of the BMP085 sensor to 3.3V (NOT 5.0V!) // Connect GND to Ground