rename
This commit is contained in:
parent
04a39d95d4
commit
2796db89f5
4 changed files with 77 additions and 24 deletions
|
|
@ -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 <util/delay.h>
|
||||
|
||||
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
|
||||
|
|
@ -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);
|
||||
23
README.txt
23
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 <arduinosketchfolder>/libraries/ folder. You may need to create the libraries subfolder if its your first library. Restart the IDE.
|
||||
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 <arduinosketchfolder>/libraries/ folder. You may need to create the libraries subfolder if its your first library. Restart the IDE.
|
||||
|
|
@ -1,6 +1,21 @@
|
|||
#include <Wire.h>
|
||||
#include <BMP085.h>
|
||||
#include <Adafruit_BMP085.h>
|
||||
|
||||
/***************************************************
|
||||
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
|
||||
|
|
|
|||
Loading…
Reference in a new issue