Update librairies
This commit is contained in:
@@ -6,6 +6,7 @@
|
|||||||
#include <Adafruit_Sensor.h>
|
#include <Adafruit_Sensor.h>
|
||||||
#include <Adafruit_BMP085_U.h>
|
#include <Adafruit_BMP085_U.h>
|
||||||
#include <toneAC.h>
|
#include <toneAC.h>
|
||||||
|
#include <SPI.h>
|
||||||
#include <Adafruit_GFX.h>
|
#include <Adafruit_GFX.h>
|
||||||
#include <Adafruit_PCD8544.h>
|
#include <Adafruit_PCD8544.h>
|
||||||
#include <RTClib.h>
|
#include <RTClib.h>
|
||||||
|
|||||||
@@ -20,7 +20,13 @@
|
|||||||
#include "WProgram.h"
|
#include "WProgram.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <Wire.h>
|
#ifdef __AVR_ATtiny85__
|
||||||
|
#include "TinyWireM.h"
|
||||||
|
#define Wire TinyWireM
|
||||||
|
#else
|
||||||
|
#include <Wire.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
|
||||||
@@ -206,6 +212,18 @@ static void readRawPressure(int32_t *pressure)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**************************************************************************/
|
||||||
|
/*!
|
||||||
|
@brief Compute B5 coefficient used in temperature & pressure calcs.
|
||||||
|
*/
|
||||||
|
/**************************************************************************/
|
||||||
|
int32_t Adafruit_BMP085_Unified::computeB5(int32_t ut) {
|
||||||
|
int32_t X1 = (ut - (int32_t)_bmp085_coeffs.ac6) * ((int32_t)_bmp085_coeffs.ac5) >> 15;
|
||||||
|
int32_t X2 = ((int32_t)_bmp085_coeffs.mc << 11) / (X1+(int32_t)_bmp085_coeffs.md);
|
||||||
|
return X1 + X2;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
CONSTRUCTOR
|
CONSTRUCTOR
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
@@ -272,9 +290,7 @@ void Adafruit_BMP085_Unified::getPressure(float *pressure)
|
|||||||
readRawPressure(&up);
|
readRawPressure(&up);
|
||||||
|
|
||||||
/* Temperature compensation */
|
/* Temperature compensation */
|
||||||
x1 = (ut - (int32_t)(_bmp085_coeffs.ac6))*((int32_t)(_bmp085_coeffs.ac5))/pow(2,15);
|
b5 = computeB5(ut);
|
||||||
x2 = ((int32_t)(_bmp085_coeffs.mc*pow(2,11)))/(x1+(int32_t)(_bmp085_coeffs.md));
|
|
||||||
b5 = x1 + x2;
|
|
||||||
|
|
||||||
/* Pressure compensation */
|
/* Pressure compensation */
|
||||||
b6 = b5 - 4000;
|
b6 = b5 - 4000;
|
||||||
@@ -327,11 +343,8 @@ void Adafruit_BMP085_Unified::getTemperature(float *temp)
|
|||||||
_bmp085_coeffs.md = 2868;
|
_bmp085_coeffs.md = 2868;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// step 1
|
B5 = computeB5(UT);
|
||||||
X1 = (UT - (int32_t)_bmp085_coeffs.ac6) * ((int32_t)_bmp085_coeffs.ac5) / pow(2,15);
|
t = (B5+8) >> 4;
|
||||||
X2 = ((int32_t)_bmp085_coeffs.mc * pow(2,11)) / (X1+(int32_t)_bmp085_coeffs.md);
|
|
||||||
B5 = X1 + X2;
|
|
||||||
t = (B5+8)/pow(2,4);
|
|
||||||
t /= 10;
|
t /= 10;
|
||||||
|
|
||||||
*temp = t;
|
*temp = t;
|
||||||
@@ -340,7 +353,7 @@ void Adafruit_BMP085_Unified::getTemperature(float *temp)
|
|||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
/*!
|
/*!
|
||||||
Calculates the altitude (in meters) from the specified atmospheric
|
Calculates the altitude (in meters) from the specified atmospheric
|
||||||
pressure (in hPa), sea-level pressure (in hPa), and temperature (in <20>C)
|
pressure (in hPa), sea-level pressure (in hPa), and temperature (in <20>C)
|
||||||
|
|
||||||
@param seaLevel Sea-level pressure in hPa
|
@param seaLevel Sea-level pressure in hPa
|
||||||
@param atmospheric Atmospheric pressure in hPa
|
@param atmospheric Atmospheric pressure in hPa
|
||||||
@@ -358,12 +371,28 @@ float Adafruit_BMP085_Unified::pressureToAltitude(float seaLevel, float atmosphe
|
|||||||
/* where: h = height (in meters) */
|
/* where: h = height (in meters) */
|
||||||
/* P0 = sea-level pressure (in hPa) */
|
/* P0 = sea-level pressure (in hPa) */
|
||||||
/* P = atmospheric pressure (in hPa) */
|
/* P = atmospheric pressure (in hPa) */
|
||||||
/* T = temperature (in <20>C) */
|
/* T = temperature (in <20>C) */
|
||||||
|
|
||||||
return (((float)pow((seaLevel/atmospheric), 0.190223F) - 1.0F)
|
return (((float)pow((seaLevel/atmospheric), 0.190223F) - 1.0F)
|
||||||
* (temp + 273.15F)) / 0.0065F;
|
* (temp + 273.15F)) / 0.0065F;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float Adafruit_BMP085_Unified::seaLevelForAltitude(float altitude, float atmospheric, float temp)
|
||||||
|
{
|
||||||
|
/* Hyposometric formula: */
|
||||||
|
/* */
|
||||||
|
/* P0=((((h*0.0065)/(temp + 273.15F))+1)^(^/0.190223F))*P */
|
||||||
|
/* */
|
||||||
|
/* where: h = height (in meters) */
|
||||||
|
/* P0 = sea-level pressure (in hPa) */
|
||||||
|
/* P = atmospheric pressure (in hPa) */
|
||||||
|
/* T = temperature (in <20>C) */
|
||||||
|
|
||||||
|
return (float)pow((((altitude*0.0065)/(temp + 273.15F))+1), (1.0/0.190223F))*atmospheric;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
/*!
|
/*!
|
||||||
@brief Provides the sensor_t data for this sensor
|
@brief Provides the sensor_t data for this sensor
|
||||||
@@ -403,5 +432,5 @@ void Adafruit_BMP085_Unified::getEvent(sensors_event_t *event)
|
|||||||
event->type = SENSOR_TYPE_PRESSURE;
|
event->type = SENSOR_TYPE_PRESSURE;
|
||||||
event->timestamp = 0;
|
event->timestamp = 0;
|
||||||
getPressure(&pressure_kPa);
|
getPressure(&pressure_kPa);
|
||||||
event->pressure = pressure_kPa / 100.0F; /* kPa to hPa */
|
event->pressure = pressure_kPa / 100.0F;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,13 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <Adafruit_Sensor.h>
|
#include <Adafruit_Sensor.h>
|
||||||
#include <Wire.h>
|
|
||||||
|
#ifdef __AVR_ATtiny85__
|
||||||
|
#include "TinyWireM.h"
|
||||||
|
#define Wire TinyWireM
|
||||||
|
#else
|
||||||
|
#include <Wire.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
/*=========================================================================
|
/*=========================================================================
|
||||||
I2C ADDRESS/BITS
|
I2C ADDRESS/BITS
|
||||||
@@ -99,11 +105,13 @@ class Adafruit_BMP085_Unified : public Adafruit_Sensor
|
|||||||
void getTemperature(float *temp);
|
void getTemperature(float *temp);
|
||||||
void getPressure(float *pressure);
|
void getPressure(float *pressure);
|
||||||
float pressureToAltitude(float seaLevel, float atmospheric, float temp);
|
float pressureToAltitude(float seaLevel, float atmospheric, float temp);
|
||||||
|
float seaLevelForAltitude(float altitude, float atmospheric, float temp);
|
||||||
void getEvent(sensors_event_t*);
|
void getEvent(sensors_event_t*);
|
||||||
void getSensor(sensor_t*);
|
void getSensor(sensor_t*);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int32_t _sensorID;
|
int32_t computeB5(int32_t ut);
|
||||||
|
int32_t _sensorID;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
#Adafruit Unified BMP085 Driver (Barometric Pressure Sensor) #
|
#Adafruit Unified BMP085/BMP180 Driver (Barometric Pressure Sensor) #
|
||||||
|
|
||||||
This driver is for the Adafruit BMP085 Breakout (http://www.adafruit.com/products/391), and is based on Adafruit's Unified Sensor Library (Adafruit_Sensor).
|
This driver is for the Adafruit BMP085 Breakout (http://www.adafruit.com/products/391) or BMP180 breakout (http://www.adafruit.com/products/1603), and is based on Adafruit's Unified Sensor Library (Adafruit_Sensor).
|
||||||
|
|
||||||
## About the BMP085 ##
|
## About the BMP085 / BMP180 ##
|
||||||
|
|
||||||
This precision sensor from Bosch is the best low-cost sensing solution for measuring barometric pressure and temperature. Because pressure changes with altitude you can also use it as an altimeter!
|
This precision sensor from Bosch is the best low-cost sensing solution for measuring barometric pressure and temperature. Because pressure changes with altitude you can also use it as an altimeter!
|
||||||
|
|
||||||
|
|||||||
@@ -304,7 +304,8 @@ void Adafruit_GFX::fillTriangle ( int16_t x0, int16_t y0,
|
|||||||
dx02 = x2 - x0,
|
dx02 = x2 - x0,
|
||||||
dy02 = y2 - y0,
|
dy02 = y2 - y0,
|
||||||
dx12 = x2 - x1,
|
dx12 = x2 - x1,
|
||||||
dy12 = y2 - y1,
|
dy12 = y2 - y1;
|
||||||
|
int32_t
|
||||||
sa = 0,
|
sa = 0,
|
||||||
sb = 0;
|
sb = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
* http://www.pjrc.com/teensy/td_libs_Encoder.html
|
* http://www.pjrc.com/teensy/td_libs_Encoder.html
|
||||||
* Copyright (c) 2011,2013 PJRC.COM, LLC - Paul Stoffregen <paul@pjrc.com>
|
* Copyright (c) 2011,2013 PJRC.COM, LLC - Paul Stoffregen <paul@pjrc.com>
|
||||||
*
|
*
|
||||||
|
* Version 1.2 - fix -2 bug in C-only code
|
||||||
* Version 1.1 - expand to support boards with up to 60 interrupts
|
* Version 1.1 - expand to support boards with up to 60 interrupts
|
||||||
* Version 1.0 - initial release
|
* Version 1.0 - initial release
|
||||||
*
|
*
|
||||||
@@ -284,7 +285,7 @@ private:
|
|||||||
arg->position += 2;
|
arg->position += 2;
|
||||||
return;
|
return;
|
||||||
case 6: case 9:
|
case 6: case 9:
|
||||||
arg->position += 2;
|
arg->position -= 2;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#ifndef direct_pin_read_h_
|
#ifndef direct_pin_read_h_
|
||||||
#define direct_pin_read_h_
|
#define direct_pin_read_h_
|
||||||
|
|
||||||
#if defined(__AVR__) || defined(__MK20DX128__)
|
#if defined(__AVR__) || defined(__MK20DX128__) || defined(__MK20DX256__)
|
||||||
|
|
||||||
#define IO_REG_TYPE uint8_t
|
#define IO_REG_TYPE uint8_t
|
||||||
#define PIN_TO_BASEREG(pin) (portInputRegister(digitalPinToPort(pin)))
|
#define PIN_TO_BASEREG(pin) (portInputRegister(digitalPinToPort(pin)))
|
||||||
|
|||||||
Reference in New Issue
Block a user