commit 9b13d274c31ddede7c06db7c2625cbd7a544290d Author: Martin Donnelly Date: Sat Nov 3 20:21:33 2018 +0000 Initial commit diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..5406b1c Binary files /dev/null and b/.DS_Store differ diff --git a/BMP085test/Adafruit_BMP085.cpp b/BMP085test/Adafruit_BMP085.cpp new file mode 100644 index 0000000..14e7e96 --- /dev/null +++ b/BMP085test/Adafruit_BMP085.cpp @@ -0,0 +1,297 @@ +/*************************************************** + This is a library for the Adafruit BMP085/BMP180 Barometric Pressure + Temp sensor + + Designed specifically to work with the Adafruit BMP085 or BMP180 Breakout + ----> http://www.adafruit.com/products/391 + ----> http://www.adafruit.com/products/1603 + + 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" + +Adafruit_BMP085::Adafruit_BMP085() { +} + + +boolean Adafruit_BMP085::begin(uint8_t mode) { + if (mode > BMP085_ULTRAHIGHRES) + mode = BMP085_ULTRAHIGHRES; + oversampling = mode; + + Wire.begin(); + + if (read8(0xD0) != 0x55) return false; + + /* read calibration data */ + ac1 = read16(BMP085_CAL_AC1); + ac2 = read16(BMP085_CAL_AC2); + ac3 = read16(BMP085_CAL_AC3); + ac4 = read16(BMP085_CAL_AC4); + ac5 = read16(BMP085_CAL_AC5); + ac6 = read16(BMP085_CAL_AC6); + + b1 = read16(BMP085_CAL_B1); + b2 = read16(BMP085_CAL_B2); + + mb = read16(BMP085_CAL_MB); + mc = read16(BMP085_CAL_MC); + md = read16(BMP085_CAL_MD); +#if (BMP085_DEBUG == 1) + Serial.print("ac1 = "); Serial.println(ac1, DEC); + Serial.print("ac2 = "); Serial.println(ac2, DEC); + Serial.print("ac3 = "); Serial.println(ac3, DEC); + Serial.print("ac4 = "); Serial.println(ac4, DEC); + Serial.print("ac5 = "); Serial.println(ac5, DEC); + Serial.print("ac6 = "); Serial.println(ac6, DEC); + + Serial.print("b1 = "); Serial.println(b1, DEC); + Serial.print("b2 = "); Serial.println(b2, DEC); + + Serial.print("mb = "); Serial.println(mb, DEC); + Serial.print("mc = "); Serial.println(mc, DEC); + Serial.print("md = "); Serial.println(md, DEC); +#endif + + return true; +} + +int32_t Adafruit_BMP085::computeB5(int32_t UT) { + int32_t X1 = (UT - (int32_t)ac6) * ((int32_t)ac5) >> 15; + int32_t X2 = ((int32_t)mc << 11) / (X1+(int32_t)md); + return X1 + X2; +} + +uint16_t Adafruit_BMP085::readRawTemperature(void) { + write8(BMP085_CONTROL, BMP085_READTEMPCMD); + delay(5); +#if BMP085_DEBUG == 1 + Serial.print("Raw temp: "); Serial.println(read16(BMP085_TEMPDATA)); +#endif + return read16(BMP085_TEMPDATA); +} + +uint32_t Adafruit_BMP085::readRawPressure(void) { + uint32_t raw; + + write8(BMP085_CONTROL, BMP085_READPRESSURECMD + (oversampling << 6)); + + if (oversampling == BMP085_ULTRALOWPOWER) + delay(5); + else if (oversampling == BMP085_STANDARD) + delay(8); + else if (oversampling == BMP085_HIGHRES) + delay(14); + else + delay(26); + + raw = read16(BMP085_PRESSUREDATA); + + raw <<= 8; + raw |= read8(BMP085_PRESSUREDATA+2); + raw >>= (8 - oversampling); + + /* this pull broke stuff, look at it later? + if (oversampling==0) { + raw <<= 8; + raw |= read8(BMP085_PRESSUREDATA+2); + raw >>= (8 - oversampling); + } + */ + +#if BMP085_DEBUG == 1 + Serial.print("Raw pressure: "); Serial.println(raw); +#endif + return raw; +} + + +int32_t Adafruit_BMP085::readPressure(void) { + int32_t UT, UP, B3, B5, B6, X1, X2, X3, p; + uint32_t B4, B7; + + UT = readRawTemperature(); + UP = readRawPressure(); + +#if BMP085_DEBUG == 1 + // use datasheet numbers! + UT = 27898; + UP = 23843; + ac6 = 23153; + ac5 = 32757; + mc = -8711; + md = 2868; + b1 = 6190; + b2 = 4; + ac3 = -14383; + ac2 = -72; + ac1 = 408; + ac4 = 32741; + oversampling = 0; +#endif + + B5 = computeB5(UT); + +#if BMP085_DEBUG == 1 + Serial.print("X1 = "); Serial.println(X1); + Serial.print("X2 = "); Serial.println(X2); + Serial.print("B5 = "); Serial.println(B5); +#endif + + // do pressure calcs + B6 = B5 - 4000; + X1 = ((int32_t)b2 * ( (B6 * B6)>>12 )) >> 11; + X2 = ((int32_t)ac2 * B6) >> 11; + X3 = X1 + X2; + B3 = ((((int32_t)ac1*4 + X3) << oversampling) + 2) / 4; + +#if BMP085_DEBUG == 1 + Serial.print("B6 = "); Serial.println(B6); + Serial.print("X1 = "); Serial.println(X1); + Serial.print("X2 = "); Serial.println(X2); + Serial.print("B3 = "); Serial.println(B3); +#endif + + X1 = ((int32_t)ac3 * B6) >> 13; + X2 = ((int32_t)b1 * ((B6 * B6) >> 12)) >> 16; + X3 = ((X1 + X2) + 2) >> 2; + B4 = ((uint32_t)ac4 * (uint32_t)(X3 + 32768)) >> 15; + B7 = ((uint32_t)UP - B3) * (uint32_t)( 50000UL >> oversampling ); + +#if BMP085_DEBUG == 1 + Serial.print("X1 = "); Serial.println(X1); + Serial.print("X2 = "); Serial.println(X2); + Serial.print("B4 = "); Serial.println(B4); + Serial.print("B7 = "); Serial.println(B7); +#endif + + if (B7 < 0x80000000) { + p = (B7 * 2) / B4; + } else { + p = (B7 / B4) * 2; + } + X1 = (p >> 8) * (p >> 8); + X1 = (X1 * 3038) >> 16; + X2 = (-7357 * p) >> 16; + +#if BMP085_DEBUG == 1 + Serial.print("p = "); Serial.println(p); + Serial.print("X1 = "); Serial.println(X1); + Serial.print("X2 = "); Serial.println(X2); +#endif + + p = p + ((X1 + X2 + (int32_t)3791)>>4); +#if BMP085_DEBUG == 1 + Serial.print("p = "); Serial.println(p); +#endif + return p; +} + +int32_t Adafruit_BMP085::readSealevelPressure(float altitude_meters) { + float pressure = readPressure(); + return (int32_t)(pressure / pow(1.0-altitude_meters/44330, 5.255)); +} + +float Adafruit_BMP085::readTemperature(void) { + int32_t UT, B5; // following ds convention + float temp; + + UT = readRawTemperature(); + +#if BMP085_DEBUG == 1 + // use datasheet numbers! + UT = 27898; + ac6 = 23153; + ac5 = 32757; + mc = -8711; + md = 2868; +#endif + + B5 = computeB5(UT); + temp = (B5+8) >> 4; + temp /= 10; + + return temp; +} + +float Adafruit_BMP085::readAltitude(float sealevelPressure) { + float altitude; + + float pressure = readPressure(); + + altitude = 44330 * (1.0 - pow(pressure /sealevelPressure,0.1903)); + + return altitude; +} + + +/*********************************************************************/ + +uint8_t Adafruit_BMP085::read8(uint8_t a) { + uint8_t ret; + + Wire.beginTransmission(BMP085_I2CADDR); // start transmission to device +#if (ARDUINO >= 100) + Wire.write(a); // sends register address to read from +#else + Wire.send(a); // sends register address to read from +#endif + Wire.endTransmission(); // end transmission + + Wire.beginTransmission(BMP085_I2CADDR); // start transmission to device + Wire.requestFrom(BMP085_I2CADDR, 1);// send data n-bytes read +#if (ARDUINO >= 100) + ret = Wire.read(); // receive DATA +#else + ret = Wire.receive(); // receive DATA +#endif + Wire.endTransmission(); // end transmission + + return ret; +} + +uint16_t Adafruit_BMP085::read16(uint8_t a) { + uint16_t ret; + + Wire.beginTransmission(BMP085_I2CADDR); // start transmission to device +#if (ARDUINO >= 100) + Wire.write(a); // sends register address to read from +#else + Wire.send(a); // sends register address to read from +#endif + Wire.endTransmission(); // end transmission + + Wire.beginTransmission(BMP085_I2CADDR); // start transmission to device + Wire.requestFrom(BMP085_I2CADDR, 2);// send data n-bytes read +#if (ARDUINO >= 100) + ret = Wire.read(); // receive DATA + ret <<= 8; + ret |= Wire.read(); // receive DATA +#else + ret = Wire.receive(); // receive DATA + ret <<= 8; + ret |= Wire.receive(); // receive DATA +#endif + Wire.endTransmission(); // end transmission + + return ret; +} + +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 + Wire.write(d); // write data +#else + Wire.send(a); // sends register address to read from + Wire.send(d); // write data +#endif + Wire.endTransmission(); // end transmission +} diff --git a/BMP085test/Adafruit_BMP085.h b/BMP085test/Adafruit_BMP085.h new file mode 100644 index 0000000..d91b7b1 --- /dev/null +++ b/BMP085test/Adafruit_BMP085.h @@ -0,0 +1,79 @@ +/*************************************************** + This is a library for the Adafruit BMP085/BMP180 Barometric Pressure + Temp sensor + + Designed specifically to work with the Adafruit BMP085 or BMP180 Breakout + ----> http://www.adafruit.com/products/391 + ----> http://www.adafruit.com/products/1603 + + 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 + ****************************************************/ + +#ifndef ADAFRUIT_BMP085_H +#define ADAFRUIT_BMP085_H + +#if (ARDUINO >= 100) + #include "Arduino.h" +#else + #include "WProgram.h" +#endif +#include "Wire.h" + +#define BMP085_DEBUG 0 + +#define BMP085_I2CADDR 0x77 + +#define BMP085_ULTRALOWPOWER 0 +#define BMP085_STANDARD 1 +#define BMP085_HIGHRES 2 +#define BMP085_ULTRAHIGHRES 3 +#define BMP085_CAL_AC1 0xAA // R Calibration data (16 bits) +#define BMP085_CAL_AC2 0xAC // R Calibration data (16 bits) +#define BMP085_CAL_AC3 0xAE // R Calibration data (16 bits) +#define BMP085_CAL_AC4 0xB0 // R Calibration data (16 bits) +#define BMP085_CAL_AC5 0xB2 // R Calibration data (16 bits) +#define BMP085_CAL_AC6 0xB4 // R Calibration data (16 bits) +#define BMP085_CAL_B1 0xB6 // R Calibration data (16 bits) +#define BMP085_CAL_B2 0xB8 // R Calibration data (16 bits) +#define BMP085_CAL_MB 0xBA // R Calibration data (16 bits) +#define BMP085_CAL_MC 0xBC // R Calibration data (16 bits) +#define BMP085_CAL_MD 0xBE // R Calibration data (16 bits) + +#define BMP085_CONTROL 0xF4 +#define BMP085_TEMPDATA 0xF6 +#define BMP085_PRESSUREDATA 0xF6 +#define BMP085_READTEMPCMD 0x2E +#define BMP085_READPRESSURECMD 0x34 + + +class Adafruit_BMP085 { + public: + Adafruit_BMP085(); + boolean begin(uint8_t mode = BMP085_ULTRAHIGHRES); // by default go highres + float readTemperature(void); + int32_t readPressure(void); + int32_t readSealevelPressure(float altitude_meters = 0); + float readAltitude(float sealevelPressure = 101325); // std atmosphere + uint16_t readRawTemperature(void); + uint32_t readRawPressure(void); + + private: + int32_t computeB5(int32_t UT); + uint8_t read8(uint8_t addr); + uint16_t read16(uint8_t addr); + void write8(uint8_t addr, uint8_t data); + + uint8_t oversampling; + + int16_t ac1, ac2, ac3, b1, b2, mb, mc, md; + uint16_t ac4, ac5, ac6; +}; + + +#endif // ADAFRUIT_BMP085_H diff --git a/BMP085test/BMP085test.ino b/BMP085test/BMP085test.ino new file mode 100644 index 0000000..81ad01e --- /dev/null +++ b/BMP085test/BMP085test.ino @@ -0,0 +1,66 @@ +#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 +// Connect SCL to i2c clock - on '168/'328 Arduino Uno/Duemilanove/etc thats Analog 5 +// Connect SDA to i2c data - on '168/'328 Arduino Uno/Duemilanove/etc thats Analog 4 +// EOC is not used, it signifies an end of conversion +// XCLR is a reset pin, also not used here + +Adafruit_BMP085 bmp; + +void setup() { + Serial.begin(9600); + if (!bmp.begin()) { + Serial.println("Could not find a valid BMP085 sensor, check wiring!"); + while (1) {} + } +} + +void loop() { + Serial.print("Temperature = "); + Serial.print(bmp.readTemperature()); + Serial.println(" *C"); + + Serial.print("Pressure = "); + Serial.print(bmp.readPressure()); + Serial.println(" Pa"); + + // Calculate altitude assuming 'standard' barometric + // pressure of 1013.25 millibar = 101325 Pascal + Serial.print("Altitude = "); + Serial.print(bmp.readAltitude()); + Serial.println(" meters"); + + Serial.print("Pressure at sealevel (calculated) = "); + Serial.print(bmp.readSealevelPressure()); + Serial.println(" Pa"); + + // you can get a more precise measurement of altitude + // if you know the current sea level pressure which will + // vary with weather and such. If it is 1015 millibars + // that is equal to 101500 Pascals. + Serial.print("Real altitude = "); + Serial.print(bmp.readAltitude(101500)); + Serial.println(" meters"); + + Serial.println(); + delay(500); +} diff --git a/bmp280-test/bmp280-test.ino b/bmp280-test/bmp280-test.ino new file mode 100644 index 0000000..84a2164 --- /dev/null +++ b/bmp280-test/bmp280-test.ino @@ -0,0 +1,59 @@ +#include +#include "i2c.h" + +#include "i2c_BMP280.h" +BMP280 bmp280; + +void setup() +{ + Serial.begin(115200); + + Serial.print("Probe BMP280: "); + if (bmp280.initialize()) Serial.println("Sensor found"); + else + { + Serial.println("Sensor missing"); + while (1) {} + } + + // onetime-measure: + bmp280.setEnabled(0); + bmp280.triggerMeasurement(); +} + +void loop() +{ + bmp280.awaitMeasurement(); + + float temperature; + bmp280.getTemperature(temperature); + + float pascal; + bmp280.getPressure(pascal); + + static float meters, metersold; + bmp280.getAltitude(meters); + metersold = (metersold * 10 + meters)/11; + + bmp280.triggerMeasurement(); + + Serial.print(" HeightPT1: "); + Serial.print(metersold); + Serial.print(" m; Height: "); + Serial.print(meters); + Serial.print(" Pressure: "); + Serial.print(pascal); + Serial.print(" Pa; T: "); + Serial.print(temperature); + Serial.println(" C"); +} + +/**< + +Program size: +A1.0.5: +A1.5.7: 9680b +A1.6.3: 9664b / 561b + + */ + diff --git a/bmp280-test/i2c.cpp b/bmp280-test/i2c.cpp new file mode 100644 index 0000000..d77badc --- /dev/null +++ b/bmp280-test/i2c.cpp @@ -0,0 +1,13 @@ +//#ifdef WirePlus_h + +/**< + +TODO: ugly BUGFIX!!! + moved content directly to i2c.h ... + to get Scripts without i2c down in filesize + (i2c.cpp is loaded w/o request) + + */ + +//#endif + diff --git a/bmp280-test/i2c.h b/bmp280-test/i2c.h new file mode 100644 index 0000000..4eaf677 --- /dev/null +++ b/bmp280-test/i2c.h @@ -0,0 +1,173 @@ +#ifndef WirePlus_h +#define WirePlus_h + +#include "Wire.h" +#include // for uint8_t data type + +/** ######### usefull defines ################################################################# */ + +#define getmax(a,b) ((a)>(b)?(a):(b)) // TODO: implement as static const +#define BITMASK(a) (1< 250 + Serial.println(int8_t(value)); // --> -6 + Serial.println(int8_t(value)<<8); // --> -1536 = -6*256 + + Serial.println(uint8_t(value)); // --> 250 + Serial.println(uint8_t(value)<<8); // --> -1536 = -6*256 !!!!!!!!!!!!!!!!!!!!!! + Serial.println(uint16_t(value<<8)); // --> 64000 + + */ + + +class WirePlus +{ + +public: + + WirePlus(); + + uint8_t probe (const uint8_t); + uint8_t probeAddress(const uint8_t); + void write (const uint8_t, const uint8_t, const uint8_t *, const uint8_t); + void writeByte (const uint8_t, const uint8_t, const uint8_t); + void writeCMD (const uint8_t, const uint8_t); + uint8_t readByte (const uint8_t, const uint8_t); + void read (const uint8_t, const uint8_t, uint8_t *, const uint8_t); + void setRegister (const uint8_t, const uint8_t, const uint8_t, const uint8_t); + uint8_t getRegister (const uint8_t, const uint8_t, const uint8_t); + +private: + + WirePlus(const WirePlus&); // declaration only for copy constructor + WirePlus& operator=(const WirePlus&); // declaration only for copy assignment --> make it uncopyable +}; + +/** ######### Implementation ################################################################# */ + +WirePlus::WirePlus() +{ + Wire.begin(); // I2C as Master + // bitSet(PORTC, 4); // deactivate internal pull-ups for twi + // bitSet(PORTC, 5); // as per note from atmega8 manual pg167 + // switch to 400KHz I2C - eheheh + TWBR = ((F_CPU / 400000L) - 16) / 2; // see twi_init in Wire/utility/twi.c +}; +/** ######### Public Methods ################################################################# */ + + + +uint8_t WirePlus::probe(const uint8_t address) +{ + Wire.beginTransmission(address); + if (Wire.endTransmission(true)==0) return 1; // found something + else return 0; // no response +}; + +uint8_t WirePlus::probeAddress(const uint8_t address) +{ + return probe(address); +}; + +void WirePlus::write(const uint8_t address, const uint8_t register_address, const uint8_t write_value[], const uint8_t length=1) +{ + if (!length) return; + Wire.beginTransmission(address); + Wire.write(register_address); + uint8_t counter; + counter = 0; + while (counter < length) + { + Wire.write(write_value[counter]); + counter++; + } + Wire.endTransmission(true); +}; + +void WirePlus::writeByte(const uint8_t address, const uint8_t register_address, const uint8_t write_value) +{ + Wire.beginTransmission(address); + Wire.write(register_address); + Wire.write(write_value); + Wire.endTransmission(true); +}; + +void WirePlus::writeCMD(const uint8_t address, const uint8_t cmd) +{ + Wire.beginTransmission(address); + Wire.write(cmd); + Wire.endTransmission(); +}; + +void WirePlus::read(const uint8_t address, const uint8_t registeraddress, uint8_t buff[], const uint8_t length=1) +{ + Wire.beginTransmission(address); // Adress + WRITE (0) + Wire.write(registeraddress); + Wire.endTransmission(false); // No Stop Condition, for repeated Talk + + if (!length) return; + Wire.requestFrom(address, length); // Address + READ (1) + uint8_t _i; + _i=0; + while(Wire.available()) + { + buff[_i] = Wire.read(); + _i++; + } + + Wire.endTransmission(true); // Stop Condition +}; + +uint8_t WirePlus::readByte(const uint8_t address, const uint8_t register_address) +{ + uint8_t _readvalue; + read(address, register_address, &_readvalue, 1); + return _readvalue; +}; + +void WirePlus::setRegister(const uint8_t address, const uint8_t registeraddress, const uint8_t mask, const uint8_t writevalue) +{ + uint8_t _setting; + read(address, registeraddress, &_setting, 1 ); + _setting &= ~mask; + _setting |= (writevalue&mask); + writeByte(address, registeraddress, _setting); +}; + +uint8_t WirePlus::getRegister(const uint8_t address, const uint8_t registeraddress, const uint8_t mask) +{ + uint8_t _setting; + read(address, registeraddress, &_setting, (uint8_t)1 ); + return (_setting & mask); +}; + + + + +extern WirePlus i2c; + +/** ######### Preinstantiate Object ################################################################# */ +WirePlus i2c; + +//#include "i2c.cpp" // TODO: ugly BUGFIX to get Scripts without i2c down in filesize (i2c.cpp is loaded w/o request) + +#endif diff --git a/bmp280test/Adafruit_BMP280.h b/bmp280test/Adafruit_BMP280.h new file mode 100644 index 0000000..287ab49 --- /dev/null +++ b/bmp280test/Adafruit_BMP280.h @@ -0,0 +1,157 @@ +/*************************************************************************** + This is a library for the BMP280 pressure sensor + + Designed specifically to work with the Adafruit BMP280 Breakout + ----> http://www.adafruit.com/products/2651 + + These sensors use I2C to communicate, 2 pins are required to interface. + + Adafruit invests time and resources providing this open source code, + please support Adafruit andopen-source hardware by purchasing products + from Adafruit! + + Written by Kevin Townsend for Adafruit Industries. + BSD license, all text above must be included in any redistribution + ***************************************************************************/ +#ifndef __BMP280_H__ +#define __BMP280_H__ + +#if (ARDUINO >= 100) + #include "Arduino.h" +#else + #include "WProgram.h" +#endif + +#include + +#ifdef __AVR_ATtiny85__ + #include "TinyWireM.h" + #define Wire TinyWireM +#else + #include +#endif + +/*========================================================================= + I2C ADDRESS/BITS + -----------------------------------------------------------------------*/ + #define BMP280_ADDRESS (0x76) +/*=========================================================================*/ + +/*========================================================================= + REGISTERS + -----------------------------------------------------------------------*/ + enum + { + BMP280_REGISTER_DIG_T1 = 0x88, + BMP280_REGISTER_DIG_T2 = 0x8A, + BMP280_REGISTER_DIG_T3 = 0x8C, + + BMP280_REGISTER_DIG_P1 = 0x8E, + BMP280_REGISTER_DIG_P2 = 0x90, + BMP280_REGISTER_DIG_P3 = 0x92, + BMP280_REGISTER_DIG_P4 = 0x94, + BMP280_REGISTER_DIG_P5 = 0x96, + BMP280_REGISTER_DIG_P6 = 0x98, + BMP280_REGISTER_DIG_P7 = 0x9A, + BMP280_REGISTER_DIG_P8 = 0x9C, + BMP280_REGISTER_DIG_P9 = 0x9E, + + BMP280_REGISTER_CHIPID = 0xD0, + BMP280_REGISTER_VERSION = 0xD1, + BMP280_REGISTER_SOFTRESET = 0xE0, + + BMP280_REGISTER_CAL26 = 0xE1, // R calibration stored in 0xE1-0xF0 + + BMP280_REGISTER_CONTROL = 0xF4, + BMP280_REGISTER_CONFIG = 0xF5, + BMP280_REGISTER_PRESSUREDATA = 0xF7, + BMP280_REGISTER_TEMPDATA = 0xFA, + }; + +/*=========================================================================*/ + +/*========================================================================= + CALIBRATION DATA + -----------------------------------------------------------------------*/ + typedef struct + { + uint16_t dig_T1; + int16_t dig_T2; + int16_t dig_T3; + + uint16_t dig_P1; + int16_t dig_P2; + int16_t dig_P3; + int16_t dig_P4; + int16_t dig_P5; + int16_t dig_P6; + int16_t dig_P7; + int16_t dig_P8; + int16_t dig_P9; + + uint8_t dig_H1; + int16_t dig_H2; + uint8_t dig_H3; + int16_t dig_H4; + int16_t dig_H5; + int8_t dig_H6; + } bmp280_calib_data; +/*=========================================================================*/ + +/* +class Adafruit_BMP280_Unified : public Adafruit_Sensor +{ + public: + Adafruit_BMP280_Unified(int32_t sensorID = -1); + + bool begin(uint8_t addr = BMP280_ADDRESS); + void getTemperature(float *temp); + void getPressure(float *pressure); + float pressureToAltitude(float seaLevel, float atmospheric, float temp); + float seaLevelForAltitude(float altitude, float atmospheric, float temp); + void getEvent(sensors_event_t*); + void getSensor(sensor_t*); + + private: + uint8_t _i2c_addr; + int32_t _sensorID; +}; + +*/ + +class Adafruit_BMP280 +{ + public: + Adafruit_BMP280(void); + Adafruit_BMP280(int8_t cspin); + Adafruit_BMP280(int8_t cspin, int8_t mosipin, int8_t misopin, int8_t sckpin); + + bool begin(uint8_t addr = BMP280_ADDRESS); + float readTemperature(void); + float readPressure(void); + float readAltitude(float seaLevelhPa = 1013.25); + + private: + + void readCoefficients(void); + uint8_t spixfer(uint8_t x); + + void write8(byte reg, byte value); + uint8_t read8(byte reg); + uint16_t read16(byte reg); + uint32_t read24(byte reg); + int16_t readS16(byte reg); + uint16_t read16_LE(byte reg); // little endian + int16_t readS16_LE(byte reg); // little endian + + uint8_t _i2caddr; + int32_t _sensorID; + int32_t t_fine; + + int8_t _cs, _mosi, _miso, _sck; + + bmp280_calib_data _bmp280_calib; + +}; + +#endif diff --git a/bmp280test/bmp280test.ino b/bmp280test/bmp280test.ino new file mode 100644 index 0000000..880e951 --- /dev/null +++ b/bmp280test/bmp280test.ino @@ -0,0 +1,63 @@ +/*************************************************************************** + This is a library for the BMP280 humidity, temperature & pressure sensor + + Designed specifically to work with the Adafruit BMEP280 Breakout + ----> http://www.adafruit.com/products/2651 + + These sensors use I2C or SPI to communicate, 2 or 4 pins are required + to interface. + + Adafruit invests time and resources providing this open source code, + please support Adafruit andopen-source hardware by purchasing products + from Adafruit! + + Written by Limor Fried & Kevin Townsend for Adafruit Industries. + BSD license, all text above must be included in any redistribution + ***************************************************************************/ + +#include +#include +#include +#include + +#define BMP_SCK 13 +#define BMP_MISO 12 +#define BMP_MOSI 11 +#define BMP_CS 10 + +#define ALT_BMP280_ADDRESS (0x76) + +Adafruit_BMP280 bme; // I2C +//Adafruit_BMP280 bme(BMP_CS); // hardware SPI +// Adafruit_BMP280 bme(BMP_CS, BMP_MOSI, BMP_MISO, BMP_SCK); + +void setup() { + Serial.begin(9600); + Serial.println(F("BMP280 test")); + + Serial.println(F("BMP280_ADDRESS")); + Serial.println(BMP280_ADDRESS); + Serial.println(F("ALT_BMP280_ADDRESS")); + Serial.println(ALT_BMP280_ADDRESS); + if (!bme.begin(ALT_BMP280_ADDRESS)) { + Serial.println("Could not find a valid BMP280 sensor, check wiring!"); + while (1); + } +} + +void loop() { + Serial.print("Temperature = "); + Serial.print(bme.readTemperature()); + Serial.println(" *C"); + + Serial.print("Pressure = "); + Serial.print(bme.readPressure()); + Serial.println(" Pa"); + + Serial.print("Approx altitude = "); + Serial.print(bme.readAltitude(1006.44)); // this should be adjusted to your local forcase + Serial.println(" m"); + + Serial.println(); + delay(2000); +} diff --git a/esp32_bme280/esp32_bme280.ino b/esp32_bme280/esp32_bme280.ino new file mode 100644 index 0000000..af1b182 --- /dev/null +++ b/esp32_bme280/esp32_bme280.ino @@ -0,0 +1,59 @@ +/*************************************************************************** + This is a library for the BMP280 humidity, temperature & pressure sensor + + Designed specifically to work with the Adafruit BMEP280 Breakout + ----> http://www.adafruit.com/products/2651 + + These sensors use I2C or SPI to communicate, 2 or 4 pins are required + to interface. + + Adafruit invests time and resources providing this open source code, + please support Adafruit andopen-source hardware by purchasing products + from Adafruit! + + Written by Limor Fried & Kevin Townsend for Adafruit Industries. + BSD license, all text above must be included in any redistribution + ***************************************************************************/ + +#include +#include +#include +#include + +#define BMP_SCK 13 +#define BMP_MISO 12 +#define BMP_MOSI 11 +#define BMP_CS 10 + +#define ALT_BMP280_ADDRESS (0x76) + +Adafruit_BMP280 bme; // I2C +//Adafruit_BMP280 bme(BMP_CS); // hardware SPI +//Adafruit_BMP280 bme(BMP_CS, BMP_MOSI, BMP_MISO, BMP_SCK); + +void setup() { + Serial.begin(115200); + Serial.println(F("BMP280 test")); + + if (!bme.begin(ALT_BMP280_ADDRESS)) { + Serial.println("Could not find a valid BMP280 sensor, check wiring!"); + while (1); + } +} + +void loop() { + Serial.print("Temperature = "); + Serial.print(bme.readTemperature()); + Serial.println(" *C"); + + Serial.print("Pressure = "); + Serial.print(bme.readPressure()); + Serial.println(" Pa"); + + Serial.print("Approx altitude = "); + Serial.print(bme.readAltitude(1013.25)); // this should be adjusted to your local forcase + Serial.println(" m"); + + Serial.println(); + delay(2000); +} diff --git a/esp32_logger/esp32_logger.ino b/esp32_logger/esp32_logger.ino new file mode 100644 index 0000000..c5b7ca9 --- /dev/null +++ b/esp32_logger/esp32_logger.ino @@ -0,0 +1,133 @@ + +#include +#include +#include +#include + +#include +#include + + + +#define BMP_SCK 13 +#define BMP_MISO 12 +#define BMP_MOSI 11 +#define BMP_CS 10 + +#define ALT_BMP280_ADDRESS (0x76) + +Adafruit_BMP280 bme; // I2C + +const char* networkName = "W1ztM.4omNj"; +const char* networkPswd = "MPReoa43"; +const char* mqtt_server = "192.168.1.156"; + +const int LED_PIN = 13; + +WiFiClient espClient; +PubSubClient client(espClient); + +void setup() { + // put your setup code here, to run once: + Serial.begin(115200); + + pinMode(LED_PIN, OUTPUT); + + // Connect to the WiFi network (see function below loop) + InitTempSensor(); + connectToWiFi(networkName, networkPswd); + + digitalWrite(LED_PIN, LOW); // LED off + client.setServer(mqtt_server, 1883); +} + +void connectToWiFi(const char * ssid, const char * pwd) +{ + int ledState = 0; + + printLine(); + Serial.println("Connecting to WiFi network: " + String(ssid)); + + WiFi.begin(ssid, pwd); + + while (WiFi.status() != WL_CONNECTED) + { + // Blink LED while we're connecting: + digitalWrite(LED_PIN, ledState); + ledState = (ledState + 1) % 2; // Flip ledState + delay(500); + Serial.print("."); + } + + Serial.println(); + Serial.println("WiFi connected!"); + Serial.print("IP address: "); + Serial.println(WiFi.localIP()); +} + +void InitTempSensor() { + if (!bme.begin(ALT_BMP280_ADDRESS)) { + Serial.println("Could not find a valid BMP280 sensor, check wiring!"); + int ledState = 0; + while (1) { + digitalWrite(LED_PIN, ledState); + ledState = (ledState + 1) % 2; // Flip ledState + delay(100); + } + } +} + +void reconnect() { + // Loop until we're reconnected + while (!client.connected()) { + Serial.print("Attempting MQTT connection..."); + // Attempt to connect + if (client.connect("ESP32Client")) { + digitalWrite(LED_PIN, LOW); + Serial.println("connected"); + client.subscribe("bedroomTemp"); + } else { + digitalWrite(LED_PIN, HIGH); + Serial.print("failed, rc="); + Serial.print(client.state()); + Serial.println(" try again in 5 seconds"); + // Wait 5 seconds before retrying + delay(5000); + } + } +} + + +void printLine() +{ + Serial.println(); + for (int i = 0; i < 30; i++) + Serial.print("-"); + Serial.println(); +} +void loop() { + // put your main code here, to run repeatedly: + if (!client.connected()) { + reconnect(); + } + client.loop(); + char szEventInfo[64]; + float tempReading = bme.readTemperature(); + float presReading = bme.readPressure() / 100.0; + + Serial.print("Temperature = "); + Serial.print(tempReading); + Serial.println(" *C"); + + Serial.print("Pressure = "); + Serial.print(presReading); + Serial.println(" mBar"); + + String strTemp = "{\"temp\":" + String(tempReading, 2) + "}"; + + strTemp.toCharArray(szEventInfo, 64); + Serial.print("Publish message: "); + Serial.println(szEventInfo); + client.publish("bedroomTemp", szEventInfo); + delay(10000); +} diff --git a/gemma_blink/gemma_blink.ino b/gemma_blink/gemma_blink.ino new file mode 100644 index 0000000..a16991b --- /dev/null +++ b/gemma_blink/gemma_blink.ino @@ -0,0 +1,34 @@ +/* + Blink + Turns on an LED on for one second, then off for one second, repeatedly. + + This example code is in the public domain. + + To upload to your or Trinket: + 1) Select the proper board from the Tools->Board Menu (Arduino Gemma if + teal, Adafruit Gemma if black) + 2) Select the uploader from the Tools->Programmer ("Arduino Gemma" if teal, + "USBtinyISP" if black Gemma) + 3) Plug in the Gemma into USB, make sure you see the green LED lit + 4) For windows, make sure you install the right Gemma drivers + 5) Press the button on the Gemma/Trinket - verify you see + the red LED pulse. This means it is ready to receive data + 6) Click the upload button above within 10 seconds +*/ + +int led = 1; // blink 'digital' pin 1 - AKA the built in red LED + +// the setup routine runs once when you press reset: +void setup() { + // initialize the digital pin as an output. + pinMode(led, OUTPUT); + +} + +// the loop routine runs over and over again forever: +void loop() { + digitalWrite(led, HIGH); + delay(1000); + digitalWrite(led, LOW); + delay(1000); +} diff --git a/gemma_fire/gemma_fire.ino b/gemma_fire/gemma_fire.ino new file mode 100644 index 0000000..72af686 --- /dev/null +++ b/gemma_fire/gemma_fire.ino @@ -0,0 +1,114 @@ +// Low power NeoPixel earrings example. Makes a nice blinky display +// with just a few LEDs on at any time...uses MUCH less juice than +// rainbow display! + +#include + +#define PIN 0 +#define FIRE_SIZE 15 +#define RED_SIZE 12 +#define LIGHTNING_SIZE 14 + +Adafruit_NeoPixel pixels = Adafruit_NeoPixel(1, PIN); + +uint8_t mode = 0, // Current animation effect + offset = 0; // Position of spinny eyes +uint32_t color = 0xffffff; // Start red +uint32_t prevTime; +uint8_t m = 0; +uint32_t waiting = 8000; + + +const uint32_t mix[] = { 0xff00ff, 0x8f00ff, 0xf000ff }; +const uint32_t breathe[] = {7, 7, 15, 23, 30, 38, 45, 52, 58, 64, 70, 76, 80, 85, 89, 92, 95, 97, 98, 99, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 99, 98, 97, 95, 92, 89, 85, 80, 76, 70, 64, 58, 52, 45, 38, 30, 23, 15, 7 }; +const uint32_t fire[] = { 0xff2426, 0xfe3223, 0xfe4121, 0xfd4f1f, 0xfd5e1d, 0xfc6d1b, 0xfc7b18, 0xfb8a16, 0xfb9814, 0xfaa712, 0xfab610, 0xffc20d, 0xffd30b, 0xffe309, 0xfff407, 0xf7ff05 }; +const uint32_t lightning[] = { 0xffffff, 0x2436ff, 0x2e43fe, 0x3950fe, 0x4354fe, 0x4e6bfe, 0xffffff, 0x5879fe, 0x6386fe, 0x6d93fe, 0x78a1fe, 0x82aefe, 0x8dbcfe, 0x97c9fe, 0xa2d6fe, 0xace4fe }; // ,0xc2fffe, , , , , , , , , , }; +const uint32_t reds[] = { 0xf4c262, 0xff6961 , 0xff5c5c, 0xff1c00, 0xff0800, 0xff0000, 0xcd5c5c, 0xe34234, 0xd73b3e, 0xce1620, 0xcc0000, 0xb22222 }; //, , , , , , , , , , , 0xb31b1b}; + + +void setup() { + pixels.begin(); + pixels.setBrightness(10); // 1/3 brightness + prevTime = millis(); +} + +void loop() { + uint8_t i; + uint32_t t; + uint8_t B; + + + switch (mode) { + + case 0: // Random sparks - just one LED on at a time! + + // + pixels.setPixelColor(0, color); + pixels.show(); + delay(1000); + break; + + case 1: // Spinny wheels (8 LEDs on at a time) + B = breathe[m]; + + // color = fire[random(FIRE_SIZE)]; + // color = lightning[random(LIGHTNING_SIZE)]; +color = 0xff0000; + pixels.setPixelColor(0, color); + pixels.setBrightness(B); + pixels.show(); + + m++; + if (m > 49) { + m = 0; + } + + delay(60); + break; + + case 2: + + color = reds[random(RED_SIZE)]; + + // color = lightning[random(LIGHTNING_SIZE)]; + + pixels.setPixelColor(0, color); + + pixels.show(); + + delay(120); + break; + } + + t = millis(); + + if ((t - prevTime) > waiting) { + + // color = fire[random(FIRE_SIZE)]; + mode++; + m = 0; + + if (mode > 2) { + mode = 0; + } + switch (mode) { + case 0: + waiting = 8000; + color = 0xff0000; + // color = 0x007fff; + break; + case 1: + waiting = 30000; + break; + case 2: + waiting = 30000; + pixels.setBrightness(60); + break; + } + //color = rgb[random(3)]; + prevTime = t; + } + + + +} diff --git a/gemma_fire_v2/gemma_fire_v2.ino b/gemma_fire_v2/gemma_fire_v2.ino new file mode 100644 index 0000000..37eb067 --- /dev/null +++ b/gemma_fire_v2/gemma_fire_v2.ino @@ -0,0 +1,162 @@ +// Low power NeoPixel earrings example. Makes a nice blinky display +// with just a few LEDs on at any time...uses MUCH less juice than +// rainbow display! + +#include +#include + +#define PIN 0 +#define FIRE_SIZE 15 +#define RED_SIZE 12 +#define LIGHTNING_SIZE 14 + +Adafruit_NeoPixel pixels = Adafruit_NeoPixel(1, PIN); + +uint8_t mode = 0, // Current animation effect + offset = 0; // Position of spinny eyes +uint32_t color = 0xffffff; // Start red +uint32_t prevTime; +uint32_t prevChange; +uint8_t m = 0; +uint32_t waiting = 8000; +uint32_t changeTime = 120000; +uint8_t colourMode = 0; + + +const uint32_t mix[] = { 0xff00ff, 0x8f00ff, 0xf000ff }; +const uint32_t breathe[] = {7, 7, 15, 23, 30, 38, 45, 52, 58, 64, 70, 76, 80, 85, 89, 92, 95, 97, 98, 99, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 99, 98, 97, 95, 92, 89, 85, 80, 76, 70, 64, 58, 52, 45, 38, 30, 23, 15, 7 }; +const uint32_t fire[] = { 0xff2426, 0xfe3223, 0xfe4121, 0xfd4f1f, 0xfd5e1d, 0xfc6d1b, 0xfc7b18, 0xfb8a16, 0xfb9814, 0xfaa712, 0xfab610, 0xffc20d, 0xffd30b, 0xffe309, 0xfff407, 0xf7ff05 }; +const uint32_t lightning[] = { 0xffffff, 0x2436ff, 0x2e43fe, 0x3950fe, 0x4354fe, 0x4e6bfe, 0xffffff, 0x5879fe, 0x6386fe, 0x6d93fe, 0x78a1fe, 0x82aefe, 0x8dbcfe, 0x97c9fe, 0xa2d6fe, 0xace4fe }; // ,0xc2fffe, , , , , , , , , , }; +const uint32_t reds[] = { 0xf4c262, 0xff6961 , 0xff5c5c, 0xff1c00, 0xff0800, 0xff0000, 0xcd5c5c, 0xe34234, 0xd73b3e, 0xce1620, 0xcc0000, 0xb22222 }; //, , , , , , , , , , , 0xb31b1b}; + +const uint32_t clu_red_yellow[] = { 0xff0000, 0xff1100, 0xff2200, 0xff3300, 0xff4400, 0xff5500, 0xff6600, 0xff7700, 0xff8800, 0xff9900, 0xffaa00, 0xffbb00, 0xffcc00, 0xffdd00, 0xffee00, 0xffff00 }; +const uint32_t clu_blue_red[] = {0x0000ff, 0x2200ff, 0x4400ff, 0x6600ff, 0x8800ff, 0xaa00ff, 0xcc00ff, 0xee00ff, 0xff00ee, 0xff00cc, 0xff00aa, 0xff0088, 0xff0066, 0xff0044, 0xff0022, 0xff0000}; +const uint32_t clu_teal_purple[] = {0x00ffff, 0x00ddff, 0x00bbff, 0x0099ff, 0x0077ff, 0x0055ff, 0x0033ff, 0x0011ff, 0x1100ff, 0x3300ff, 0x5500ff, 0x7700ff, 0x9900ff, 0xbb00ff, 0xdd00ff, 0xff00ff}; +const uint32_t clu_red_orange[] = { 0xff0000, 0xff0c00, 0xff1700, 0xff2300, 0xff2f00, 0xff3a00, 0xff4600, 0xff5200, 0xff5d00, 0xff6900, 0xff7500, 0xff8000, 0xff8c00, 0xff9800, 0xffa300, 0xffaf00 }; +const uint32_t clu_teal_blue[] = { 0x00ffff, 0x00eeff, 0x00ddff, 0x00ccff, 0x00bbff, 0x00aaff, 0x0099ff, 0x0088ff, 0x0077ff, 0x0066ff, 0x0055ff, 0x0044ff, 0x0033ff, 0x0022ff, 0x0011ff, 0x0000ff }; +const uint32_t clu_red_black[] = { 0xff0000, 0xee0000, 0xdd0000, 0xcc0000, 0xbb0000, 0xaa0000, 0x990000, 0x880000, 0x770000, 0x660000, 0x550000, 0x440000, 0x330000, 0x220000, 0x080000, 0x000000 }; +const uint32_t clu_purple_yellow[] = { 0xff00ff, 0xff00dd, 0xff00bb, 0xff0099, 0xff0077, 0xff0055, 0xff0033, 0xff0011, 0xff1100, 0xff3300, 0xff5500, 0xff7700, 0xff9900, 0xffbb00, 0xffdd00, 0xffff00}; +const uint32_t clu_yellow_green[] = { 0xffff00, 0xeeff00, 0xddff00, 0xccff00, 0xbbff00, 0xaaff00, 0x99ff00, 0x88ff00, 0x77ff00, 0x66ff00, 0x55ff00, 0x44ff00, 0x33ff00, 0x22ff00, 0x11ff00, 0x00ff00 }; +const uint32_t clu_orange_green[] = { 0xff5300, 0xff6f00, 0xff8c00, 0xffa800, 0xffc500, 0xffe100, 0xfffe00, 0xe4ff00, 0xc7ff00, 0xabff00, 0x8eff00, 0x72ff00, 0x55ff00, 0x39ff00, 0x1cff00, 0x00ff00 }; + +const uint32_t clu[32]; + + +void setup() { + pixels.begin(); + pixels.setBrightness(10); // 1/3 brightness + prevTime = millis(); + prevChange = millis(); + + // colourMode = 1; + // initclu(); +} + +void initclu() { + + memcpy(clu, clu_blue_red, sizeof clu_blue_red ); +} + + +void loop() { + uint8_t i; + uint32_t t; + uint8_t B; + + + + switch (mode) { + + case 0: // Random sparks - just one LED on at a time! + + // + pixels.setPixelColor(0, color); + pixels.show(); + delay(1000); + break; + + case 1: // Spinny wheels (8 LEDs on at a time) + B = breathe[m]; + + // color = fire[random(FIRE_SIZE)]; + // color = lightning[random(LIGHTNING_SIZE)]; + color = 0xff0000; + pixels.setPixelColor(0, color); + pixels.setBrightness(B); + pixels.show(); + + m++; + if (m > 49) { + m = 0; + } + + delay(60); + break; + + case 2: + if (colourMode == 0) { + color = clu_red_yellow[random(FIRE_SIZE)]; + } + if (colourMode == 1) { + color = clu_blue_red[random(FIRE_SIZE)]; + } + if (colourMode == 2) { + color = clu_teal_purple[random(FIRE_SIZE)]; + } + if (colourMode == 3) { + color = clu_red_orange[random(FIRE_SIZE)]; + } + + + // color = lightning[random(LIGHTNING_SIZE)]; + + pixels.setPixelColor(0, color); + + pixels.show(); + + delay(120); + break; + } + + t = millis(); + + + + if ((t - prevTime) > waiting) { + + // color = fire[random(FIRE_SIZE)]; + mode++; + m = 0; + + if (mode > 2) { + mode = 0; + } + switch (mode) { + case 0: + waiting = 8000; + color = 0xff0000; + // color = 0x007fff; + break; + case 1: + waiting = 30000; + break; + case 2: + waiting = 30000; + pixels.setBrightness(60); + break; + } + + if (mode == 2) { + //++colourMode; + //if (colourMode > 3) { + // colourMode = 0; + //} + } + //color = rgb[random(3)]; + prevTime = millis(); + } + + + + +} diff --git a/gemma_neo_orig/gemma_neo_orig.ino b/gemma_neo_orig/gemma_neo_orig.ino new file mode 100644 index 0000000..7fabb1b --- /dev/null +++ b/gemma_neo_orig/gemma_neo_orig.ino @@ -0,0 +1,129 @@ +// Low power NeoPixel earrings example. Makes a nice blinky display +// with just a few LEDs on at any time...uses MUCH less juice than +// rainbow display! + +#include + +#define PIN 0 + +Adafruit_NeoPixel pixels = Adafruit_NeoPixel(32, PIN); + +uint8_t mode = 1, // Current animation effect + offset = 0; // Position of spinny eyes +uint32_t color = 0xff0000; // Start red +uint32_t prevTime; +uint8_t m; + +const float pi = 3.14; + +const uint32_t breathe[] = {7, 7, 15, 23, 30, 38, 45, 52, 58, 64, 70, 76, 80, 85, 89, 92, 95, 97, 98, 99, 100, 100, 100, 100, 100, 100, 99, 98, 97, 95, 92, 89, 85, 80, 76, 70, 64, 58, 52, 45, 38, 30, 23, 15, 7 }; +const uint32_t fire[] = { 0xff2426, 0xfe3223, 0xfe4121, 0xfd4f1f, 0xfd5e1d, 0xfc6d1b, 0xfc7b18, 0xfb8a16, 0xfb9814, 0xfaa712, 0xfab610, 0xffc20d, 0xffd30b, 0xffe309, 0xfff407, 0xf7ff05 }; +const uint32_t lightning[] = { 0xffffff, 0x2436ff, 0x2e43fe, 0x3950fe, 0x4354fe, 0x4e6bfe,0xffffff, 0x5879fe, 0x6386fe, 0x6d93fe, 0x78a1fe, 0x82aefe, 0x8dbcfe, 0x97c9fe, 0xa2d6fe, 0xace4fe, 0xb7f1fe, 0xc2fffe, 0xffffff}; +void setup() { + pixels.begin(); + pixels.setBrightness(60); // 1/3 brightness + prevTime = millis(); +} + +void loop() { + uint8_t i; + uint32_t t; + uint8_t B; + + + switch(mode) { + + case 0: // Random sparks - just one LED on at a time! + i = 0; + pixels.setPixelColor(i, color); + pixels.show(); + delay(10); + // pixels.setPixelColor(i, 0); + break; + + case 1: // Spinny wheels (8 LEDs on at a time) + // B = breathe[m]; + + color = 0xff2426; + pixels.setPixelColor(i, color); + // pixels.setBrightness(B); + pixels.show(); + + m++; + if (m > 44) { + m = 0; + //color = 0xff00ff; + } + delay(60); + break; + + case 2: + i = 0; + B = random(30) + 30; + color = fire[random(15)]; + pixels.setPixelColor(i, color); + pixels.setBrightness(B); + pixels.show(); + delay(40); + // pixels.setPixelColor(i, 0); + + break; + case 3: + // i = random(32); + i = 0; + color = lightning[random(18)]; + pixels.setPixelColor(i, color); + pixels.show(); + delay(40); + pixels.setPixelColor(i, 0); + + break; + /* case 4: // Spinny wheels (8 LEDs on at a time) + for(i=0; i<7; i++) { + uint32_t c = 0; + if(((offset + i) & 7) < 2) c = fire[i+1]; // 4 pixels on... + pixels.setPixelColor( i, c); // First eye + // pixels.setPixelColor(31-i, c); // Second eye (flipped) + } + pixels.show(); + offset++; + delay(50);*/ + break; + + + case 5: // Spinny wheels (8 LEDs on at a time) + if (m > 17) m = 0; + uint32_t c = lightning[m]; + + for (i=0;i<7; i=i+2) { + pixels.setPixelColor( i, lightning[m-1]); // First eye + } + + for (i=1;i<7; i=i+2) { + pixels.setPixelColor( i, fire[m-1]); // First eye + } + + pixels.show(); + m++; + delay(50); + + break; + } + + t = millis(); + /* + * + if((t - prevTime) > 8000) { // Every 8 seconds... + mode++; // Next mode + m = 0; + if(mode > 3) { // End of modes? + mode = 0; // Start modes over + color >>= 8; // Next color R->G->B + if(!color) color = 0xffae00; // Reset to red + } + for(i=0; i<32; i++) pixels.setPixelColor(i, 0); + prevTime = t; + } + + */ +} diff --git a/gemma_pixel/gemma_pixel.ino b/gemma_pixel/gemma_pixel.ino new file mode 100644 index 0000000..cf9b3ae --- /dev/null +++ b/gemma_pixel/gemma_pixel.ino @@ -0,0 +1,69 @@ +// Low power NeoPixel earrings example. Makes a nice blinky display +// with just a few LEDs on at any time...uses MUCH less juice than +// rainbow display! + +#include + +#define PIN 0 + +Adafruit_NeoPixel pixels = Adafruit_NeoPixel(32, PIN); + +uint8_t mode = 0, // Current animation effect + offset = 0; // Position of spinny eyes +uint32_t color = 0xffae00; // Start red +uint32_t prevTime; +uint8_t maxPixels = 2; + +const uint32_t mm[] = { 0xff2426, 0xfe3223, 0xfe4121, 0xfd4f1f, 0xfd5e1d, 0xfc6d1b, 0xfc7b18, 0xfb8a16, 0xfb9814, 0xfaa712, 0xfab610, 0xffc20d, 0xffd30b, 0xffe309, 0xfff407, 0xf7ff05 }; + +void setup() { + pixels.begin(); + pixels.setBrightness(60); // 1/3 brightness + prevTime = millis(); +} + +void loop() { + uint8_t i; + uint32_t t; + + + switch(mode) { + + case 0: // Random sparks - just one LED on at a time! + i = random(15); + color = mm[i]; + pixels.setPixelColor(0, color); + pixels.setPixelColor(1, color); + pixels.show(); + i = random(4); + delay(5 + (i*5)); + pixels.setPixelColor(0, 0); + pixels.setPixelColor(1, 0); + pixels.show(); + break; + + case 1: // Spinny wheels (8 LEDs on at a time) + for(i=0; i 8000) { // Every 8 seconds... + mode++; // Next mode + if(mode > 1) { // End of modes? + mode = 0; // Start modes over + color >>= 8; // Next color R->G->B + if(!color) color = 0xffae00; // Reset to red + } + for(i=0; i<32; i++) pixels.setPixelColor(i, 0); + prevTime = t; + } +} diff --git a/gemma_test/gemma_test.ino b/gemma_test/gemma_test.ino new file mode 100644 index 0000000..a16991b --- /dev/null +++ b/gemma_test/gemma_test.ino @@ -0,0 +1,34 @@ +/* + Blink + Turns on an LED on for one second, then off for one second, repeatedly. + + This example code is in the public domain. + + To upload to your or Trinket: + 1) Select the proper board from the Tools->Board Menu (Arduino Gemma if + teal, Adafruit Gemma if black) + 2) Select the uploader from the Tools->Programmer ("Arduino Gemma" if teal, + "USBtinyISP" if black Gemma) + 3) Plug in the Gemma into USB, make sure you see the green LED lit + 4) For windows, make sure you install the right Gemma drivers + 5) Press the button on the Gemma/Trinket - verify you see + the red LED pulse. This means it is ready to receive data + 6) Click the upload button above within 10 seconds +*/ + +int led = 1; // blink 'digital' pin 1 - AKA the built in red LED + +// the setup routine runs once when you press reset: +void setup() { + // initialize the digital pin as an output. + pinMode(led, OUTPUT); + +} + +// the loop routine runs over and over again forever: +void loop() { + digitalWrite(led, HIGH); + delay(1000); + digitalWrite(led, LOW); + delay(1000); +} diff --git a/hardware/.DS_Store b/hardware/.DS_Store new file mode 100644 index 0000000..b72d30e Binary files /dev/null and b/hardware/.DS_Store differ diff --git a/hardware/espressif/.DS_Store b/hardware/espressif/.DS_Store new file mode 100644 index 0000000..973c8bf Binary files /dev/null and b/hardware/espressif/.DS_Store differ diff --git a/hardware/espressif/esp32 b/hardware/espressif/esp32 new file mode 160000 index 0000000..29a253a --- /dev/null +++ b/hardware/espressif/esp32 @@ -0,0 +1 @@ +Subproject commit 29a253ac9823fdb8189cfd72745a28143fe3c37d diff --git a/i2c_scanner/i2c_scanner.ino b/i2c_scanner/i2c_scanner.ino new file mode 100644 index 0000000..d8b7991 --- /dev/null +++ b/i2c_scanner/i2c_scanner.ino @@ -0,0 +1,83 @@ + // -------------------------------------- +// i2c_scanner +// +// Version 1 +// This program (or code that looks like it) +// can be found in many places. +// For example on the Arduino.cc forum. +// The original author is not know. +// Version 2, Juni 2012, Using Arduino 1.0.1 +// Adapted to be as simple as possible by Arduino.cc user Krodal +// Version 3, Feb 26 2013 +// V3 by louarnold +// Version 4, March 3, 2013, Using Arduino 1.0.3 +// by Arduino.cc user Krodal. +// Changes by louarnold removed. +// Scanning addresses changed from 0...127 to 1...119, +// according to the i2c scanner by Nick Gammon +// http://www.gammon.com.au/forum/?id=10896 +// Version 5, March 28, 2013 +// As version 4, but address scans now to 127. +// A sensor seems to use address 120. +// Version 6, November 27, 2015. +// Added waiting for the Leonardo serial communication. +// +// +// This sketch tests the standard 7-bit addresses +// Devices with higher bit address might not be seen properly. +// + +#include + + +void setup() +{ + Wire.begin(); + + Serial.begin(9600); + while (!Serial); // Leonardo: wait for serial monitor + Serial.println("\nI2C Scanner"); +} + + +void loop() +{ + byte error, address; + int nDevices; + + Serial.println("Scanning..."); + + nDevices = 0; + for(address = 1; address < 127; address++ ) + { + // The i2c_scanner uses the return value of + // the Write.endTransmisstion to see if + // a device did acknowledge to the address. + Wire.beginTransmission(address); + error = Wire.endTransmission(); + + if (error == 0) + { + Serial.print("I2C device found at address 0x"); + if (address<16) + Serial.print("0"); + Serial.print(address,HEX); + Serial.println(" !"); + + nDevices++; + } + else if (error==4) + { + Serial.print("Unknown error at address 0x"); + if (address<16) + Serial.print("0"); + Serial.println(address,HEX); + } + } + if (nDevices == 0) + Serial.println("No I2C devices found\n"); + else + Serial.println("done\n"); + + delay(5000); // wait 5 seconds for next scan +} diff --git a/libraries/.DS_Store b/libraries/.DS_Store new file mode 100644 index 0000000..55f392c Binary files /dev/null and b/libraries/.DS_Store differ diff --git a/libraries/Adafruit_BME280_Library/Adafruit_BME280.cpp b/libraries/Adafruit_BME280_Library/Adafruit_BME280.cpp new file mode 100644 index 0000000..373b5a7 --- /dev/null +++ b/libraries/Adafruit_BME280_Library/Adafruit_BME280.cpp @@ -0,0 +1,530 @@ +/*************************************************************************** + This is a library for the BME280 humidity, temperature & pressure sensor + + Designed specifically to work with the Adafruit BME280 Breakout + ----> http://www.adafruit.com/products/2650 + + These sensors use I2C or SPI to communicate, 2 or 4 pins are required + to interface. + + Adafruit invests time and resources providing this open source code, + please support Adafruit andopen-source hardware by purchasing products + from Adafruit! + + Written by Limor Fried & Kevin Townsend for Adafruit Industries. + BSD license, all text above must be included in any redistribution + ***************************************************************************/ +#include "Arduino.h" +#include +#include +#include "Adafruit_BME280.h" + +/*************************************************************************** + PRIVATE FUNCTIONS + ***************************************************************************/ +Adafruit_BME280::Adafruit_BME280() + : _cs(-1), _mosi(-1), _miso(-1), _sck(-1) +{ } + +Adafruit_BME280::Adafruit_BME280(int8_t cspin) + : _cs(cspin), _mosi(-1), _miso(-1), _sck(-1) +{ } + +Adafruit_BME280::Adafruit_BME280(int8_t cspin, int8_t mosipin, int8_t misopin, int8_t sckpin) + : _cs(cspin), _mosi(mosipin), _miso(misopin), _sck(sckpin) +{ } + + +/**************************************************************************/ +/*! + @brief Initialise sensor with given parameters / settings +*/ +/**************************************************************************/ +bool Adafruit_BME280::begin(TwoWire *theWire) +{ + _wire = theWire; + _i2caddr = BME280_ADDRESS; + return init(); +} + +bool Adafruit_BME280::begin(uint8_t addr) +{ + _i2caddr = addr; + _wire = &Wire; + return init(); +} + +bool Adafruit_BME280::begin(uint8_t addr, TwoWire *theWire) +{ + _i2caddr = addr; + _wire = theWire; + return init(); +} + +bool Adafruit_BME280::begin(void) +{ + _i2caddr = BME280_ADDRESS; + _wire = &Wire; + return init(); +} + +bool Adafruit_BME280::init() +{ + // init I2C or SPI sensor interface + if (_cs == -1) { + // I2C + _wire -> begin(); + } else { + digitalWrite(_cs, HIGH); + pinMode(_cs, OUTPUT); + if (_sck == -1) { + // hardware SPI + SPI.begin(); + } else { + // software SPI + pinMode(_sck, OUTPUT); + pinMode(_mosi, OUTPUT); + pinMode(_miso, INPUT); + } + } + + // check if sensor, i.e. the chip ID is correct + if (read8(BME280_REGISTER_CHIPID) != 0x60) + return false; + + // reset the device using soft-reset + // this makes sure the IIR is off, etc. + write8(BME280_REGISTER_SOFTRESET, 0xB6); + + // wait for chip to wake up. + delay(300); + + // if chip is still reading calibration, delay + while (isReadingCalibration()) + delay(100); + + readCoefficients(); // read trimming parameters, see DS 4.2.2 + + setSampling(); // use defaults + + delay(100); + + return true; +} + +/**************************************************************************/ +/*! + @brief setup sensor with given parameters / settings + + This is simply a overload to the normal begin()-function, so SPI users + don't get confused about the library requiring an address. +*/ +/**************************************************************************/ + + +void Adafruit_BME280::setSampling(sensor_mode mode, + sensor_sampling tempSampling, + sensor_sampling pressSampling, + sensor_sampling humSampling, + sensor_filter filter, + standby_duration duration) { + _measReg.mode = mode; + _measReg.osrs_t = tempSampling; + _measReg.osrs_p = pressSampling; + + + _humReg.osrs_h = humSampling; + _configReg.filter = filter; + _configReg.t_sb = duration; + + + // you must make sure to also set REGISTER_CONTROL after setting the + // CONTROLHUMID register, otherwise the values won't be applied (see DS 5.4.3) + write8(BME280_REGISTER_CONTROLHUMID, _humReg.get()); + write8(BME280_REGISTER_CONFIG, _configReg.get()); + write8(BME280_REGISTER_CONTROL, _measReg.get()); +} + + +/**************************************************************************/ +/*! + @brief Encapsulate hardware and software SPI transfer into one function +*/ +/**************************************************************************/ +uint8_t Adafruit_BME280::spixfer(uint8_t x) { + // hardware SPI + if (_sck == -1) + return SPI.transfer(x); + + // software SPI + uint8_t reply = 0; + for (int i=7; i>=0; i--) { + reply <<= 1; + digitalWrite(_sck, LOW); + digitalWrite(_mosi, x & (1< beginTransmission((uint8_t)_i2caddr); + _wire -> write((uint8_t)reg); + _wire -> write((uint8_t)value); + _wire -> endTransmission(); + } else { + if (_sck == -1) + SPI.beginTransaction(SPISettings(500000, MSBFIRST, SPI_MODE0)); + digitalWrite(_cs, LOW); + spixfer(reg & ~0x80); // write, bit 7 low + spixfer(value); + digitalWrite(_cs, HIGH); + if (_sck == -1) + SPI.endTransaction(); // release the SPI bus + } +} + + +/**************************************************************************/ +/*! + @brief Reads an 8 bit value over I2C or SPI +*/ +/**************************************************************************/ +uint8_t Adafruit_BME280::read8(byte reg) { + uint8_t value; + + if (_cs == -1) { + _wire -> beginTransmission((uint8_t)_i2caddr); + _wire -> write((uint8_t)reg); + _wire -> endTransmission(); + _wire -> requestFrom((uint8_t)_i2caddr, (byte)1); + value = _wire -> read(); + } else { + if (_sck == -1) + SPI.beginTransaction(SPISettings(500000, MSBFIRST, SPI_MODE0)); + digitalWrite(_cs, LOW); + spixfer(reg | 0x80); // read, bit 7 high + value = spixfer(0); + digitalWrite(_cs, HIGH); + if (_sck == -1) + SPI.endTransaction(); // release the SPI bus + } + return value; +} + + +/**************************************************************************/ +/*! + @brief Reads a 16 bit value over I2C or SPI +*/ +/**************************************************************************/ +uint16_t Adafruit_BME280::read16(byte reg) +{ + uint16_t value; + + if (_cs == -1) { + _wire -> beginTransmission((uint8_t)_i2caddr); + _wire -> write((uint8_t)reg); + _wire -> endTransmission(); + _wire -> requestFrom((uint8_t)_i2caddr, (byte)2); + value = (_wire -> read() << 8) | _wire -> read(); + } else { + if (_sck == -1) + SPI.beginTransaction(SPISettings(500000, MSBFIRST, SPI_MODE0)); + digitalWrite(_cs, LOW); + spixfer(reg | 0x80); // read, bit 7 high + value = (spixfer(0) << 8) | spixfer(0); + digitalWrite(_cs, HIGH); + if (_sck == -1) + SPI.endTransaction(); // release the SPI bus + } + + return value; +} + + +/**************************************************************************/ +/*! + +*/ +/**************************************************************************/ +uint16_t Adafruit_BME280::read16_LE(byte reg) { + uint16_t temp = read16(reg); + return (temp >> 8) | (temp << 8); +} + + +/**************************************************************************/ +/*! + @brief Reads a signed 16 bit value over I2C or SPI +*/ +/**************************************************************************/ +int16_t Adafruit_BME280::readS16(byte reg) +{ + return (int16_t)read16(reg); +} + + +/**************************************************************************/ +/*! + +*/ +/**************************************************************************/ +int16_t Adafruit_BME280::readS16_LE(byte reg) +{ + return (int16_t)read16_LE(reg); +} + + +/**************************************************************************/ +/*! + @brief Reads a 24 bit value over I2C +*/ +/**************************************************************************/ +uint32_t Adafruit_BME280::read24(byte reg) +{ + uint32_t value; + + if (_cs == -1) { + _wire -> beginTransmission((uint8_t)_i2caddr); + _wire -> write((uint8_t)reg); + _wire -> endTransmission(); + _wire -> requestFrom((uint8_t)_i2caddr, (byte)3); + + value = _wire -> read(); + value <<= 8; + value |= _wire -> read(); + value <<= 8; + value |= _wire -> read(); + } else { + if (_sck == -1) + SPI.beginTransaction(SPISettings(500000, MSBFIRST, SPI_MODE0)); + digitalWrite(_cs, LOW); + spixfer(reg | 0x80); // read, bit 7 high + + value = spixfer(0); + value <<= 8; + value |= spixfer(0); + value <<= 8; + value |= spixfer(0); + + digitalWrite(_cs, HIGH); + if (_sck == -1) + SPI.endTransaction(); // release the SPI bus + } + + return value; +} + + +/**************************************************************************/ +/*! + @brief Take a new measurement (only possible in forced mode) +*/ +/**************************************************************************/ +void Adafruit_BME280::takeForcedMeasurement() +{ + // If we are in forced mode, the BME sensor goes back to sleep after each + // measurement and we need to set it to forced mode once at this point, so + // it will take the next measurement and then return to sleep again. + // In normal mode simply does new measurements periodically. + if (_measReg.mode == MODE_FORCED) { + // set to forced mode, i.e. "take next measurement" + write8(BME280_REGISTER_CONTROL, _measReg.get()); + // wait until measurement has been completed, otherwise we would read + // the values from the last measurement + while (read8(BME280_REGISTER_STATUS) & 0x08) + delay(1); + } +} + + +/**************************************************************************/ +/*! + @brief Reads the factory-set coefficients +*/ +/**************************************************************************/ +void Adafruit_BME280::readCoefficients(void) +{ + _bme280_calib.dig_T1 = read16_LE(BME280_REGISTER_DIG_T1); + _bme280_calib.dig_T2 = readS16_LE(BME280_REGISTER_DIG_T2); + _bme280_calib.dig_T3 = readS16_LE(BME280_REGISTER_DIG_T3); + + _bme280_calib.dig_P1 = read16_LE(BME280_REGISTER_DIG_P1); + _bme280_calib.dig_P2 = readS16_LE(BME280_REGISTER_DIG_P2); + _bme280_calib.dig_P3 = readS16_LE(BME280_REGISTER_DIG_P3); + _bme280_calib.dig_P4 = readS16_LE(BME280_REGISTER_DIG_P4); + _bme280_calib.dig_P5 = readS16_LE(BME280_REGISTER_DIG_P5); + _bme280_calib.dig_P6 = readS16_LE(BME280_REGISTER_DIG_P6); + _bme280_calib.dig_P7 = readS16_LE(BME280_REGISTER_DIG_P7); + _bme280_calib.dig_P8 = readS16_LE(BME280_REGISTER_DIG_P8); + _bme280_calib.dig_P9 = readS16_LE(BME280_REGISTER_DIG_P9); + + _bme280_calib.dig_H1 = read8(BME280_REGISTER_DIG_H1); + _bme280_calib.dig_H2 = readS16_LE(BME280_REGISTER_DIG_H2); + _bme280_calib.dig_H3 = read8(BME280_REGISTER_DIG_H3); + _bme280_calib.dig_H4 = (read8(BME280_REGISTER_DIG_H4) << 4) | (read8(BME280_REGISTER_DIG_H4+1) & 0xF); + _bme280_calib.dig_H5 = (read8(BME280_REGISTER_DIG_H5+1) << 4) | (read8(BME280_REGISTER_DIG_H5) >> 4); + _bme280_calib.dig_H6 = (int8_t)read8(BME280_REGISTER_DIG_H6); +} + +/**************************************************************************/ +/*! + @brief return true if chip is busy reading cal data +*/ +/**************************************************************************/ +bool Adafruit_BME280::isReadingCalibration(void) +{ + uint8_t const rStatus = read8(BME280_REGISTER_STATUS); + + return (rStatus & (1 << 0)) != 0; +} + + +/**************************************************************************/ +/*! + @brief Returns the temperature from the sensor +*/ +/**************************************************************************/ +float Adafruit_BME280::readTemperature(void) +{ + int32_t var1, var2; + + int32_t adc_T = read24(BME280_REGISTER_TEMPDATA); + if (adc_T == 0x800000) // value in case temp measurement was disabled + return NAN; + adc_T >>= 4; + + var1 = ((((adc_T>>3) - ((int32_t)_bme280_calib.dig_T1 <<1))) * + ((int32_t)_bme280_calib.dig_T2)) >> 11; + + var2 = (((((adc_T>>4) - ((int32_t)_bme280_calib.dig_T1)) * + ((adc_T>>4) - ((int32_t)_bme280_calib.dig_T1))) >> 12) * + ((int32_t)_bme280_calib.dig_T3)) >> 14; + + t_fine = var1 + var2; + + float T = (t_fine * 5 + 128) >> 8; + return T/100; +} + + +/**************************************************************************/ +/*! + @brief Returns the temperature from the sensor +*/ +/**************************************************************************/ +float Adafruit_BME280::readPressure(void) { + int64_t var1, var2, p; + + readTemperature(); // must be done first to get t_fine + + int32_t adc_P = read24(BME280_REGISTER_PRESSUREDATA); + if (adc_P == 0x800000) // value in case pressure measurement was disabled + return NAN; + adc_P >>= 4; + + var1 = ((int64_t)t_fine) - 128000; + var2 = var1 * var1 * (int64_t)_bme280_calib.dig_P6; + var2 = var2 + ((var1*(int64_t)_bme280_calib.dig_P5)<<17); + var2 = var2 + (((int64_t)_bme280_calib.dig_P4)<<35); + var1 = ((var1 * var1 * (int64_t)_bme280_calib.dig_P3)>>8) + + ((var1 * (int64_t)_bme280_calib.dig_P2)<<12); + var1 = (((((int64_t)1)<<47)+var1))*((int64_t)_bme280_calib.dig_P1)>>33; + + if (var1 == 0) { + return 0; // avoid exception caused by division by zero + } + p = 1048576 - adc_P; + p = (((p<<31) - var2)*3125) / var1; + var1 = (((int64_t)_bme280_calib.dig_P9) * (p>>13) * (p>>13)) >> 25; + var2 = (((int64_t)_bme280_calib.dig_P8) * p) >> 19; + + p = ((p + var1 + var2) >> 8) + (((int64_t)_bme280_calib.dig_P7)<<4); + return (float)p/256; +} + + +/**************************************************************************/ +/*! + @brief Returns the humidity from the sensor +*/ +/**************************************************************************/ +float Adafruit_BME280::readHumidity(void) { + readTemperature(); // must be done first to get t_fine + + int32_t adc_H = read16(BME280_REGISTER_HUMIDDATA); + if (adc_H == 0x8000) // value in case humidity measurement was disabled + return NAN; + + int32_t v_x1_u32r; + + v_x1_u32r = (t_fine - ((int32_t)76800)); + + v_x1_u32r = (((((adc_H << 14) - (((int32_t)_bme280_calib.dig_H4) << 20) - + (((int32_t)_bme280_calib.dig_H5) * v_x1_u32r)) + ((int32_t)16384)) >> 15) * + (((((((v_x1_u32r * ((int32_t)_bme280_calib.dig_H6)) >> 10) * + (((v_x1_u32r * ((int32_t)_bme280_calib.dig_H3)) >> 11) + ((int32_t)32768))) >> 10) + + ((int32_t)2097152)) * ((int32_t)_bme280_calib.dig_H2) + 8192) >> 14)); + + v_x1_u32r = (v_x1_u32r - (((((v_x1_u32r >> 15) * (v_x1_u32r >> 15)) >> 7) * + ((int32_t)_bme280_calib.dig_H1)) >> 4)); + + v_x1_u32r = (v_x1_u32r < 0) ? 0 : v_x1_u32r; + v_x1_u32r = (v_x1_u32r > 419430400) ? 419430400 : v_x1_u32r; + float h = (v_x1_u32r>>12); + return h / 1024.0; +} + + +/**************************************************************************/ +/*! + Calculates the altitude (in meters) from the specified atmospheric + pressure (in hPa), and sea-level pressure (in hPa). + + @param seaLevel Sea-level pressure in hPa + @param atmospheric Atmospheric pressure in hPa +*/ +/**************************************************************************/ +float Adafruit_BME280::readAltitude(float seaLevel) +{ + // Equation taken from BMP180 datasheet (page 16): + // http://www.adafruit.com/datasheets/BST-BMP180-DS000-09.pdf + + // Note that using the equation from wikipedia can give bad results + // at high altitude. See this thread for more information: + // http://forums.adafruit.com/viewtopic.php?f=22&t=58064 + + float atmospheric = readPressure() / 100.0F; + return 44330.0 * (1.0 - pow(atmospheric / seaLevel, 0.1903)); +} + + +/**************************************************************************/ +/*! + Calculates the pressure at sea level (in hPa) from the specified altitude + (in meters), and atmospheric pressure (in hPa). + @param altitude Altitude in meters + @param atmospheric Atmospheric pressure in hPa +*/ +/**************************************************************************/ +float Adafruit_BME280::seaLevelForAltitude(float altitude, float atmospheric) +{ + // Equation taken from BMP180 datasheet (page 17): + // http://www.adafruit.com/datasheets/BST-BMP180-DS000-09.pdf + + // Note that using the equation from wikipedia can give bad results + // at high altitude. See this thread for more information: + // http://forums.adafruit.com/viewtopic.php?f=22&t=58064 + + return atmospheric / pow(1.0 - (altitude/44330.0), 5.255); +} diff --git a/libraries/Adafruit_BME280_Library/Adafruit_BME280.h b/libraries/Adafruit_BME280_Library/Adafruit_BME280.h new file mode 100644 index 0000000..61aeeed --- /dev/null +++ b/libraries/Adafruit_BME280_Library/Adafruit_BME280.h @@ -0,0 +1,300 @@ +/*************************************************************************** + This is a library for the BME280 humidity, temperature & pressure sensor + + Designed specifically to work with the Adafruit BME280 Breakout + ----> http://www.adafruit.com/products/2650 + + These sensors use I2C or SPI to communicate, 2 or 4 pins are required + to interface. + + Adafruit invests time and resources providing this open source code, + please support Adafruit andopen-source hardware by purchasing products + from Adafruit! + + Written by Limor Fried & Kevin Townsend for Adafruit Industries. + BSD license, all text above must be included in any redistribution + ***************************************************************************/ +#ifndef __BME280_H__ +#define __BME280_H__ + +#if (ARDUINO >= 100) + #include "Arduino.h" +#else + #include "WProgram.h" +#endif + +#include +#include + +/*========================================================================= + I2C ADDRESS/BITS + -----------------------------------------------------------------------*/ + #define BME280_ADDRESS (0x77) +/*=========================================================================*/ + +/*========================================================================= + REGISTERS + -----------------------------------------------------------------------*/ + enum + { + BME280_REGISTER_DIG_T1 = 0x88, + BME280_REGISTER_DIG_T2 = 0x8A, + BME280_REGISTER_DIG_T3 = 0x8C, + + BME280_REGISTER_DIG_P1 = 0x8E, + BME280_REGISTER_DIG_P2 = 0x90, + BME280_REGISTER_DIG_P3 = 0x92, + BME280_REGISTER_DIG_P4 = 0x94, + BME280_REGISTER_DIG_P5 = 0x96, + BME280_REGISTER_DIG_P6 = 0x98, + BME280_REGISTER_DIG_P7 = 0x9A, + BME280_REGISTER_DIG_P8 = 0x9C, + BME280_REGISTER_DIG_P9 = 0x9E, + + BME280_REGISTER_DIG_H1 = 0xA1, + BME280_REGISTER_DIG_H2 = 0xE1, + BME280_REGISTER_DIG_H3 = 0xE3, + BME280_REGISTER_DIG_H4 = 0xE4, + BME280_REGISTER_DIG_H5 = 0xE5, + BME280_REGISTER_DIG_H6 = 0xE7, + + BME280_REGISTER_CHIPID = 0xD0, + BME280_REGISTER_VERSION = 0xD1, + BME280_REGISTER_SOFTRESET = 0xE0, + + BME280_REGISTER_CAL26 = 0xE1, // R calibration stored in 0xE1-0xF0 + + BME280_REGISTER_CONTROLHUMID = 0xF2, + BME280_REGISTER_STATUS = 0XF3, + BME280_REGISTER_CONTROL = 0xF4, + BME280_REGISTER_CONFIG = 0xF5, + BME280_REGISTER_PRESSUREDATA = 0xF7, + BME280_REGISTER_TEMPDATA = 0xFA, + BME280_REGISTER_HUMIDDATA = 0xFD + }; + +/*=========================================================================*/ + +/*========================================================================= + CALIBRATION DATA + -----------------------------------------------------------------------*/ + typedef struct + { + uint16_t dig_T1; + int16_t dig_T2; + int16_t dig_T3; + + uint16_t dig_P1; + int16_t dig_P2; + int16_t dig_P3; + int16_t dig_P4; + int16_t dig_P5; + int16_t dig_P6; + int16_t dig_P7; + int16_t dig_P8; + int16_t dig_P9; + + uint8_t dig_H1; + int16_t dig_H2; + uint8_t dig_H3; + int16_t dig_H4; + int16_t dig_H5; + int8_t dig_H6; + } bme280_calib_data; +/*=========================================================================*/ + +/* +class Adafruit_BME280_Unified : public Adafruit_Sensor +{ + public: + Adafruit_BME280_Unified(int32_t sensorID = -1); + + bool begin(uint8_t addr = BME280_ADDRESS); + void getTemperature(float *temp); + void getPressure(float *pressure); + float pressureToAltitude(float seaLevel, float atmospheric, float temp); + float seaLevelForAltitude(float altitude, float atmospheric, float temp); + void getEvent(sensors_event_t*); + void getSensor(sensor_t*); + + private: + uint8_t _i2c_addr; + int32_t _sensorID; +}; + +*/ + +class Adafruit_BME280 { + public: + enum sensor_sampling { + SAMPLING_NONE = 0b000, + SAMPLING_X1 = 0b001, + SAMPLING_X2 = 0b010, + SAMPLING_X4 = 0b011, + SAMPLING_X8 = 0b100, + SAMPLING_X16 = 0b101 + }; + + enum sensor_mode { + MODE_SLEEP = 0b00, + MODE_FORCED = 0b01, + MODE_NORMAL = 0b11 + }; + + enum sensor_filter { + FILTER_OFF = 0b000, + FILTER_X2 = 0b001, + FILTER_X4 = 0b010, + FILTER_X8 = 0b011, + FILTER_X16 = 0b100 + }; + + // standby durations in ms + enum standby_duration { + STANDBY_MS_0_5 = 0b000, + STANDBY_MS_10 = 0b110, + STANDBY_MS_20 = 0b111, + STANDBY_MS_62_5 = 0b001, + STANDBY_MS_125 = 0b010, + STANDBY_MS_250 = 0b011, + STANDBY_MS_500 = 0b100, + STANDBY_MS_1000 = 0b101 + }; + + // constructors + Adafruit_BME280(void); + Adafruit_BME280(int8_t cspin); + Adafruit_BME280(int8_t cspin, int8_t mosipin, int8_t misopin, int8_t sckpin); + + bool begin(void); + bool begin(TwoWire *theWire); + bool begin(uint8_t addr); + bool begin(uint8_t addr, TwoWire *theWire); + bool init(); + + void setSampling(sensor_mode mode = MODE_NORMAL, + sensor_sampling tempSampling = SAMPLING_X16, + sensor_sampling pressSampling = SAMPLING_X16, + sensor_sampling humSampling = SAMPLING_X16, + sensor_filter filter = FILTER_OFF, + standby_duration duration = STANDBY_MS_0_5 + ); + + void takeForcedMeasurement(); + float readTemperature(void); + float readPressure(void); + float readHumidity(void); + + float readAltitude(float seaLevel); + float seaLevelForAltitude(float altitude, float pressure); + + + private: + TwoWire *_wire; + void readCoefficients(void); + bool isReadingCalibration(void); + uint8_t spixfer(uint8_t x); + + void write8(byte reg, byte value); + uint8_t read8(byte reg); + uint16_t read16(byte reg); + uint32_t read24(byte reg); + int16_t readS16(byte reg); + uint16_t read16_LE(byte reg); // little endian + int16_t readS16_LE(byte reg); // little endian + + uint8_t _i2caddr; + int32_t _sensorID; + int32_t t_fine; + + int8_t _cs, _mosi, _miso, _sck; + + bme280_calib_data _bme280_calib; + + // The config register + struct config { + // inactive duration (standby time) in normal mode + // 000 = 0.5 ms + // 001 = 62.5 ms + // 010 = 125 ms + // 011 = 250 ms + // 100 = 500 ms + // 101 = 1000 ms + // 110 = 10 ms + // 111 = 20 ms + unsigned int t_sb : 3; + + // filter settings + // 000 = filter off + // 001 = 2x filter + // 010 = 4x filter + // 011 = 8x filter + // 100 and above = 16x filter + unsigned int filter : 3; + + // unused - don't set + unsigned int none : 1; + unsigned int spi3w_en : 1; + + unsigned int get() { + return (t_sb << 5) | (filter << 3) | spi3w_en; + } + }; + config _configReg; + + + // The ctrl_meas register + struct ctrl_meas { + // temperature oversampling + // 000 = skipped + // 001 = x1 + // 010 = x2 + // 011 = x4 + // 100 = x8 + // 101 and above = x16 + unsigned int osrs_t : 3; + + // pressure oversampling + // 000 = skipped + // 001 = x1 + // 010 = x2 + // 011 = x4 + // 100 = x8 + // 101 and above = x16 + unsigned int osrs_p : 3; + + // device mode + // 00 = sleep + // 01 or 10 = forced + // 11 = normal + unsigned int mode : 2; + + unsigned int get() { + return (osrs_t << 5) | (osrs_p << 3) | mode; + } + }; + ctrl_meas _measReg; + + + // The ctrl_hum register + struct ctrl_hum { + // unused - don't set + unsigned int none : 5; + + // pressure oversampling + // 000 = skipped + // 001 = x1 + // 010 = x2 + // 011 = x4 + // 100 = x8 + // 101 and above = x16 + unsigned int osrs_h : 3; + + unsigned int get() { + return (osrs_h); + } + }; + ctrl_hum _humReg; +}; + +#endif diff --git a/libraries/Adafruit_BME280_Library/README.md b/libraries/Adafruit_BME280_Library/README.md new file mode 100644 index 0000000..ed49542 --- /dev/null +++ b/libraries/Adafruit_BME280_Library/README.md @@ -0,0 +1,59 @@ +This is a library for the Adafruit BME280 Humidity, Barometric Pressure + Temp sensor + +Designed specifically to work with the Adafruit BME280 Breakout + * http://www.adafruit.com/products/2652 + +These sensors use I2C or SPI to communicate, up to 4 pins are required to interface + +Use of this library also requires [Adafruit_Sensor](https://github.com/adafruit/Adafruit_Sensor) +to be installed on your local system. + +Adafruit invests time and resources providing this open source code, +please support Adafruit and open-source hardware by purchasing +products from Adafruit! + +Check out the links above for our tutorials and wiring diagrams + +Written by Limor Fried/Ladyada for Adafruit Industries. +BSD license, all text above must be included in any redistribution + +To download. click the DOWNLOAD ZIP button, rename the uncompressed folder Adafruit_BME280. +Check that the Adafruit_BME280 folder contains Adafruit_BME280.cpp and Adafruit_BME280.h + +Place the Adafruit_BME280 library folder your arduinosketchfolder/libraries/ folder. +You may need to create the libraries subfolder if its your first library. Restart the IDE. + +We also have a great tutorial on Arduino library installation at: +http://learn.adafruit.com/adafruit-all-about-arduino-libraries-install-use + + +## Compatibility + +MCU | Tested Works | Doesn't Work | Not Tested | Notes +------------------ | :----------: | :----------: | :---------: | ----- +Atmega328 @ 16MHz | X | | | +Atmega328 @ 12MHz | X | | | +Atmega32u4 @ 16MHz | X | | | Use SDA/SCL on pins D2 & D3 +Atmega32u4 @ 8MHz | X | | | Use SDA/SCL on pins D2 & D3 +ESP8266 | X | | | I2C: just works, SPI: SDA/SCL default to pins 4 & 5 but any two pins can be assigned as SDA/SCL using Wire.begin(SDA,SCL) +ESP32 | X | | | I2C: just works, SPI: SDA/SCL default to pins 4 & 5 but any two pins can be assigned as SDA/SCL using Wire.begin(SDA,SCL) +Atmega2560 @ 16MHz | X | | | Use SDA/SCL on pins 20 & 21 +ATSAM3X8E | X | | | Use SDA/SCL on pins 20 & 21 +ATSAM21D | X | | | +ATtiny85 @ 16MHz | | X | | +ATtiny85 @ 8MHz | | X | | +Intel Curie @ 32MHz | | | X | +STM32F2 | | | X | + + * ATmega328 @ 16MHz : Arduino UNO, Adafruit Pro Trinket 5V, Adafruit Metro 328, Adafruit Metro Mini + * ATmega328 @ 12MHz : Adafruit Pro Trinket 3V + * ATmega32u4 @ 16MHz : Arduino Leonardo, Arduino Micro, Arduino Yun, Teensy 2.0 + * ATmega32u4 @ 8MHz : Adafruit Flora, Bluefruit Micro + * ESP8266 : Adafruit Huzzah + * ATmega2560 @ 16MHz : Arduino Mega + * ATSAM3X8E : Arduino Due + * ATSAM21D : Arduino Zero, M0 Pro + * ATtiny85 @ 16MHz : Adafruit Trinket 5V + * ATtiny85 @ 8MHz : Adafruit Gemma, Arduino Gemma, Adafruit Trinket 3V + + diff --git a/libraries/Adafruit_BME280_Library/examples/advancedsettings/advancedsettings.ino b/libraries/Adafruit_BME280_Library/examples/advancedsettings/advancedsettings.ino new file mode 100644 index 0000000..68b22b9 --- /dev/null +++ b/libraries/Adafruit_BME280_Library/examples/advancedsettings/advancedsettings.ino @@ -0,0 +1,157 @@ +/*************************************************************************** + This is a library for the BME280 humidity, temperature & pressure sensor + + Designed specifically to work with the Adafruit BME280 Breakout + ----> http://www.adafruit.com/products/2650 + + These sensors use I2C or SPI to communicate, 2 or 4 pins are required + to interface. The device's I2C address is either 0x76 or 0x77. + + Adafruit invests time and resources providing this open source code, + please support Adafruit andopen-source hardware by purchasing products + from Adafruit! + + Written by Limor Fried & Kevin Townsend for Adafruit Industries. + BSD license, all text above must be included in any redistribution + ***************************************************************************/ + +#include +#include +#include +#include + +#define BME_SCK 13 +#define BME_MISO 12 +#define BME_MOSI 11 +#define BME_CS 10 + +#define SEALEVELPRESSURE_HPA (1013.25) + +Adafruit_BME280 bme; // I2C +//Adafruit_BME280 bme(BME_CS); // hardware SPI +//Adafruit_BME280 bme(BME_CS, BME_MOSI, BME_MISO, BME_SCK); // software SPI + +unsigned long delayTime; + +void setup() { + Serial.begin(9600); + Serial.println(F("BME280 test")); + + if (! bme.begin(&Wire1)) { + Serial.println("Could not find a valid BME280 sensor, check wiring!"); + while (1); + } + + Serial.println("-- Default Test --"); + Serial.println("normal mode, 16x oversampling for all, filter off,"); + Serial.println("0.5ms standby period"); + delayTime = 5000; + + + // For more details on the following scenarious, see chapter + // 3.5 "Recommended modes of operation" in the datasheet + +/* + // weather monitoring + Serial.println("-- Weather Station Scenario --"); + Serial.println("forced mode, 1x temperature / 1x humidity / 1x pressure oversampling,"); + Serial.println("filter off"); + bme.setSampling(Adafruit_BME280::MODE_FORCED, + Adafruit_BME280::SAMPLING_X1, // temperature + Adafruit_BME280::SAMPLING_X1, // pressure + Adafruit_BME280::SAMPLING_X1, // humidity + Adafruit_BME280::FILTER_OFF ); + + // suggested rate is 1/60Hz (1m) + delayTime = 60000; // in milliseconds +*/ + +/* + // humidity sensing + Serial.println("-- Humidity Sensing Scenario --"); + Serial.println("forced mode, 1x temperature / 1x humidity / 0x pressure oversampling"); + Serial.println("= pressure off, filter off"); + bme.setSampling(Adafruit_BME280::MODE_FORCED, + Adafruit_BME280::SAMPLING_X1, // temperature + Adafruit_BME280::SAMPLING_NONE, // pressure + Adafruit_BME280::SAMPLING_X1, // humidity + Adafruit_BME280::FILTER_OFF ); + + // suggested rate is 1Hz (1s) + delayTime = 1000; // in milliseconds +*/ + +/* + // indoor navigation + Serial.println("-- Indoor Navigation Scenario --"); + Serial.println("normal mode, 16x pressure / 2x temperature / 1x humidity oversampling,"); + Serial.println("0.5ms standby period, filter 16x"); + bme.setSampling(Adafruit_BME280::MODE_NORMAL, + Adafruit_BME280::SAMPLING_X2, // temperature + Adafruit_BME280::SAMPLING_X16, // pressure + Adafruit_BME280::SAMPLING_X1, // humidity + Adafruit_BME280::FILTER_X16, + Adafruit_BME280::STANDBY_MS_0_5 ); + + // suggested rate is 25Hz + // 1 + (2 * T_ovs) + (2 * P_ovs + 0.5) + (2 * H_ovs + 0.5) + // T_ovs = 2 + // P_ovs = 16 + // H_ovs = 1 + // = 40ms (25Hz) + // with standby time that should really be 24.16913... Hz + delayTime = 41; + + /* + // gaming + Serial.println("-- Gaming Scenario --"); + Serial.println("normal mode, 4x pressure / 1x temperature / 0x humidity oversampling,"); + Serial.println("= humidity off, 0.5ms standby period, filter 16x"); + bme.setSampling(Adafruit_BME280::MODE_NORMAL, + Adafruit_BME280::SAMPLING_X1, // temperature + Adafruit_BME280::SAMPLING_X4, // pressure + Adafruit_BME280::SAMPLING_NONE, // humidity + Adafruit_BME280::FILTER_X16, + Adafruit_BME280::STANDBY_MS_0_5 ); + + // Suggested rate is 83Hz + // 1 + (2 * T_ovs) + (2 * P_ovs + 0.5) + // T_ovs = 1 + // P_ovs = 4 + // = 11.5ms + 0.5ms standby + delayTime = 12; +*/ + + Serial.println(); +} + + +void loop() { + // Only needed in forced mode! In normal mode, you can remove the next line. + bme.takeForcedMeasurement(); // has no effect in normal mode + + printValues(); + delay(delayTime); +} + + +void printValues() { + Serial.print("Temperature = "); + Serial.print(bme.readTemperature()); + Serial.println(" *C"); + + Serial.print("Pressure = "); + + Serial.print(bme.readPressure() / 100.0F); + Serial.println(" hPa"); + + Serial.print("Approx. Altitude = "); + Serial.print(bme.readAltitude(SEALEVELPRESSURE_HPA)); + Serial.println(" m"); + + Serial.print("Humidity = "); + Serial.print(bme.readHumidity()); + Serial.println(" %"); + + Serial.println(); +} \ No newline at end of file diff --git a/libraries/Adafruit_BME280_Library/examples/bme280test/bme280test.ino b/libraries/Adafruit_BME280_Library/examples/bme280test/bme280test.ino new file mode 100644 index 0000000..e8b5563 --- /dev/null +++ b/libraries/Adafruit_BME280_Library/examples/bme280test/bme280test.ino @@ -0,0 +1,82 @@ +/*************************************************************************** + This is a library for the BME280 humidity, temperature & pressure sensor + + Designed specifically to work with the Adafruit BME280 Breakout + ----> http://www.adafruit.com/products/2650 + + These sensors use I2C or SPI to communicate, 2 or 4 pins are required + to interface. The device's I2C address is either 0x76 or 0x77. + + Adafruit invests time and resources providing this open source code, + please support Adafruit andopen-source hardware by purchasing products + from Adafruit! + + Written by Limor Fried & Kevin Townsend for Adafruit Industries. + BSD license, all text above must be included in any redistribution + ***************************************************************************/ + +#include +#include +#include +#include + +#define BME_SCK 13 +#define BME_MISO 12 +#define BME_MOSI 11 +#define BME_CS 10 + +#define SEALEVELPRESSURE_HPA (1013.25) + +Adafruit_BME280 bme; // I2C +//Adafruit_BME280 bme(BME_CS); // hardware SPI +//Adafruit_BME280 bme(BME_CS, BME_MOSI, BME_MISO, BME_SCK); // software SPI + +unsigned long delayTime; + +void setup() { + Serial.begin(9600); + Serial.println(F("BME280 test")); + + bool status; + + // default settings + // (you can also pass in a Wire library object like &Wire2) + status = bme.begin(); + if (!status) { + Serial.println("Could not find a valid BME280 sensor, check wiring!"); + while (1); + } + + Serial.println("-- Default Test --"); + delayTime = 1000; + + Serial.println(); +} + + +void loop() { + printValues(); + delay(delayTime); +} + + +void printValues() { + Serial.print("Temperature = "); + Serial.print(bme.readTemperature()); + Serial.println(" *C"); + + Serial.print("Pressure = "); + + Serial.print(bme.readPressure() / 100.0F); + Serial.println(" hPa"); + + Serial.print("Approx. Altitude = "); + Serial.print(bme.readAltitude(SEALEVELPRESSURE_HPA)); + Serial.println(" m"); + + Serial.print("Humidity = "); + Serial.print(bme.readHumidity()); + Serial.println(" %"); + + Serial.println(); +} \ No newline at end of file diff --git a/libraries/Adafruit_BME280_Library/library.properties b/libraries/Adafruit_BME280_Library/library.properties new file mode 100644 index 0000000..189c369 --- /dev/null +++ b/libraries/Adafruit_BME280_Library/library.properties @@ -0,0 +1,9 @@ +name=Adafruit BME280 Library +version=1.0.7 +author=Adafruit +maintainer=Adafruit +sentence=Arduino library for BME280 sensors. +paragraph=Arduino library for BME280 humidity and pressure sensors. +category=Sensors +url=https://github.com/adafruit/Adafruit_BME280_Library +architectures=* diff --git a/libraries/Adafruit_BMP085_Library/Adafruit_BMP085.cpp b/libraries/Adafruit_BMP085_Library/Adafruit_BMP085.cpp new file mode 100644 index 0000000..14e7e96 --- /dev/null +++ b/libraries/Adafruit_BMP085_Library/Adafruit_BMP085.cpp @@ -0,0 +1,297 @@ +/*************************************************** + This is a library for the Adafruit BMP085/BMP180 Barometric Pressure + Temp sensor + + Designed specifically to work with the Adafruit BMP085 or BMP180 Breakout + ----> http://www.adafruit.com/products/391 + ----> http://www.adafruit.com/products/1603 + + 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" + +Adafruit_BMP085::Adafruit_BMP085() { +} + + +boolean Adafruit_BMP085::begin(uint8_t mode) { + if (mode > BMP085_ULTRAHIGHRES) + mode = BMP085_ULTRAHIGHRES; + oversampling = mode; + + Wire.begin(); + + if (read8(0xD0) != 0x55) return false; + + /* read calibration data */ + ac1 = read16(BMP085_CAL_AC1); + ac2 = read16(BMP085_CAL_AC2); + ac3 = read16(BMP085_CAL_AC3); + ac4 = read16(BMP085_CAL_AC4); + ac5 = read16(BMP085_CAL_AC5); + ac6 = read16(BMP085_CAL_AC6); + + b1 = read16(BMP085_CAL_B1); + b2 = read16(BMP085_CAL_B2); + + mb = read16(BMP085_CAL_MB); + mc = read16(BMP085_CAL_MC); + md = read16(BMP085_CAL_MD); +#if (BMP085_DEBUG == 1) + Serial.print("ac1 = "); Serial.println(ac1, DEC); + Serial.print("ac2 = "); Serial.println(ac2, DEC); + Serial.print("ac3 = "); Serial.println(ac3, DEC); + Serial.print("ac4 = "); Serial.println(ac4, DEC); + Serial.print("ac5 = "); Serial.println(ac5, DEC); + Serial.print("ac6 = "); Serial.println(ac6, DEC); + + Serial.print("b1 = "); Serial.println(b1, DEC); + Serial.print("b2 = "); Serial.println(b2, DEC); + + Serial.print("mb = "); Serial.println(mb, DEC); + Serial.print("mc = "); Serial.println(mc, DEC); + Serial.print("md = "); Serial.println(md, DEC); +#endif + + return true; +} + +int32_t Adafruit_BMP085::computeB5(int32_t UT) { + int32_t X1 = (UT - (int32_t)ac6) * ((int32_t)ac5) >> 15; + int32_t X2 = ((int32_t)mc << 11) / (X1+(int32_t)md); + return X1 + X2; +} + +uint16_t Adafruit_BMP085::readRawTemperature(void) { + write8(BMP085_CONTROL, BMP085_READTEMPCMD); + delay(5); +#if BMP085_DEBUG == 1 + Serial.print("Raw temp: "); Serial.println(read16(BMP085_TEMPDATA)); +#endif + return read16(BMP085_TEMPDATA); +} + +uint32_t Adafruit_BMP085::readRawPressure(void) { + uint32_t raw; + + write8(BMP085_CONTROL, BMP085_READPRESSURECMD + (oversampling << 6)); + + if (oversampling == BMP085_ULTRALOWPOWER) + delay(5); + else if (oversampling == BMP085_STANDARD) + delay(8); + else if (oversampling == BMP085_HIGHRES) + delay(14); + else + delay(26); + + raw = read16(BMP085_PRESSUREDATA); + + raw <<= 8; + raw |= read8(BMP085_PRESSUREDATA+2); + raw >>= (8 - oversampling); + + /* this pull broke stuff, look at it later? + if (oversampling==0) { + raw <<= 8; + raw |= read8(BMP085_PRESSUREDATA+2); + raw >>= (8 - oversampling); + } + */ + +#if BMP085_DEBUG == 1 + Serial.print("Raw pressure: "); Serial.println(raw); +#endif + return raw; +} + + +int32_t Adafruit_BMP085::readPressure(void) { + int32_t UT, UP, B3, B5, B6, X1, X2, X3, p; + uint32_t B4, B7; + + UT = readRawTemperature(); + UP = readRawPressure(); + +#if BMP085_DEBUG == 1 + // use datasheet numbers! + UT = 27898; + UP = 23843; + ac6 = 23153; + ac5 = 32757; + mc = -8711; + md = 2868; + b1 = 6190; + b2 = 4; + ac3 = -14383; + ac2 = -72; + ac1 = 408; + ac4 = 32741; + oversampling = 0; +#endif + + B5 = computeB5(UT); + +#if BMP085_DEBUG == 1 + Serial.print("X1 = "); Serial.println(X1); + Serial.print("X2 = "); Serial.println(X2); + Serial.print("B5 = "); Serial.println(B5); +#endif + + // do pressure calcs + B6 = B5 - 4000; + X1 = ((int32_t)b2 * ( (B6 * B6)>>12 )) >> 11; + X2 = ((int32_t)ac2 * B6) >> 11; + X3 = X1 + X2; + B3 = ((((int32_t)ac1*4 + X3) << oversampling) + 2) / 4; + +#if BMP085_DEBUG == 1 + Serial.print("B6 = "); Serial.println(B6); + Serial.print("X1 = "); Serial.println(X1); + Serial.print("X2 = "); Serial.println(X2); + Serial.print("B3 = "); Serial.println(B3); +#endif + + X1 = ((int32_t)ac3 * B6) >> 13; + X2 = ((int32_t)b1 * ((B6 * B6) >> 12)) >> 16; + X3 = ((X1 + X2) + 2) >> 2; + B4 = ((uint32_t)ac4 * (uint32_t)(X3 + 32768)) >> 15; + B7 = ((uint32_t)UP - B3) * (uint32_t)( 50000UL >> oversampling ); + +#if BMP085_DEBUG == 1 + Serial.print("X1 = "); Serial.println(X1); + Serial.print("X2 = "); Serial.println(X2); + Serial.print("B4 = "); Serial.println(B4); + Serial.print("B7 = "); Serial.println(B7); +#endif + + if (B7 < 0x80000000) { + p = (B7 * 2) / B4; + } else { + p = (B7 / B4) * 2; + } + X1 = (p >> 8) * (p >> 8); + X1 = (X1 * 3038) >> 16; + X2 = (-7357 * p) >> 16; + +#if BMP085_DEBUG == 1 + Serial.print("p = "); Serial.println(p); + Serial.print("X1 = "); Serial.println(X1); + Serial.print("X2 = "); Serial.println(X2); +#endif + + p = p + ((X1 + X2 + (int32_t)3791)>>4); +#if BMP085_DEBUG == 1 + Serial.print("p = "); Serial.println(p); +#endif + return p; +} + +int32_t Adafruit_BMP085::readSealevelPressure(float altitude_meters) { + float pressure = readPressure(); + return (int32_t)(pressure / pow(1.0-altitude_meters/44330, 5.255)); +} + +float Adafruit_BMP085::readTemperature(void) { + int32_t UT, B5; // following ds convention + float temp; + + UT = readRawTemperature(); + +#if BMP085_DEBUG == 1 + // use datasheet numbers! + UT = 27898; + ac6 = 23153; + ac5 = 32757; + mc = -8711; + md = 2868; +#endif + + B5 = computeB5(UT); + temp = (B5+8) >> 4; + temp /= 10; + + return temp; +} + +float Adafruit_BMP085::readAltitude(float sealevelPressure) { + float altitude; + + float pressure = readPressure(); + + altitude = 44330 * (1.0 - pow(pressure /sealevelPressure,0.1903)); + + return altitude; +} + + +/*********************************************************************/ + +uint8_t Adafruit_BMP085::read8(uint8_t a) { + uint8_t ret; + + Wire.beginTransmission(BMP085_I2CADDR); // start transmission to device +#if (ARDUINO >= 100) + Wire.write(a); // sends register address to read from +#else + Wire.send(a); // sends register address to read from +#endif + Wire.endTransmission(); // end transmission + + Wire.beginTransmission(BMP085_I2CADDR); // start transmission to device + Wire.requestFrom(BMP085_I2CADDR, 1);// send data n-bytes read +#if (ARDUINO >= 100) + ret = Wire.read(); // receive DATA +#else + ret = Wire.receive(); // receive DATA +#endif + Wire.endTransmission(); // end transmission + + return ret; +} + +uint16_t Adafruit_BMP085::read16(uint8_t a) { + uint16_t ret; + + Wire.beginTransmission(BMP085_I2CADDR); // start transmission to device +#if (ARDUINO >= 100) + Wire.write(a); // sends register address to read from +#else + Wire.send(a); // sends register address to read from +#endif + Wire.endTransmission(); // end transmission + + Wire.beginTransmission(BMP085_I2CADDR); // start transmission to device + Wire.requestFrom(BMP085_I2CADDR, 2);// send data n-bytes read +#if (ARDUINO >= 100) + ret = Wire.read(); // receive DATA + ret <<= 8; + ret |= Wire.read(); // receive DATA +#else + ret = Wire.receive(); // receive DATA + ret <<= 8; + ret |= Wire.receive(); // receive DATA +#endif + Wire.endTransmission(); // end transmission + + return ret; +} + +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 + Wire.write(d); // write data +#else + Wire.send(a); // sends register address to read from + Wire.send(d); // write data +#endif + Wire.endTransmission(); // end transmission +} diff --git a/libraries/Adafruit_BMP085_Library/Adafruit_BMP085.h b/libraries/Adafruit_BMP085_Library/Adafruit_BMP085.h new file mode 100644 index 0000000..d91b7b1 --- /dev/null +++ b/libraries/Adafruit_BMP085_Library/Adafruit_BMP085.h @@ -0,0 +1,79 @@ +/*************************************************** + This is a library for the Adafruit BMP085/BMP180 Barometric Pressure + Temp sensor + + Designed specifically to work with the Adafruit BMP085 or BMP180 Breakout + ----> http://www.adafruit.com/products/391 + ----> http://www.adafruit.com/products/1603 + + 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 + ****************************************************/ + +#ifndef ADAFRUIT_BMP085_H +#define ADAFRUIT_BMP085_H + +#if (ARDUINO >= 100) + #include "Arduino.h" +#else + #include "WProgram.h" +#endif +#include "Wire.h" + +#define BMP085_DEBUG 0 + +#define BMP085_I2CADDR 0x77 + +#define BMP085_ULTRALOWPOWER 0 +#define BMP085_STANDARD 1 +#define BMP085_HIGHRES 2 +#define BMP085_ULTRAHIGHRES 3 +#define BMP085_CAL_AC1 0xAA // R Calibration data (16 bits) +#define BMP085_CAL_AC2 0xAC // R Calibration data (16 bits) +#define BMP085_CAL_AC3 0xAE // R Calibration data (16 bits) +#define BMP085_CAL_AC4 0xB0 // R Calibration data (16 bits) +#define BMP085_CAL_AC5 0xB2 // R Calibration data (16 bits) +#define BMP085_CAL_AC6 0xB4 // R Calibration data (16 bits) +#define BMP085_CAL_B1 0xB6 // R Calibration data (16 bits) +#define BMP085_CAL_B2 0xB8 // R Calibration data (16 bits) +#define BMP085_CAL_MB 0xBA // R Calibration data (16 bits) +#define BMP085_CAL_MC 0xBC // R Calibration data (16 bits) +#define BMP085_CAL_MD 0xBE // R Calibration data (16 bits) + +#define BMP085_CONTROL 0xF4 +#define BMP085_TEMPDATA 0xF6 +#define BMP085_PRESSUREDATA 0xF6 +#define BMP085_READTEMPCMD 0x2E +#define BMP085_READPRESSURECMD 0x34 + + +class Adafruit_BMP085 { + public: + Adafruit_BMP085(); + boolean begin(uint8_t mode = BMP085_ULTRAHIGHRES); // by default go highres + float readTemperature(void); + int32_t readPressure(void); + int32_t readSealevelPressure(float altitude_meters = 0); + float readAltitude(float sealevelPressure = 101325); // std atmosphere + uint16_t readRawTemperature(void); + uint32_t readRawPressure(void); + + private: + int32_t computeB5(int32_t UT); + uint8_t read8(uint8_t addr); + uint16_t read16(uint8_t addr); + void write8(uint8_t addr, uint8_t data); + + uint8_t oversampling; + + int16_t ac1, ac2, ac3, b1, b2, mb, mc, md; + uint16_t ac4, ac5, ac6; +}; + + +#endif // ADAFRUIT_BMP085_H diff --git a/libraries/Adafruit_BMP085_Library/README.txt b/libraries/Adafruit_BMP085_Library/README.txt new file mode 100644 index 0000000..0a465b7 --- /dev/null +++ b/libraries/Adafruit_BMP085_Library/README.txt @@ -0,0 +1,28 @@ +This is a library for the Adafruit BMP085/BMP180 Barometric Pressure + Temp sensor + +Designed specifically to work with the Adafruit BMP085 or BMP180 Breakout + ----> http://www.adafruit.com/products/391 + ----> http://www.adafruit.com/products/1603 + +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! + +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 DOWNLOAD ZIP button, 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. + +We also have a great tutorial on Arduino library installation at: +http://learn.adafruit.com/adafruit-all-about-arduino-libraries-install-use \ No newline at end of file diff --git a/libraries/Adafruit_BMP085_Library/examples/BMP085test/BMP085test.ino b/libraries/Adafruit_BMP085_Library/examples/BMP085test/BMP085test.ino new file mode 100644 index 0000000..308fa30 --- /dev/null +++ b/libraries/Adafruit_BMP085_Library/examples/BMP085test/BMP085test.ino @@ -0,0 +1,66 @@ +#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 +// Connect SCL to i2c clock - on '168/'328 Arduino Uno/Duemilanove/etc thats Analog 5 +// Connect SDA to i2c data - on '168/'328 Arduino Uno/Duemilanove/etc thats Analog 4 +// EOC is not used, it signifies an end of conversion +// XCLR is a reset pin, also not used here + +Adafruit_BMP085 bmp; + +void setup() { + Serial.begin(9600); + if (!bmp.begin()) { + Serial.println("Could not find a valid BMP085 sensor, check wiring!"); + while (1) {} + } +} + +void loop() { + Serial.print("Temperature = "); + Serial.print(bmp.readTemperature()); + Serial.println(" *C"); + + Serial.print("Pressure = "); + Serial.print(bmp.readPressure()); + Serial.println(" Pa"); + + // Calculate altitude assuming 'standard' barometric + // pressure of 1013.25 millibar = 101325 Pascal + Serial.print("Altitude = "); + Serial.print(bmp.readAltitude()); + Serial.println(" meters"); + + Serial.print("Pressure at sealevel (calculated) = "); + Serial.print(bmp.readSealevelPressure()); + Serial.println(" Pa"); + + // you can get a more precise measurement of altitude + // if you know the current sea level pressure which will + // vary with weather and such. If it is 1015 millibars + // that is equal to 101500 Pascals. + Serial.print("Real altitude = "); + Serial.print(bmp.readAltitude(101500)); + Serial.println(" meters"); + + Serial.println(); + delay(500); +} \ No newline at end of file diff --git a/libraries/Adafruit_BMP085_Library/library.properties b/libraries/Adafruit_BMP085_Library/library.properties new file mode 100644 index 0000000..dd151a5 --- /dev/null +++ b/libraries/Adafruit_BMP085_Library/library.properties @@ -0,0 +1,9 @@ +name=Adafruit BMP085 Library +version=1.0.0 +author=Adafruit +maintainer=Adafruit +sentence=A powerful but easy to use BMP085/BMP180 Library +paragraph=A powerful but easy to use BMP085/BMP180 Library +category=Sensors +url=https://github.com/adafruit/Adafruit-BMP085-Library +architectures=* diff --git a/libraries/Adafruit_BMP280_Library/Adafruit_BMP280.cpp b/libraries/Adafruit_BMP280_Library/Adafruit_BMP280.cpp new file mode 100644 index 0000000..bd0ea7f --- /dev/null +++ b/libraries/Adafruit_BMP280_Library/Adafruit_BMP280.cpp @@ -0,0 +1,326 @@ +/*************************************************************************** + This is a library for the BMP280 pressure sensor + + Designed specifically to work with the Adafruit BMP280 Breakout + ----> http://www.adafruit.com/products/2651 + + These sensors use I2C to communicate, 2 pins are required to interface. + + Adafruit invests time and resources providing this open source code, + please support Adafruit andopen-source hardware by purchasing products + from Adafruit! + + Written by Kevin Townsend for Adafruit Industries. + BSD license, all text above must be included in any redistribution + ***************************************************************************/ +#include "Arduino.h" +#include +#include +#include "Adafruit_BMP280.h" + + +/*************************************************************************** + PRIVATE FUNCTIONS + ***************************************************************************/ + + +Adafruit_BMP280::Adafruit_BMP280() + : _cs(-1), _mosi(-1), _miso(-1), _sck(-1) +{ } + +Adafruit_BMP280::Adafruit_BMP280(int8_t cspin) + : _cs(cspin), _mosi(-1), _miso(-1), _sck(-1) +{ } + +Adafruit_BMP280::Adafruit_BMP280(int8_t cspin, int8_t mosipin, int8_t misopin, int8_t sckpin) + : _cs(cspin), _mosi(mosipin), _miso(misopin), _sck(sckpin) +{ } + + +bool Adafruit_BMP280::begin(uint8_t a) { + _i2caddr = a; + + if (_cs == -1) { + // i2c + Wire.begin(); + } else { + digitalWrite(_cs, HIGH); + pinMode(_cs, OUTPUT); + + if (_sck == -1) { + // hardware SPI + SPI.begin(); + } else { + // software SPI + pinMode(_sck, OUTPUT); + pinMode(_mosi, OUTPUT); + pinMode(_miso, INPUT); + } + } + + if (read8(BMP280_REGISTER_CHIPID) != 0x58) + return false; + + readCoefficients(); + write8(BMP280_REGISTER_CONTROL, 0x3F); + return true; +} + +uint8_t Adafruit_BMP280::spixfer(uint8_t x) { + if (_sck == -1) + return SPI.transfer(x); + + // software spi + //Serial.println("Software SPI"); + uint8_t reply = 0; + for (int i=7; i>=0; i--) { + reply <<= 1; + digitalWrite(_sck, LOW); + digitalWrite(_mosi, x & (1<> 8) | (temp << 8); + +} + +/**************************************************************************/ +/*! + @brief Reads a signed 16 bit value over I2C +*/ +/**************************************************************************/ +int16_t Adafruit_BMP280::readS16(byte reg) +{ + return (int16_t)read16(reg); + +} + +int16_t Adafruit_BMP280::readS16_LE(byte reg) +{ + return (int16_t)read16_LE(reg); + +} + + +/**************************************************************************/ +/*! + @brief Reads a signed 16 bit value over I2C +*/ +/**************************************************************************/ + +uint32_t Adafruit_BMP280::read24(byte reg) +{ + uint32_t value; + + if (_cs == -1) { + Wire.beginTransmission((uint8_t)_i2caddr); + Wire.write((uint8_t)reg); + Wire.endTransmission(); + Wire.requestFrom((uint8_t)_i2caddr, (byte)3); + + value = Wire.read(); + value <<= 8; + value |= Wire.read(); + value <<= 8; + value |= Wire.read(); + + } else { + if (_sck == -1) + SPI.beginTransaction(SPISettings(500000, MSBFIRST, SPI_MODE0)); + digitalWrite(_cs, LOW); + spixfer(reg | 0x80); // read, bit 7 high + + value = spixfer(0); + value <<= 8; + value |= spixfer(0); + value <<= 8; + value |= spixfer(0); + + digitalWrite(_cs, HIGH); + if (_sck == -1) + SPI.endTransaction(); // release the SPI bus + } + + return value; +} + +/**************************************************************************/ +/*! + @brief Reads the factory-set coefficients +*/ +/**************************************************************************/ +void Adafruit_BMP280::readCoefficients(void) +{ + _bmp280_calib.dig_T1 = read16_LE(BMP280_REGISTER_DIG_T1); + _bmp280_calib.dig_T2 = readS16_LE(BMP280_REGISTER_DIG_T2); + _bmp280_calib.dig_T3 = readS16_LE(BMP280_REGISTER_DIG_T3); + + _bmp280_calib.dig_P1 = read16_LE(BMP280_REGISTER_DIG_P1); + _bmp280_calib.dig_P2 = readS16_LE(BMP280_REGISTER_DIG_P2); + _bmp280_calib.dig_P3 = readS16_LE(BMP280_REGISTER_DIG_P3); + _bmp280_calib.dig_P4 = readS16_LE(BMP280_REGISTER_DIG_P4); + _bmp280_calib.dig_P5 = readS16_LE(BMP280_REGISTER_DIG_P5); + _bmp280_calib.dig_P6 = readS16_LE(BMP280_REGISTER_DIG_P6); + _bmp280_calib.dig_P7 = readS16_LE(BMP280_REGISTER_DIG_P7); + _bmp280_calib.dig_P8 = readS16_LE(BMP280_REGISTER_DIG_P8); + _bmp280_calib.dig_P9 = readS16_LE(BMP280_REGISTER_DIG_P9); +} + +/**************************************************************************/ +/*! + +*/ +/**************************************************************************/ +float Adafruit_BMP280::readTemperature(void) +{ + int32_t var1, var2; + + int32_t adc_T = read24(BMP280_REGISTER_TEMPDATA); + adc_T >>= 4; + + var1 = ((((adc_T>>3) - ((int32_t)_bmp280_calib.dig_T1 <<1))) * + ((int32_t)_bmp280_calib.dig_T2)) >> 11; + + var2 = (((((adc_T>>4) - ((int32_t)_bmp280_calib.dig_T1)) * + ((adc_T>>4) - ((int32_t)_bmp280_calib.dig_T1))) >> 12) * + ((int32_t)_bmp280_calib.dig_T3)) >> 14; + + t_fine = var1 + var2; + + float T = (t_fine * 5 + 128) >> 8; + return T/100; +} + +/**************************************************************************/ +/*! + +*/ +/**************************************************************************/ +float Adafruit_BMP280::readPressure(void) { + int64_t var1, var2, p; + + // Must be done first to get the t_fine variable set up + readTemperature(); + + int32_t adc_P = read24(BMP280_REGISTER_PRESSUREDATA); + adc_P >>= 4; + + var1 = ((int64_t)t_fine) - 128000; + var2 = var1 * var1 * (int64_t)_bmp280_calib.dig_P6; + var2 = var2 + ((var1*(int64_t)_bmp280_calib.dig_P5)<<17); + var2 = var2 + (((int64_t)_bmp280_calib.dig_P4)<<35); + var1 = ((var1 * var1 * (int64_t)_bmp280_calib.dig_P3)>>8) + + ((var1 * (int64_t)_bmp280_calib.dig_P2)<<12); + var1 = (((((int64_t)1)<<47)+var1))*((int64_t)_bmp280_calib.dig_P1)>>33; + + if (var1 == 0) { + return 0; // avoid exception caused by division by zero + } + p = 1048576 - adc_P; + p = (((p<<31) - var2)*3125) / var1; + var1 = (((int64_t)_bmp280_calib.dig_P9) * (p>>13) * (p>>13)) >> 25; + var2 = (((int64_t)_bmp280_calib.dig_P8) * p) >> 19; + + p = ((p + var1 + var2) >> 8) + (((int64_t)_bmp280_calib.dig_P7)<<4); + return (float)p/256; +} + +float Adafruit_BMP280::readAltitude(float seaLevelhPa) { + float altitude; + + float pressure = readPressure(); // in Si units for Pascal + pressure /= 100; + + altitude = 44330 * (1.0 - pow(pressure / seaLevelhPa, 0.1903)); + + return altitude; +} diff --git a/libraries/Adafruit_BMP280_Library/Adafruit_BMP280.h b/libraries/Adafruit_BMP280_Library/Adafruit_BMP280.h new file mode 100644 index 0000000..b0e887f --- /dev/null +++ b/libraries/Adafruit_BMP280_Library/Adafruit_BMP280.h @@ -0,0 +1,157 @@ +/*************************************************************************** + This is a library for the BMP280 pressure sensor + + Designed specifically to work with the Adafruit BMP280 Breakout + ----> http://www.adafruit.com/products/2651 + + These sensors use I2C to communicate, 2 pins are required to interface. + + Adafruit invests time and resources providing this open source code, + please support Adafruit andopen-source hardware by purchasing products + from Adafruit! + + Written by Kevin Townsend for Adafruit Industries. + BSD license, all text above must be included in any redistribution + ***************************************************************************/ +#ifndef __BMP280_H__ +#define __BMP280_H__ + +#if (ARDUINO >= 100) + #include "Arduino.h" +#else + #include "WProgram.h" +#endif + +#include + +#ifdef __AVR_ATtiny85__ + #include "TinyWireM.h" + #define Wire TinyWireM +#else + #include +#endif + +/*========================================================================= + I2C ADDRESS/BITS + -----------------------------------------------------------------------*/ + #define BMP280_ADDRESS (0x77) +/*=========================================================================*/ + +/*========================================================================= + REGISTERS + -----------------------------------------------------------------------*/ + enum + { + BMP280_REGISTER_DIG_T1 = 0x88, + BMP280_REGISTER_DIG_T2 = 0x8A, + BMP280_REGISTER_DIG_T3 = 0x8C, + + BMP280_REGISTER_DIG_P1 = 0x8E, + BMP280_REGISTER_DIG_P2 = 0x90, + BMP280_REGISTER_DIG_P3 = 0x92, + BMP280_REGISTER_DIG_P4 = 0x94, + BMP280_REGISTER_DIG_P5 = 0x96, + BMP280_REGISTER_DIG_P6 = 0x98, + BMP280_REGISTER_DIG_P7 = 0x9A, + BMP280_REGISTER_DIG_P8 = 0x9C, + BMP280_REGISTER_DIG_P9 = 0x9E, + + BMP280_REGISTER_CHIPID = 0xD0, + BMP280_REGISTER_VERSION = 0xD1, + BMP280_REGISTER_SOFTRESET = 0xE0, + + BMP280_REGISTER_CAL26 = 0xE1, // R calibration stored in 0xE1-0xF0 + + BMP280_REGISTER_CONTROL = 0xF4, + BMP280_REGISTER_CONFIG = 0xF5, + BMP280_REGISTER_PRESSUREDATA = 0xF7, + BMP280_REGISTER_TEMPDATA = 0xFA, + }; + +/*=========================================================================*/ + +/*========================================================================= + CALIBRATION DATA + -----------------------------------------------------------------------*/ + typedef struct + { + uint16_t dig_T1; + int16_t dig_T2; + int16_t dig_T3; + + uint16_t dig_P1; + int16_t dig_P2; + int16_t dig_P3; + int16_t dig_P4; + int16_t dig_P5; + int16_t dig_P6; + int16_t dig_P7; + int16_t dig_P8; + int16_t dig_P9; + + uint8_t dig_H1; + int16_t dig_H2; + uint8_t dig_H3; + int16_t dig_H4; + int16_t dig_H5; + int8_t dig_H6; + } bmp280_calib_data; +/*=========================================================================*/ + +/* +class Adafruit_BMP280_Unified : public Adafruit_Sensor +{ + public: + Adafruit_BMP280_Unified(int32_t sensorID = -1); + + bool begin(uint8_t addr = BMP280_ADDRESS); + void getTemperature(float *temp); + void getPressure(float *pressure); + float pressureToAltitude(float seaLevel, float atmospheric, float temp); + float seaLevelForAltitude(float altitude, float atmospheric, float temp); + void getEvent(sensors_event_t*); + void getSensor(sensor_t*); + + private: + uint8_t _i2c_addr; + int32_t _sensorID; +}; + +*/ + +class Adafruit_BMP280 +{ + public: + Adafruit_BMP280(void); + Adafruit_BMP280(int8_t cspin); + Adafruit_BMP280(int8_t cspin, int8_t mosipin, int8_t misopin, int8_t sckpin); + + bool begin(uint8_t addr = BMP280_ADDRESS); + float readTemperature(void); + float readPressure(void); + float readAltitude(float seaLevelhPa = 1013.25); + + private: + + void readCoefficients(void); + uint8_t spixfer(uint8_t x); + + void write8(byte reg, byte value); + uint8_t read8(byte reg); + uint16_t read16(byte reg); + uint32_t read24(byte reg); + int16_t readS16(byte reg); + uint16_t read16_LE(byte reg); // little endian + int16_t readS16_LE(byte reg); // little endian + + uint8_t _i2caddr; + int32_t _sensorID; + int32_t t_fine; + + int8_t _cs, _mosi, _miso, _sck; + + bmp280_calib_data _bmp280_calib; + +}; + +#endif diff --git a/libraries/Adafruit_BMP280_Library/README.md b/libraries/Adafruit_BMP280_Library/README.md new file mode 100644 index 0000000..002f8ca --- /dev/null +++ b/libraries/Adafruit_BMP280_Library/README.md @@ -0,0 +1,43 @@ +#Adafruit BMP280 Driver (Barometric Pressure Sensor) # + +This driver is for the Adafruit BMP280 Breakout (http://www.adafruit.com/products/2651) + +## About the BMP280 ## + +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! + +## About this Driver ## + +Adafruit invests time and resources providing this open source code. Please support Adafruit and open-source hardware by purchasing products from Adafruit! + +Written by Kevin (KTOWN) Townsend for Adafruit Industries. + + + +## Compatibility + +MCU | Tested Works | Doesn't Work | Not Tested | Notes +----------------- | :----------: | :----------: | :---------: | ----- +Atmega328 @ 16MHz | X | | | +Atmega328 @ 12MHz | X | | | +Atmega32u4 @ 16MHz | X | | | Use SDA/SCL on pins D2 & D3 +Atmega32u4 @ 8MHz | X | | | Use SDA/SCL on pins D2 & D3 +ESP8266 | X | | | SDA/SCL default to pins 4 & 5 but any two pins can be assigned as SDA/SCL using Wire.begin(SDA,SCL) +Atmega2560 @ 16MHz | X | | | Use SDA/SCL on pins 20 & 21 +ATSAM3X8E | X | | | Use SDA/SCL on pins 20 & 21 +ATSAM21D | X | | | +ATtiny85 @ 16MHz | | | X | +ATtiny85 @ 8MHz | | | X | + + * ATmega328 @ 16MHz : Arduino UNO, Adafruit Pro Trinket 5V, Adafruit Metro 328, Adafruit Metro Mini + * ATmega328 @ 12MHz : Adafruit Pro Trinket 3V + * ATmega32u4 @ 16MHz : Arduino Leonardo, Arduino Micro, Arduino Yun, Teensy 2.0 + * ATmega32u4 @ 8MHz : Adafruit Flora, Bluefruit Micro + * ESP8266 : Adafruit Huzzah + * ATmega2560 @ 16MHz : Arduino Mega + * ATSAM3X8E : Arduino Due + * ATSAM21D : Arduino Zero, M0 Pro + * ATtiny85 @ 16MHz : Adafruit Trinket 5V + * ATtiny85 @ 8MHz : Adafruit Gemma, Arduino Gemma, Adafruit Trinket 3V + + diff --git a/libraries/Adafruit_BMP280_Library/examples/bmp280test/bmp280test.ino b/libraries/Adafruit_BMP280_Library/examples/bmp280test/bmp280test.ino new file mode 100644 index 0000000..719ea2d --- /dev/null +++ b/libraries/Adafruit_BMP280_Library/examples/bmp280test/bmp280test.ino @@ -0,0 +1,57 @@ +/*************************************************************************** + This is a library for the BMP280 humidity, temperature & pressure sensor + + Designed specifically to work with the Adafruit BMEP280 Breakout + ----> http://www.adafruit.com/products/2651 + + These sensors use I2C or SPI to communicate, 2 or 4 pins are required + to interface. + + Adafruit invests time and resources providing this open source code, + please support Adafruit andopen-source hardware by purchasing products + from Adafruit! + + Written by Limor Fried & Kevin Townsend for Adafruit Industries. + BSD license, all text above must be included in any redistribution + ***************************************************************************/ + +#include +#include +#include +#include + +#define BMP_SCK 13 +#define BMP_MISO 12 +#define BMP_MOSI 11 +#define BMP_CS 10 + +Adafruit_BMP280 bme; // I2C +//Adafruit_BMP280 bme(BMP_CS); // hardware SPI +//Adafruit_BMP280 bme(BMP_CS, BMP_MOSI, BMP_MISO, BMP_SCK); + +void setup() { + Serial.begin(9600); + Serial.println(F("BMP280 test")); + + if (!bme.begin()) { + Serial.println("Could not find a valid BMP280 sensor, check wiring!"); + while (1); + } +} + +void loop() { + Serial.print("Temperature = "); + Serial.print(bme.readTemperature()); + Serial.println(" *C"); + + Serial.print("Pressure = "); + Serial.print(bme.readPressure()); + Serial.println(" Pa"); + + Serial.print("Approx altitude = "); + Serial.print(bme.readAltitude(1013.25)); // this should be adjusted to your local forcase + Serial.println(" m"); + + Serial.println(); + delay(2000); +} \ No newline at end of file diff --git a/libraries/Adafruit_BMP280_Library/library.properties b/libraries/Adafruit_BMP280_Library/library.properties new file mode 100644 index 0000000..337758d --- /dev/null +++ b/libraries/Adafruit_BMP280_Library/library.properties @@ -0,0 +1,9 @@ +name=Adafruit BMP280 Library +version=1.0.2 +author=Adafruit +maintainer=Adafruit +sentence=Arduino library for BMP280 sensors. +paragraph=Arduino library for BMP280 pressure and altitude sensors. +category=Sensors +url=https://github.com/adafruit/Adafruit_BMP280_Library +architectures=* diff --git a/libraries/Adafruit_Circuit_Playground/Adafruit_CircuitPlayground.cpp b/libraries/Adafruit_Circuit_Playground/Adafruit_CircuitPlayground.cpp new file mode 100644 index 0000000..377e439 --- /dev/null +++ b/libraries/Adafruit_Circuit_Playground/Adafruit_CircuitPlayground.cpp @@ -0,0 +1,369 @@ +/*! + * @file Adafruit_CircuitPlayground.cpp + * + * @mainpage Adafruit CircuitPlayground Library + * + * @section intro_sec Introduction + * + * This is the documentation for Adafruit's CircuitPlayground driver for the + * Arduino platform. It is designed specifically to work with the + * Adafruit CircuitPlayground boards: + * - https://www.adafruit.com/products/3000 + * - https://www.adafruit.com/products/3333 + * + * + * Adafruit invests time and resources providing this open source code, + * please support Adafruit and open-source hardware by purchasing + * products from Adafruit! + * + * + * @section author Author + * + * Written by Ladyada and others for Adafruit Industries. + * + * @section license License + * + * BSD license, all text here must be included in any redistribution. + * + */ + +#include + +/**************************************************************************/ +/*! + @brief Set up the CircuitPlayground hardware + @param brightness Optional brightness to set the neopixels to + @returns True if device is set up, false on any failure +*/ +/**************************************************************************/ +boolean Adafruit_CircuitPlayground::begin(uint8_t brightness) { + pinMode(CPLAY_REDLED, OUTPUT); + pinMode(CPLAY_BUZZER, OUTPUT); +#ifdef __AVR__ + pinMode(CPLAY_CAPSENSE_SHARED, OUTPUT); + pinMode(CPLAY_LEFTBUTTON, INPUT); + pinMode(CPLAY_RIGHTBUTTON, INPUT); + pinMode(CPLAY_SLIDESWITCHPIN, INPUT); +#else // Circuit Playground Express + pinMode(CPLAY_LEFTBUTTON, INPUT_PULLDOWN); + pinMode(CPLAY_RIGHTBUTTON, INPUT_PULLDOWN); + pinMode(CPLAY_SLIDESWITCHPIN, INPUT_PULLUP); + irReceiver=IRrecvPCI(CPLAY_IR_RECEIVER); + irDecoder=IRdecode(); +#endif + + + strip = Adafruit_CPlay_NeoPixel(); + strip.updateType(NEO_GRB + NEO_KHZ800); + strip.updateLength(10); + strip.setPin(CPLAY_NEOPIXELPIN); + + lis = Adafruit_CPlay_LIS3DH(CPLAY_LIS3DH_CS); + mic = Adafruit_CPlay_Mic(); + + speaker.begin(); + + strip.begin(); + strip.show(); // Initialize all pixels to 'off' + strip.setBrightness(brightness); + +#ifdef __AVR__ + cap[0] = CPlay_CapacitiveSensor(CPLAY_CAPSENSE_SHARED, 0); + cap[1] = CPlay_CapacitiveSensor(CPLAY_CAPSENSE_SHARED, 1); + cap[2] = CPlay_CapacitiveSensor(CPLAY_CAPSENSE_SHARED, 2); + cap[3] = CPlay_CapacitiveSensor(CPLAY_CAPSENSE_SHARED, 3); + cap[4] = CPlay_CapacitiveSensor(CPLAY_CAPSENSE_SHARED, 6); + cap[5] = CPlay_CapacitiveSensor(CPLAY_CAPSENSE_SHARED, 9); + cap[6] = CPlay_CapacitiveSensor(CPLAY_CAPSENSE_SHARED, 10); + cap[7] = CPlay_CapacitiveSensor(CPLAY_CAPSENSE_SHARED, 12); +#else // Circuit Playground Express // Circuit Playground Express + for(int i=0; i<7; i++) { + cap[i] = Adafruit_CPlay_FreeTouch(A1+i, OVERSAMPLE_4, RESISTOR_50K, FREQ_MODE_NONE); + if (! cap[i].begin()) return false; + } +#endif + + return lis.begin(CPLAY_LIS3DH_ADDRESS); +} + +/**************************************************************************/ +/*! + @brief read capacitive touch sensor + @param p the pin to read. Must be a captouch enabled pin. + @param samples Optional number of samples to take. Defaults to 10. + @returns measured captouch value +*/ +/**************************************************************************/ +uint16_t Adafruit_CircuitPlayground::readCap(uint8_t p, uint8_t samples) { +#ifdef __AVR__ // Circuit Playground Classic + switch (p) { + case 0: return cap[0].capacitiveSensor(samples); + case 1: return cap[1].capacitiveSensor(samples); + case 2: return cap[2].capacitiveSensor(samples); + case 3: return cap[3].capacitiveSensor(samples); + case 6: return cap[4].capacitiveSensor(samples); + case 9: return cap[5].capacitiveSensor(samples); + case 10: return cap[6].capacitiveSensor(samples); + case 12: return cap[7].capacitiveSensor(samples); + default: return 0; + } +#else // Circuit Playground Express // Circuit Playground Express + // analog pins r ez! + if ((p >= A1) && (p <= A7)) { + return cap[p - A1].measure(); + } + // oof digital pins + switch (p) { + case 0: return cap[A6 - A1].measure(); + case 1: return cap[A7 - A1].measure(); + case 2: return cap[A5 - A1].measure(); + case 3: return cap[A4 - A1].measure(); + case 6: return cap[A1 - A1].measure(); + case 9: return cap[A2 - A1].measure(); + case 10: return cap[A3 - A1].measure(); + default: return 0; + } +#endif +} + +/**************************************************************************/ +/*! + @brief turn on or off the red LED on pin #13 + @param v pass true to turn LED on, false to turn LED off +*/ +/**************************************************************************/ +void Adafruit_CircuitPlayground::redLED(boolean v) { + digitalWrite(CPLAY_REDLED, v); +} + +/**************************************************************************/ +/*! + @brief read the slide switch + @returns true if slide switch in set, false if not +*/ +/**************************************************************************/ +boolean Adafruit_CircuitPlayground::slideSwitch(void) { + return digitalRead(CPLAY_SLIDESWITCHPIN); +} + +/**************************************************************************/ +/*! + @brief read the left button + @returns true if button is pressed, false if not +*/ +/**************************************************************************/ +boolean Adafruit_CircuitPlayground::leftButton(void) { + return digitalRead(CPLAY_LEFTBUTTON); +} + +/**************************************************************************/ +/*! + @brief read the right button + @returns true if button is pressed, false if not +*/ +/**************************************************************************/ +boolean Adafruit_CircuitPlayground::rightButton(void) { + return digitalRead(CPLAY_RIGHTBUTTON); +} + +/**************************************************************************/ +/*! + @brief play a tone on the onboard buzzer + @param freq the frequency to play + @param time the duration of the tone in milliseconds + @param wait Optional flag to wait for time milliseconds after playing the tone. Defaults to true. + @note The driver circuitry is an on/off transistor driver, so you will only be able to play square waves. + It is also not the same loudness over all frequencies but is designed to be the loudest at around 4 KHz +*/ +/**************************************************************************/ +void Adafruit_CircuitPlayground::playTone(uint16_t freq, uint16_t time, boolean wait) { + tone(CPLAY_BUZZER, freq, time); + if (wait) delay(time); +} + +/**************************************************************************/ +/*! + @brief read the onboard lightsensor + @returns value between 0 and 1023 read from the light sensor + @note 1000 Lux will roughly read as 2 Volts (or about 680 as a raw analog reading). + A reading of about 300 is common for most indoor light levels. + Note that outdoor daylight is 10,000 Lux or even higher, so this sensor is best + suited for indoor light levels! +*/ +/**************************************************************************/ +uint16_t Adafruit_CircuitPlayground::lightSensor(void) { + return analogRead(CPLAY_LIGHTSENSOR); +} + +/**************************************************************************/ +/*! + @brief read the onboard sound sensor. A reading of ~0 is silent, and + loud audio will result in a reading between -500 and 500 or so. + @returns value of the sound sensor +*/ +/**************************************************************************/ +int16_t Adafruit_CircuitPlayground::soundSensor(void) { + int16_t x; + mic.capture(&x, 1); + return x; +} + +/**************************************************************************/ +/*! + @brief read the X parameter of the onboard accelerometer. Value returned is + defined by setAccelRange(). + @returns X value of the accelerometer +*/ +/**************************************************************************/ +float Adafruit_CircuitPlayground::motionX(void) { + sensors_event_t event; + CircuitPlayground.lis.getEvent(&event); + return event.acceleration.x; +} + +/**************************************************************************/ +/*! + @brief read the Y parameter of the onboard accelerometer. Value returned is + defined by setAccelRange(). + @returns Y value of the accelerometer +*/ +/**************************************************************************/ +float Adafruit_CircuitPlayground::motionY(void) { + sensors_event_t event; + CircuitPlayground.lis.getEvent(&event); + return event.acceleration.y; +} + +/**************************************************************************/ +/*! + @brief read the Z parameter of the onboard accelerometer. Value returned is + defined by setAccelRange(). + @returns the Z value of the onboard accelerometer +*/ +/**************************************************************************/ +float Adafruit_CircuitPlayground::motionZ(void) { + sensors_event_t event; + CircuitPlayground.lis.getEvent(&event); + return event.acceleration.z; +} + +/**************************************************************************/ +/*! + @brief read the onboard thermistor. + @returns temperature reading in Centigrade. +*/ +/**************************************************************************/ +float Adafruit_CircuitPlayground::temperature(void) { + // Thermistor test + float reading; + + reading = analogRead(CPLAY_THERMISTORPIN); + + //Serial.print("Thermistor reading: "); Serial.println(reading); + + // convert the value to resistance + reading = ((1023.0 * SERIESRESISTOR) / reading); + reading -= SERIESRESISTOR; + + //Serial.print("Thermistor resistance: "); Serial.println(reading); + + float steinhart; + steinhart = reading / THERMISTORNOMINAL; // (R/Ro) + steinhart = log(steinhart); // ln(R/Ro) + steinhart /= BCOEFFICIENT; // 1/B * ln(R/Ro) + steinhart += 1.0 / (TEMPERATURENOMINAL + 273.15); // + (1/To) + steinhart = 1.0 / steinhart; // Invert + steinhart -= 273.15; // convert to C + + return steinhart; +} + +/**************************************************************************/ +/*! + @brief read the onboard thermistor. + @returns temperature reading in Farenheight. +*/ +/**************************************************************************/ +float Adafruit_CircuitPlayground::temperatureF(void) { + float tempF = CircuitPlayground.temperature() * 1.8 + 32; + return tempF; +} + +/**************************************************************************/ +/*! + @brief get a color value from the color wheel. + @param WheelPos a value 0 to 255 + @returns a color value. The colours are a transition r - g - b - back to r. +*/ +/**************************************************************************/ +uint32_t Adafruit_CircuitPlayground::colorWheel(uint8_t WheelPos) { + WheelPos = 255 - WheelPos; + if (WheelPos < 85) { + return strip.Color(255 - WheelPos * 3, 0, WheelPos * 3); + } + if (WheelPos < 170) { + WheelPos -= 85; + return strip.Color(0, WheelPos * 3, 255 - WheelPos * 3); + } + WheelPos -= 170; + return strip.Color(WheelPos * 3, 255 - WheelPos * 3, 0); +} + +/**************************************************************************/ +/*! + @brief detect a color value from the light sensor + @param red the pointer to where the red component should be stored. + @param green the pointer to where the green component should be stored. + @param blue the pointer to where the blue component should be stored. + @returns the components of the detected colors in the passed pointers. +*/ +/**************************************************************************/ +void Adafruit_CircuitPlayground::senseColor(uint8_t& red, uint8_t& green, uint8_t& blue) { + // Save the current pixel brightness so it can later be restored. Then bump + // the brightness to max to make sure the LED is as bright as possible for + // the color readings. + uint8_t old_brightness = strip.getBrightness(); + strip.setBrightness(255); + // Set pixel 1 (next to the light sensor) to full red, green, blue + // color and grab a light sensor reading. Make sure to wait a bit + // after changing pixel colors to let the light sensor change + // resistance! + setPixelColor(1, 255, 0, 0); // Red + delay(LIGHT_SETTLE_MS); + uint16_t raw_red = lightSensor(); + setPixelColor(1, 0, 255, 0); // Green + delay(LIGHT_SETTLE_MS); + uint16_t raw_green = lightSensor(); + setPixelColor(1, 0, 0, 255); // Blue + delay(LIGHT_SETTLE_MS); + uint16_t raw_blue = lightSensor(); + // Turn off the pixel and restore brightness, we're done with readings. + setPixelColor(1, 0); + strip.setBrightness(old_brightness); + // Now scale down each of the raw readings to be within + // 0 to 255. Remember each sensor reading is from the ADC + // which has 10 bits of resolution (0 to 1023), so dividing + // by 4 will change the range from 0-1023 to 0-255. Also + // use the min function to clamp the value to 255 at most (just + // to prevent overflow from 255.xx to 0). + red = min(255, raw_red/4); + green = min(255, raw_green/4); + blue = min(255, raw_blue/4); +} + +/**************************************************************************/ +/*! + @brief check whether or not this device is a CircuitPlayground Express. + @returns True if the device is a CircuitPlayground Express, false if it is a 'classic'. +*/ +/**************************************************************************/ +boolean Adafruit_CircuitPlayground::isExpress(void) { +#ifdef __AVR__ + return false; +#else + return true; +#endif +} + +// instantiate static +Adafruit_CircuitPlayground CircuitPlayground; diff --git a/libraries/Adafruit_Circuit_Playground/Adafruit_CircuitPlayground.h b/libraries/Adafruit_Circuit_Playground/Adafruit_CircuitPlayground.h new file mode 100644 index 0000000..c72cd31 --- /dev/null +++ b/libraries/Adafruit_Circuit_Playground/Adafruit_CircuitPlayground.h @@ -0,0 +1,3 @@ +// this is a placeholder file. dont undo or delete this 'clever hack' :) + +#include diff --git a/libraries/Adafruit_Circuit_Playground/Adafruit_Circuit_Playground.h b/libraries/Adafruit_Circuit_Playground/Adafruit_Circuit_Playground.h new file mode 100644 index 0000000..3e74ebc --- /dev/null +++ b/libraries/Adafruit_Circuit_Playground/Adafruit_Circuit_Playground.h @@ -0,0 +1,231 @@ +/*! + * @file Adafruit_Circuit_Playground.h + * + * This is part of Adafruit's CircuitPlayground driver for the Arduino platform. It is + * designed specifically to work with the Adafruit CircuitPlayground boards. + * + * Adafruit invests time and resources providing this open source code, + * please support Adafruit and open-source hardware by purchasing + * products from Adafruit! + * + * Written by Ladyada and others for Adafruit Industries. + * + * BSD license, all text here must be included in any redistribution. + * + */ + +#ifndef _ADAFRUIT_CIRCUITPLAYGROUND_H_ +#define _ADAFRUIT_CIRCUITPLAYGROUND_H_ + +#include +#include "utility/Adafruit_CPlay_NeoPixel.h" +#include "utility/Adafruit_CPlay_LIS3DH.h" +#include "utility/Adafruit_CPlay_Mic.h" +#include "utility/Adafruit_CPlay_Speaker.h" +#include "utility/CP_Firmata.h" + +#ifdef __AVR__ // Circuit Playground 'classic' + #include "utility/CPlay_CapacitiveSensor.h" +#else + #include "utility/Adafruit_CPlay_FreeTouch.h" + #include "utility/IRLibCPE.h" +#endif + +#ifndef NOT_AN_INTERRUPT // Not defined in Arduino 1.0.5 + #define NOT_AN_INTERRUPT -1 ///< Pin is not on an interrupt +#endif + +#ifdef __AVR__ // Circuit Playground 'classic' + #define CPLAY_CAPSENSE_SHARED 30 ///< capacitive sense pin + #define CPLAY_REDLED 13 ///< red LED pin + #define CPLAY_NEOPIXELPIN 17 ///< neopixel pin + #define CPLAY_SLIDESWITCHPIN 21 ///< slide switch pin + #define CPLAY_LEFTBUTTON 4 ///< left button pin + #define CPLAY_RIGHTBUTTON 19 ///< right button pin + #define CPLAY_LIGHTSENSOR A5 ///< light sensor pin + #define CPLAY_THERMISTORPIN A0 ///< thermistor pin + #define CPLAY_SOUNDSENSOR A4 ///< sound sensor pin + #define CPLAY_BUZZER 5 ///< buzzer pin + #define CPLAY_LIS3DH_CS 8 ///< LIS3DH chip select pin + #define CPLAY_LIS3DH_INTERRUPT 7 ///< LIS3DH interrupt pin + #define CPLAY_LIS3DH_ADDRESS 0x18 ///< LIS3DH I2C address +#else // Circuit Playground Express + #define CPLAY_LEFTBUTTON 4 ///< left button pin + #define CPLAY_RIGHTBUTTON 5 ///< right button pin + #define CPLAY_SLIDESWITCHPIN 7 ///< slide switch pin + #define CPLAY_NEOPIXELPIN 8 ///< neopixel pin + #define CPLAY_REDLED 13 ///< red led pin + #define CPLAY_IR_EMITTER 25 ///< IR emmitter pin + #define CPLAY_IR_RECEIVER 26 ///< IR receiver pin + #define CPLAY_BUZZER A0 ///< buzzer pin + #define CPLAY_LIGHTSENSOR A8 ///< light sensor pin + #define CPLAY_THERMISTORPIN A9 ///< thermistor pin + #define CPLAY_SOUNDSENSOR A4 ///< TBD I2S + #define CPLAY_LIS3DH_CS -1 ///< LIS3DH chip select pin + #define CPLAY_LIS3DH_INTERRUPT 27 ///< LIS3DH interrupt pin + #define CPLAY_LIS3DH_ADDRESS 0x19 ///< LIS3DH I2C address +#endif + +#define SERIESRESISTOR 10000 ///< series resistor for thermistor +#define THERMISTORNOMINAL 10000 ///< resistance of thermistor at 25 degrees C +#define TEMPERATURENOMINAL 25 ///< temp. for nominal resistance (almost always 25 C) + +#define BCOEFFICIENT 3380 ///< The beta coefficient of the thermistor (usually 3000-4000) + +/*! + @brief Configuration to tune the color sensing logic: + Amount of time (in milliseconds) to wait between + changing the pixel color and reading the light + sensor. +*/ +#define LIGHT_SETTLE_MS 100 + +/**************************************************************************/ +/*! + @brief Class that stores state and functions for interacting with CircuitPlayground hardware +*/ +/**************************************************************************/ +class Adafruit_CircuitPlayground { + public: + boolean begin(uint8_t brightness=20); + + Adafruit_CPlay_NeoPixel strip; ///< the neopixel strip object + Adafruit_CPlay_LIS3DH lis; ///< the accelerometer object + Adafruit_CPlay_Mic mic; ///< the microphone object + Adafruit_CPlay_Speaker speaker; ///< the speaker object + +#ifdef __AVR__ // Circuit Playground 'classic' + CPlay_CapacitiveSensor cap[8]; ///< the array of capacitive touch sensors +#else + Adafruit_CPlay_FreeTouch cap[7]; ///< the array of capacitive touch sensors + IRrecvPCI irReceiver; ///< the IR receiver object + IRdecode irDecoder; ///< the IR decoder object + IRsend irSend; ///< the IR send object +#endif + + boolean slideSwitch(void); + void redLED(boolean v); + void playTone(uint16_t freq, uint16_t time, boolean wait=true); + boolean leftButton(void); + boolean rightButton(void); + uint16_t lightSensor(void); + int16_t soundSensor(void); + float temperature(void); + float temperatureF(void); + + uint16_t readCap(uint8_t p, uint8_t samples=10); + + // Accelerometer + float motionX(void); + float motionY(void); + float motionZ(void); + +/**************************************************************************/ +/*! + @brief set the range of the MEMS accelerometer. + @param range the range to set the accelerometer to. LIS3DH_RANGE_2_G + is the smallest (+-2G) but will give the greatest precision, while LIS3DH_RANGE_8_G + is the largest (+-8G) but with the lease precision. LIS3DH_RANGE_4_G is in the middle. +*/ +/**************************************************************************/ + void setAccelRange(lis3dh_range_t range) { lis.setRange(range); } +/**************************************************************************/ +/*! + @brief turn on tap detection. Tap detection can detect single taps or 'double taps' + (like a double-click). + @param c If c is 1 you will only detect single taps, one at a time. + If c is 2, you will be able to detect both single taps and double taps. + @param clickthresh the threshold over which to register a tap +*/ +/**************************************************************************/ + void setAccelTap(uint8_t c, uint8_t clickthresh) + { lis.setClick(c, clickthresh, 10, 20, 255); } + +/**************************************************************************/ +/*! + @brief test whether or not a tap has been detected + @return 0 if no tap is detected, 1 if a single tap is detected, and 2 or 3 if double tap is detected. +*/ +/**************************************************************************/ + uint8_t getAccelTap(void) { return (lis.getClick() >> 8) & 0x3; } + + +/**************************************************************************/ +/*! + @brief turn off all neopixels on the board +*/ +/**************************************************************************/ + void clearPixels(void) { strip.clear(); strip.show(); } + +/**************************************************************************/ +/*! + @brief set the color of a neopixel on the board + @param p the pixel to set. Pixel 0 is above the pad labeled 'GND' right next to the + USB connector, while pixel 9 is above the pad labeled '3.3V' on the other side of + the USB connector. + @param c a 24bit color value to set the pixel to +*/ +/**************************************************************************/ + void setPixelColor(uint8_t p, uint32_t c) {strip.setPixelColor(p, c); strip.show();} + +/**************************************************************************/ +/*! + @brief set the color of a neopixel on the board + @param p the pixel to set. Pixel 0 is above the pad labeled 'GND' right next to the + USB connector, while pixel 9 is above the pad labeled '3.3V' on the other side of + the USB connector. + @param r a 0 to 255 value corresponding to the red component of the desired color. + @param g a 0 to 255 value corresponding to the green component of the desired color. + @param b a 0 to 255 value corresponding to the blue component of the desired color. +*/ +/**************************************************************************/ + void setPixelColor(uint8_t p, uint8_t r, uint8_t g, uint8_t b) {strip.setPixelColor(p, r, g, b); strip.show();} + +/*! @brief set the global brightness of all neopixels. + @param b a 0 to 255 value corresponding to the desired brightness. The default brightness + of all neopixels is 30. */ + void setBrightness(uint16_t b){strip.setBrightness(b);} + +/*! @brief Get a sinusoidal value from a sine table + @param x a 0 to 255 value corresponding to an index to the sine table + @returns An 8-bit sinusoidal value back */ + uint8_t sine8(uint8_t x) { return strip.sine8(x); } + +/*! @brief Get a gamma-corrected value from a gamma table + @param x a 0 to 255 value corresponding to an index to the gamma table + @returns An 8-bit gamma-corrected value back */ + uint8_t gamma8(uint8_t x) { return strip.gamma8(x); } + + uint32_t colorWheel(uint8_t x); + + // Basic RGB color sensing with the light sensor and nearby neopixel. + // Both functions do the same thing and just differ in how they return the + // result, either as explicit RGB bytes or a 24-bit RGB color value. + void senseColor(uint8_t& red, uint8_t& green, uint8_t& blue); + +/**************************************************************************/ +/*! + @brief detect a color using the onboard light sensor + @return a 24 bit color. The most significant byte is red, followed by green, and + the least significant byte is blue. +*/ +/**************************************************************************/ + uint32_t senseColor() { + // Use the individual color component color sense function and then recombine + // tbe components into a 24-bit color value. + uint8_t red, green, blue; + senseColor(red, green, blue); + return ((uint32_t)red << 16) | ((uint32_t)green << 8) | blue; + } + + boolean isExpress(void); + + private: + + +}; + + +extern Adafruit_CircuitPlayground CircuitPlayground; ///< instantiated by default + +#endif diff --git a/libraries/Adafruit_Circuit_Playground/Doxyfile b/libraries/Adafruit_Circuit_Playground/Doxyfile new file mode 100644 index 0000000..a0da164 --- /dev/null +++ b/libraries/Adafruit_Circuit_Playground/Doxyfile @@ -0,0 +1,2492 @@ +# Doxyfile 1.8.13 + +# This file describes the settings to be used by the documentation system +# doxygen (www.doxygen.org) for a project. +# +# All text after a double hash (##) is considered a comment and is placed in +# front of the TAG it is preceding. +# +# All text after a single hash (#) is considered a comment and will be ignored. +# The format is: +# TAG = value [value, ...] +# For lists, items can also be appended using: +# TAG += value [value, ...] +# Values that contain spaces should be placed between quotes (\" \"). + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- + +# This tag specifies the encoding used for all characters in the config file +# that follow. The default is UTF-8 which is also the encoding used for all text +# before the first occurrence of this tag. Doxygen uses libiconv (or the iconv +# built into libc) for the transcoding. See http://www.gnu.org/software/libiconv +# for the list of possible encodings. +# The default value is: UTF-8. + +DOXYFILE_ENCODING = UTF-8 + +# The PROJECT_NAME tag is a single word (or a sequence of words surrounded by +# double-quotes, unless you are using Doxywizard) that should identify the +# project for which the documentation is generated. This name is used in the +# title of most generated pages and in a few other places. +# The default value is: My Project. + +PROJECT_NAME = "Adafruit Library" + +# The PROJECT_NUMBER tag can be used to enter a project or revision number. This +# could be handy for archiving the generated documentation or if some version +# control system is used. + +PROJECT_NUMBER = + +# Using the PROJECT_BRIEF tag one can provide an optional one line description +# for a project that appears at the top of each page and should give viewer a +# quick idea about the purpose of the project. Keep the description short. + +PROJECT_BRIEF = + +# With the PROJECT_LOGO tag one can specify a logo or an icon that is included +# in the documentation. The maximum height of the logo should not exceed 55 +# pixels and the maximum width should not exceed 200 pixels. Doxygen will copy +# the logo to the output directory. + +PROJECT_LOGO = + +# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path +# into which the generated documentation will be written. If a relative path is +# entered, it will be relative to the location where doxygen was started. If +# left blank the current directory will be used. + +OUTPUT_DIRECTORY = + +# If the CREATE_SUBDIRS tag is set to YES then doxygen will create 4096 sub- +# directories (in 2 levels) under the output directory of each output format and +# will distribute the generated files over these directories. Enabling this +# option can be useful when feeding doxygen a huge amount of source files, where +# putting all generated files in the same directory would otherwise causes +# performance problems for the file system. +# The default value is: NO. + +CREATE_SUBDIRS = NO + +# If the ALLOW_UNICODE_NAMES tag is set to YES, doxygen will allow non-ASCII +# characters to appear in the names of generated files. If set to NO, non-ASCII +# characters will be escaped, for example _xE3_x81_x84 will be used for Unicode +# U+3044. +# The default value is: NO. + +ALLOW_UNICODE_NAMES = NO + +# The OUTPUT_LANGUAGE tag is used to specify the language in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all constant output in the proper language. +# Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Catalan, Chinese, +# Chinese-Traditional, Croatian, Czech, Danish, Dutch, English (United States), +# Esperanto, Farsi (Persian), Finnish, French, German, Greek, Hungarian, +# Indonesian, Italian, Japanese, Japanese-en (Japanese with English messages), +# Korean, Korean-en (Korean with English messages), Latvian, Lithuanian, +# Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese, Romanian, Russian, +# Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish, Swedish, Turkish, +# Ukrainian and Vietnamese. +# The default value is: English. + +OUTPUT_LANGUAGE = English + +# If the BRIEF_MEMBER_DESC tag is set to YES, doxygen will include brief member +# descriptions after the members that are listed in the file and class +# documentation (similar to Javadoc). Set to NO to disable this. +# The default value is: YES. + +BRIEF_MEMBER_DESC = YES + +# If the REPEAT_BRIEF tag is set to YES, doxygen will prepend the brief +# description of a member or function before the detailed description +# +# Note: If both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the +# brief descriptions will be completely suppressed. +# The default value is: YES. + +REPEAT_BRIEF = YES + +# This tag implements a quasi-intelligent brief description abbreviator that is +# used to form the text in various listings. Each string in this list, if found +# as the leading text of the brief description, will be stripped from the text +# and the result, after processing the whole list, is used as the annotated +# text. Otherwise, the brief description is used as-is. If left blank, the +# following values are used ($name is automatically replaced with the name of +# the entity):The $name class, The $name widget, The $name file, is, provides, +# specifies, contains, represents, a, an and the. + +ABBREVIATE_BRIEF = "The $name class" \ + "The $name widget" \ + "The $name file" \ + is \ + provides \ + specifies \ + contains \ + represents \ + a \ + an \ + the + +# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then +# doxygen will generate a detailed section even if there is only a brief +# description. +# The default value is: NO. + +ALWAYS_DETAILED_SEC = NO + +# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all +# inherited members of a class in the documentation of that class as if those +# members were ordinary class members. Constructors, destructors and assignment +# operators of the base classes will not be shown. +# The default value is: NO. + +INLINE_INHERITED_MEMB = NO + +# If the FULL_PATH_NAMES tag is set to YES, doxygen will prepend the full path +# before files name in the file list and in the header files. If set to NO the +# shortest path that makes the file name unique will be used +# The default value is: YES. + +FULL_PATH_NAMES = YES + +# The STRIP_FROM_PATH tag can be used to strip a user-defined part of the path. +# Stripping is only done if one of the specified strings matches the left-hand +# part of the path. The tag can be used to show relative paths in the file list. +# If left blank the directory from which doxygen is run is used as the path to +# strip. +# +# Note that you can specify absolute paths here, but also relative paths, which +# will be relative from the directory where doxygen is started. +# This tag requires that the tag FULL_PATH_NAMES is set to YES. + +STRIP_FROM_PATH = + +# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the +# path mentioned in the documentation of a class, which tells the reader which +# header file to include in order to use a class. If left blank only the name of +# the header file containing the class definition is used. Otherwise one should +# specify the list of include paths that are normally passed to the compiler +# using the -I flag. + +STRIP_FROM_INC_PATH = + +# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but +# less readable) file names. This can be useful is your file systems doesn't +# support long names like on DOS, Mac, or CD-ROM. +# The default value is: NO. + +SHORT_NAMES = NO + +# If the JAVADOC_AUTOBRIEF tag is set to YES then doxygen will interpret the +# first line (until the first dot) of a Javadoc-style comment as the brief +# description. If set to NO, the Javadoc-style will behave just like regular Qt- +# style comments (thus requiring an explicit @brief command for a brief +# description.) +# The default value is: NO. + +JAVADOC_AUTOBRIEF = NO + +# If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first +# line (until the first dot) of a Qt-style comment as the brief description. If +# set to NO, the Qt-style will behave just like regular Qt-style comments (thus +# requiring an explicit \brief command for a brief description.) +# The default value is: NO. + +QT_AUTOBRIEF = NO + +# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make doxygen treat a +# multi-line C++ special comment block (i.e. a block of //! or /// comments) as +# a brief description. This used to be the default behavior. The new default is +# to treat a multi-line C++ comment block as a detailed description. Set this +# tag to YES if you prefer the old behavior instead. +# +# Note that setting this tag to YES also means that rational rose comments are +# not recognized any more. +# The default value is: NO. + +MULTILINE_CPP_IS_BRIEF = NO + +# If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the +# documentation from any documented member that it re-implements. +# The default value is: YES. + +INHERIT_DOCS = YES + +# If the SEPARATE_MEMBER_PAGES tag is set to YES then doxygen will produce a new +# page for each member. If set to NO, the documentation of a member will be part +# of the file/class/namespace that contains it. +# The default value is: NO. + +SEPARATE_MEMBER_PAGES = NO + +# The TAB_SIZE tag can be used to set the number of spaces in a tab. Doxygen +# uses this value to replace tabs by spaces in code fragments. +# Minimum value: 1, maximum value: 16, default value: 4. + +TAB_SIZE = 4 + +# This tag can be used to specify a number of aliases that act as commands in +# the documentation. An alias has the form: +# name=value +# For example adding +# "sideeffect=@par Side Effects:\n" +# will allow you to put the command \sideeffect (or @sideeffect) in the +# documentation, which will result in a user-defined paragraph with heading +# "Side Effects:". You can put \n's in the value part of an alias to insert +# newlines. + +ALIASES = + +# This tag can be used to specify a number of word-keyword mappings (TCL only). +# A mapping has the form "name=value". For example adding "class=itcl::class" +# will allow you to use the command class in the itcl::class meaning. + +TCL_SUBST = + +# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources +# only. Doxygen will then generate output that is more tailored for C. For +# instance, some of the names that are used will be different. The list of all +# members will be omitted, etc. +# The default value is: NO. + +OPTIMIZE_OUTPUT_FOR_C = NO + +# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java or +# Python sources only. Doxygen will then generate output that is more tailored +# for that language. For instance, namespaces will be presented as packages, +# qualified scopes will look different, etc. +# The default value is: NO. + +OPTIMIZE_OUTPUT_JAVA = NO + +# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran +# sources. Doxygen will then generate output that is tailored for Fortran. +# The default value is: NO. + +OPTIMIZE_FOR_FORTRAN = NO + +# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL +# sources. Doxygen will then generate output that is tailored for VHDL. +# The default value is: NO. + +OPTIMIZE_OUTPUT_VHDL = NO + +# Doxygen selects the parser to use depending on the extension of the files it +# parses. With this tag you can assign which parser to use for a given +# extension. Doxygen has a built-in mapping, but you can override or extend it +# using this tag. The format is ext=language, where ext is a file extension, and +# language is one of the parsers supported by doxygen: IDL, Java, Javascript, +# C#, C, C++, D, PHP, Objective-C, Python, Fortran (fixed format Fortran: +# FortranFixed, free formatted Fortran: FortranFree, unknown formatted Fortran: +# Fortran. In the later case the parser tries to guess whether the code is fixed +# or free formatted code, this is the default for Fortran type files), VHDL. For +# instance to make doxygen treat .inc files as Fortran files (default is PHP), +# and .f files as C (default is Fortran), use: inc=Fortran f=C. +# +# Note: For files without extension you can use no_extension as a placeholder. +# +# Note that for custom extensions you also need to set FILE_PATTERNS otherwise +# the files are not read by doxygen. + +EXTENSION_MAPPING = + +# If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments +# according to the Markdown format, which allows for more readable +# documentation. See http://daringfireball.net/projects/markdown/ for details. +# The output of markdown processing is further processed by doxygen, so you can +# mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in +# case of backward compatibilities issues. +# The default value is: YES. + +MARKDOWN_SUPPORT = YES + +# When the TOC_INCLUDE_HEADINGS tag is set to a non-zero value, all headings up +# to that level are automatically included in the table of contents, even if +# they do not have an id attribute. +# Note: This feature currently applies only to Markdown headings. +# Minimum value: 0, maximum value: 99, default value: 0. +# This tag requires that the tag MARKDOWN_SUPPORT is set to YES. + +TOC_INCLUDE_HEADINGS = 0 + +# When enabled doxygen tries to link words that correspond to documented +# classes, or namespaces to their corresponding documentation. Such a link can +# be prevented in individual cases by putting a % sign in front of the word or +# globally by setting AUTOLINK_SUPPORT to NO. +# The default value is: YES. + +AUTOLINK_SUPPORT = YES + +# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want +# to include (a tag file for) the STL sources as input, then you should set this +# tag to YES in order to let doxygen match functions declarations and +# definitions whose arguments contain STL classes (e.g. func(std::string); +# versus func(std::string) {}). This also make the inheritance and collaboration +# diagrams that involve STL classes more complete and accurate. +# The default value is: NO. + +BUILTIN_STL_SUPPORT = NO + +# If you use Microsoft's C++/CLI language, you should set this option to YES to +# enable parsing support. +# The default value is: NO. + +CPP_CLI_SUPPORT = NO + +# Set the SIP_SUPPORT tag to YES if your project consists of sip (see: +# http://www.riverbankcomputing.co.uk/software/sip/intro) sources only. Doxygen +# will parse them like normal C++ but will assume all classes use public instead +# of private inheritance when no explicit protection keyword is present. +# The default value is: NO. + +SIP_SUPPORT = NO + +# For Microsoft's IDL there are propget and propput attributes to indicate +# getter and setter methods for a property. Setting this option to YES will make +# doxygen to replace the get and set methods by a property in the documentation. +# This will only work if the methods are indeed getting or setting a simple +# type. If this is not the case, or you want to show the methods anyway, you +# should set this option to NO. +# The default value is: YES. + +IDL_PROPERTY_SUPPORT = YES + +# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC +# tag is set to YES then doxygen will reuse the documentation of the first +# member in the group (if any) for the other members of the group. By default +# all members of a group must be documented explicitly. +# The default value is: NO. + +DISTRIBUTE_GROUP_DOC = NO + +# If one adds a struct or class to a group and this option is enabled, then also +# any nested class or struct is added to the same group. By default this option +# is disabled and one has to add nested compounds explicitly via \ingroup. +# The default value is: NO. + +GROUP_NESTED_COMPOUNDS = NO + +# Set the SUBGROUPING tag to YES to allow class member groups of the same type +# (for instance a group of public functions) to be put as a subgroup of that +# type (e.g. under the Public Functions section). Set it to NO to prevent +# subgrouping. Alternatively, this can be done per class using the +# \nosubgrouping command. +# The default value is: YES. + +SUBGROUPING = YES + +# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and unions +# are shown inside the group in which they are included (e.g. using \ingroup) +# instead of on a separate page (for HTML and Man pages) or section (for LaTeX +# and RTF). +# +# Note that this feature does not work in combination with +# SEPARATE_MEMBER_PAGES. +# The default value is: NO. + +INLINE_GROUPED_CLASSES = NO + +# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and unions +# with only public data fields or simple typedef fields will be shown inline in +# the documentation of the scope in which they are defined (i.e. file, +# namespace, or group documentation), provided this scope is documented. If set +# to NO, structs, classes, and unions are shown on a separate page (for HTML and +# Man pages) or section (for LaTeX and RTF). +# The default value is: NO. + +INLINE_SIMPLE_STRUCTS = NO + +# When TYPEDEF_HIDES_STRUCT tag is enabled, a typedef of a struct, union, or +# enum is documented as struct, union, or enum with the name of the typedef. So +# typedef struct TypeS {} TypeT, will appear in the documentation as a struct +# with name TypeT. When disabled the typedef will appear as a member of a file, +# namespace, or class. And the struct will be named TypeS. This can typically be +# useful for C code in case the coding convention dictates that all compound +# types are typedef'ed and only the typedef is referenced, never the tag name. +# The default value is: NO. + +TYPEDEF_HIDES_STRUCT = NO + +# The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This +# cache is used to resolve symbols given their name and scope. Since this can be +# an expensive process and often the same symbol appears multiple times in the +# code, doxygen keeps a cache of pre-resolved symbols. If the cache is too small +# doxygen will become slower. If the cache is too large, memory is wasted. The +# cache size is given by this formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range +# is 0..9, the default is 0, corresponding to a cache size of 2^16=65536 +# symbols. At the end of a run doxygen will report the cache usage and suggest +# the optimal cache size from a speed point of view. +# Minimum value: 0, maximum value: 9, default value: 0. + +LOOKUP_CACHE_SIZE = 0 + +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- + +# If the EXTRACT_ALL tag is set to YES, doxygen will assume all entities in +# documentation are documented, even if no documentation was available. Private +# class members and static file members will be hidden unless the +# EXTRACT_PRIVATE respectively EXTRACT_STATIC tags are set to YES. +# Note: This will also disable the warnings about undocumented members that are +# normally produced when WARNINGS is set to YES. +# The default value is: NO. + +EXTRACT_ALL = NO + +# If the EXTRACT_PRIVATE tag is set to YES, all private members of a class will +# be included in the documentation. +# The default value is: NO. + +EXTRACT_PRIVATE = NO + +# If the EXTRACT_PACKAGE tag is set to YES, all members with package or internal +# scope will be included in the documentation. +# The default value is: NO. + +EXTRACT_PACKAGE = NO + +# If the EXTRACT_STATIC tag is set to YES, all static members of a file will be +# included in the documentation. +# The default value is: NO. + +EXTRACT_STATIC = NO + +# If the EXTRACT_LOCAL_CLASSES tag is set to YES, classes (and structs) defined +# locally in source files will be included in the documentation. If set to NO, +# only classes defined in header files are included. Does not have any effect +# for Java sources. +# The default value is: YES. + +EXTRACT_LOCAL_CLASSES = YES + +# This flag is only useful for Objective-C code. If set to YES, local methods, +# which are defined in the implementation section but not in the interface are +# included in the documentation. If set to NO, only methods in the interface are +# included. +# The default value is: NO. + +EXTRACT_LOCAL_METHODS = NO + +# If this flag is set to YES, the members of anonymous namespaces will be +# extracted and appear in the documentation as a namespace called +# 'anonymous_namespace{file}', where file will be replaced with the base name of +# the file that contains the anonymous namespace. By default anonymous namespace +# are hidden. +# The default value is: NO. + +EXTRACT_ANON_NSPACES = NO + +# If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all +# undocumented members inside documented classes or files. If set to NO these +# members will be included in the various overviews, but no documentation +# section is generated. This option has no effect if EXTRACT_ALL is enabled. +# The default value is: NO. + +HIDE_UNDOC_MEMBERS = NO + +# If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all +# undocumented classes that are normally visible in the class hierarchy. If set +# to NO, these classes will be included in the various overviews. This option +# has no effect if EXTRACT_ALL is enabled. +# The default value is: NO. + +HIDE_UNDOC_CLASSES = NO + +# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend +# (class|struct|union) declarations. If set to NO, these declarations will be +# included in the documentation. +# The default value is: NO. + +HIDE_FRIEND_COMPOUNDS = NO + +# If the HIDE_IN_BODY_DOCS tag is set to YES, doxygen will hide any +# documentation blocks found inside the body of a function. If set to NO, these +# blocks will be appended to the function's detailed documentation block. +# The default value is: NO. + +HIDE_IN_BODY_DOCS = NO + +# The INTERNAL_DOCS tag determines if documentation that is typed after a +# \internal command is included. If the tag is set to NO then the documentation +# will be excluded. Set it to YES to include the internal documentation. +# The default value is: NO. + +INTERNAL_DOCS = NO + +# If the CASE_SENSE_NAMES tag is set to NO then doxygen will only generate file +# names in lower-case letters. If set to YES, upper-case letters are also +# allowed. This is useful if you have classes or files whose names only differ +# in case and if your file system supports case sensitive file names. Windows +# and Mac users are advised to set this option to NO. +# The default value is: system dependent. + +CASE_SENSE_NAMES = NO + +# If the HIDE_SCOPE_NAMES tag is set to NO then doxygen will show members with +# their full class and namespace scopes in the documentation. If set to YES, the +# scope will be hidden. +# The default value is: NO. + +HIDE_SCOPE_NAMES = NO + +# If the HIDE_COMPOUND_REFERENCE tag is set to NO (default) then doxygen will +# append additional text to a page's title, such as Class Reference. If set to +# YES the compound reference will be hidden. +# The default value is: NO. + +HIDE_COMPOUND_REFERENCE= NO + +# If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of +# the files that are included by a file in the documentation of that file. +# The default value is: YES. + +SHOW_INCLUDE_FILES = YES + +# If the SHOW_GROUPED_MEMB_INC tag is set to YES then Doxygen will add for each +# grouped member an include statement to the documentation, telling the reader +# which file to include in order to use the member. +# The default value is: NO. + +SHOW_GROUPED_MEMB_INC = NO + +# If the FORCE_LOCAL_INCLUDES tag is set to YES then doxygen will list include +# files with double quotes in the documentation rather than with sharp brackets. +# The default value is: NO. + +FORCE_LOCAL_INCLUDES = NO + +# If the INLINE_INFO tag is set to YES then a tag [inline] is inserted in the +# documentation for inline members. +# The default value is: YES. + +INLINE_INFO = YES + +# If the SORT_MEMBER_DOCS tag is set to YES then doxygen will sort the +# (detailed) documentation of file and class members alphabetically by member +# name. If set to NO, the members will appear in declaration order. +# The default value is: YES. + +SORT_MEMBER_DOCS = NO + +# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the brief +# descriptions of file, namespace and class members alphabetically by member +# name. If set to NO, the members will appear in declaration order. Note that +# this will also influence the order of the classes in the class list. +# The default value is: NO. + +SORT_BRIEF_DOCS = NO + +# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the +# (brief and detailed) documentation of class members so that constructors and +# destructors are listed first. If set to NO the constructors will appear in the +# respective orders defined by SORT_BRIEF_DOCS and SORT_MEMBER_DOCS. +# Note: If SORT_BRIEF_DOCS is set to NO this option is ignored for sorting brief +# member documentation. +# Note: If SORT_MEMBER_DOCS is set to NO this option is ignored for sorting +# detailed member documentation. +# The default value is: NO. + +SORT_MEMBERS_CTORS_1ST = NO + +# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the hierarchy +# of group names into alphabetical order. If set to NO the group names will +# appear in their defined order. +# The default value is: NO. + +SORT_GROUP_NAMES = NO + +# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be sorted by +# fully-qualified names, including namespaces. If set to NO, the class list will +# be sorted only by class name, not including the namespace part. +# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. +# Note: This option applies only to the class list, not to the alphabetical +# list. +# The default value is: NO. + +SORT_BY_SCOPE_NAME = NO + +# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to do proper +# type resolution of all parameters of a function it will reject a match between +# the prototype and the implementation of a member function even if there is +# only one candidate or it is obvious which candidate to choose by doing a +# simple string match. By disabling STRICT_PROTO_MATCHING doxygen will still +# accept a match between prototype and implementation in such cases. +# The default value is: NO. + +STRICT_PROTO_MATCHING = NO + +# The GENERATE_TODOLIST tag can be used to enable (YES) or disable (NO) the todo +# list. This list is created by putting \todo commands in the documentation. +# The default value is: YES. + +GENERATE_TODOLIST = YES + +# The GENERATE_TESTLIST tag can be used to enable (YES) or disable (NO) the test +# list. This list is created by putting \test commands in the documentation. +# The default value is: YES. + +GENERATE_TESTLIST = YES + +# The GENERATE_BUGLIST tag can be used to enable (YES) or disable (NO) the bug +# list. This list is created by putting \bug commands in the documentation. +# The default value is: YES. + +GENERATE_BUGLIST = YES + +# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or disable (NO) +# the deprecated list. This list is created by putting \deprecated commands in +# the documentation. +# The default value is: YES. + +GENERATE_DEPRECATEDLIST= YES + +# The ENABLED_SECTIONS tag can be used to enable conditional documentation +# sections, marked by \if ... \endif and \cond +# ... \endcond blocks. + +ENABLED_SECTIONS = + +# The MAX_INITIALIZER_LINES tag determines the maximum number of lines that the +# initial value of a variable or macro / define can have for it to appear in the +# documentation. If the initializer consists of more lines than specified here +# it will be hidden. Use a value of 0 to hide initializers completely. The +# appearance of the value of individual variables and macros / defines can be +# controlled using \showinitializer or \hideinitializer command in the +# documentation regardless of this setting. +# Minimum value: 0, maximum value: 10000, default value: 30. + +MAX_INITIALIZER_LINES = 30 + +# Set the SHOW_USED_FILES tag to NO to disable the list of files generated at +# the bottom of the documentation of classes and structs. If set to YES, the +# list will mention the files that were used to generate the documentation. +# The default value is: YES. + +SHOW_USED_FILES = YES + +# Set the SHOW_FILES tag to NO to disable the generation of the Files page. This +# will remove the Files entry from the Quick Index and from the Folder Tree View +# (if specified). +# The default value is: YES. + +SHOW_FILES = YES + +# Set the SHOW_NAMESPACES tag to NO to disable the generation of the Namespaces +# page. This will remove the Namespaces entry from the Quick Index and from the +# Folder Tree View (if specified). +# The default value is: YES. + +SHOW_NAMESPACES = YES + +# The FILE_VERSION_FILTER tag can be used to specify a program or script that +# doxygen should invoke to get the current version for each file (typically from +# the version control system). Doxygen will invoke the program by executing (via +# popen()) the command command input-file, where command is the value of the +# FILE_VERSION_FILTER tag, and input-file is the name of an input file provided +# by doxygen. Whatever the program writes to standard output is used as the file +# version. For an example see the documentation. + +FILE_VERSION_FILTER = + +# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed +# by doxygen. The layout file controls the global structure of the generated +# output files in an output format independent way. To create the layout file +# that represents doxygen's defaults, run doxygen with the -l option. You can +# optionally specify a file name after the option, if omitted DoxygenLayout.xml +# will be used as the name of the layout file. +# +# Note that if you run doxygen from a directory containing a file called +# DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE +# tag is left empty. + +LAYOUT_FILE = + +# The CITE_BIB_FILES tag can be used to specify one or more bib files containing +# the reference definitions. This must be a list of .bib files. The .bib +# extension is automatically appended if omitted. This requires the bibtex tool +# to be installed. See also http://en.wikipedia.org/wiki/BibTeX for more info. +# For LaTeX the style of the bibliography can be controlled using +# LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the +# search path. See also \cite for info how to create references. + +CITE_BIB_FILES = + +#--------------------------------------------------------------------------- +# Configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +# The QUIET tag can be used to turn on/off the messages that are generated to +# standard output by doxygen. If QUIET is set to YES this implies that the +# messages are off. +# The default value is: NO. + +QUIET = YES + +# The WARNINGS tag can be used to turn on/off the warning messages that are +# generated to standard error (stderr) by doxygen. If WARNINGS is set to YES +# this implies that the warnings are on. +# +# Tip: Turn warnings on while writing the documentation. +# The default value is: YES. + +WARNINGS = YES + +# If the WARN_IF_UNDOCUMENTED tag is set to YES then doxygen will generate +# warnings for undocumented members. If EXTRACT_ALL is set to YES then this flag +# will automatically be disabled. +# The default value is: YES. + +WARN_IF_UNDOCUMENTED = YES + +# If the WARN_IF_DOC_ERROR tag is set to YES, doxygen will generate warnings for +# potential errors in the documentation, such as not documenting some parameters +# in a documented function, or documenting parameters that don't exist or using +# markup commands wrongly. +# The default value is: YES. + +WARN_IF_DOC_ERROR = YES + +# This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that +# are documented, but have no documentation for their parameters or return +# value. If set to NO, doxygen will only warn about wrong or incomplete +# parameter documentation, but not about the absence of documentation. +# The default value is: NO. + +WARN_NO_PARAMDOC = YES + +# If the WARN_AS_ERROR tag is set to YES then doxygen will immediately stop when +# a warning is encountered. +# The default value is: NO. + +WARN_AS_ERROR = NO + +# The WARN_FORMAT tag determines the format of the warning messages that doxygen +# can produce. The string should contain the $file, $line, and $text tags, which +# will be replaced by the file and line number from which the warning originated +# and the warning text. Optionally the format may contain $version, which will +# be replaced by the version of the file (if it could be obtained via +# FILE_VERSION_FILTER) +# The default value is: $file:$line: $text. + +WARN_FORMAT = "$file:$line: $text" + +# The WARN_LOGFILE tag can be used to specify a file to which warning and error +# messages should be written. If left blank the output is written to standard +# error (stderr). + +WARN_LOGFILE = + +#--------------------------------------------------------------------------- +# Configuration options related to the input files +#--------------------------------------------------------------------------- + +# The INPUT tag is used to specify the files and/or directories that contain +# documented source files. You may enter file names like myfile.cpp or +# directories like /usr/src/myproject. Separate the files or directories with +# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING +# Note: If this tag is empty the current directory is searched. + +INPUT = . \ + utility + +# This tag can be used to specify the character encoding of the source files +# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses +# libiconv (or the iconv built into libc) for the transcoding. See the libiconv +# documentation (see: http://www.gnu.org/software/libiconv) for the list of +# possible encodings. +# The default value is: UTF-8. + +INPUT_ENCODING = UTF-8 + +# If the value of the INPUT tag contains directories, you can use the +# FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and +# *.h) to filter out the source-files in the directories. +# +# Note that for custom extensions or not directly supported extensions you also +# need to set EXTENSION_MAPPING for the extension otherwise the files are not +# read by doxygen. +# +# If left blank the following patterns are tested:*.c, *.cc, *.cxx, *.cpp, +# *.c++, *.java, *.ii, *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, +# *.hh, *.hxx, *.hpp, *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc, +# *.m, *.markdown, *.md, *.mm, *.dox, *.py, *.pyw, *.f90, *.f95, *.f03, *.f08, +# *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf and *.qsf. + +FILE_PATTERNS = *.c \ + *.cc \ + *.cxx \ + *.cpp \ + *.c++ \ + *.java \ + *.ii \ + *.ixx \ + *.ipp \ + *.i++ \ + *.inl \ + *.idl \ + *.ddl \ + *.odl \ + *.h \ + *.hh \ + *.hxx \ + *.hpp \ + *.h++ \ + *.cs \ + *.d \ + *.php \ + *.php4 \ + *.php5 \ + *.phtml \ + *.inc \ + *.m \ + *.mm \ + *.dox \ + *.py \ + *.pyw \ + *.f90 \ + *.f95 \ + *.f03 \ + *.f08 \ + *.f \ + *.for \ + *.tcl \ + *.vhd \ + *.vhdl \ + *.ucf \ + *.qsf + +# The RECURSIVE tag can be used to specify whether or not subdirectories should +# be searched for input files as well. +# The default value is: NO. + +RECURSIVE = NO + +# The EXCLUDE tag can be used to specify files and/or directories that should be +# excluded from the INPUT source files. This way you can easily exclude a +# subdirectory from a directory tree whose root is specified with the INPUT tag. +# +# Note that relative paths are relative to the directory from which doxygen is +# run. + +EXCLUDE = + +# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or +# directories that are symbolic links (a Unix file system feature) are excluded +# from the input. +# The default value is: NO. + +EXCLUDE_SYMLINKS = NO + +# If the value of the INPUT tag contains directories, you can use the +# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude +# certain files from those directories. +# +# Note that the wildcards are matched against the file with absolute path, so to +# exclude all test directories for example use the pattern */test/* + +EXCLUDE_PATTERNS = */utility/IRLib* \ + */utility/CP_Firmata.* + +# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names +# (namespaces, classes, functions, etc.) that should be excluded from the +# output. The symbol name can be a fully qualified name, a word, or if the +# wildcard * is used, a substring. Examples: ANamespace, AClass, +# AClass::ANamespace, ANamespace::*Test +# +# Note that the wildcards are matched against the file with absolute path, so to +# exclude all test directories use the pattern */test/* + +EXCLUDE_SYMBOLS = + +# The EXAMPLE_PATH tag can be used to specify one or more files or directories +# that contain example code fragments that are included (see the \include +# command). + +EXAMPLE_PATH = + +# If the value of the EXAMPLE_PATH tag contains directories, you can use the +# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and +# *.h) to filter out the source-files in the directories. If left blank all +# files are included. + +EXAMPLE_PATTERNS = * + +# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be +# searched for input files to be used with the \include or \dontinclude commands +# irrespective of the value of the RECURSIVE tag. +# The default value is: NO. + +EXAMPLE_RECURSIVE = NO + +# The IMAGE_PATH tag can be used to specify one or more files or directories +# that contain images that are to be included in the documentation (see the +# \image command). + +IMAGE_PATH = + +# The INPUT_FILTER tag can be used to specify a program that doxygen should +# invoke to filter for each input file. Doxygen will invoke the filter program +# by executing (via popen()) the command: +# +# +# +# where is the value of the INPUT_FILTER tag, and is the +# name of an input file. Doxygen will then use the output that the filter +# program writes to standard output. If FILTER_PATTERNS is specified, this tag +# will be ignored. +# +# Note that the filter must not add or remove lines; it is applied before the +# code is scanned, but not when the output code is generated. If lines are added +# or removed, the anchors will not be placed correctly. +# +# Note that for custom extensions or not directly supported extensions you also +# need to set EXTENSION_MAPPING for the extension otherwise the files are not +# properly processed by doxygen. + +INPUT_FILTER = + +# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern +# basis. Doxygen will compare the file name with each pattern and apply the +# filter if there is a match. The filters are a list of the form: pattern=filter +# (like *.cpp=my_cpp_filter). See INPUT_FILTER for further information on how +# filters are used. If the FILTER_PATTERNS tag is empty or if none of the +# patterns match the file name, INPUT_FILTER is applied. +# +# Note that for custom extensions or not directly supported extensions you also +# need to set EXTENSION_MAPPING for the extension otherwise the files are not +# properly processed by doxygen. + +FILTER_PATTERNS = + +# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using +# INPUT_FILTER) will also be used to filter the input files that are used for +# producing the source files to browse (i.e. when SOURCE_BROWSER is set to YES). +# The default value is: NO. + +FILTER_SOURCE_FILES = NO + +# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file +# pattern. A pattern will override the setting for FILTER_PATTERN (if any) and +# it is also possible to disable source filtering for a specific pattern using +# *.ext= (so without naming a filter). +# This tag requires that the tag FILTER_SOURCE_FILES is set to YES. + +FILTER_SOURCE_PATTERNS = + +# If the USE_MDFILE_AS_MAINPAGE tag refers to the name of a markdown file that +# is part of the input, its contents will be placed on the main page +# (index.html). This can be useful if you have a project on for instance GitHub +# and want to reuse the introduction page also for the doxygen output. + +USE_MDFILE_AS_MAINPAGE = + +#--------------------------------------------------------------------------- +# Configuration options related to source browsing +#--------------------------------------------------------------------------- + +# If the SOURCE_BROWSER tag is set to YES then a list of source files will be +# generated. Documented entities will be cross-referenced with these sources. +# +# Note: To get rid of all source code in the generated output, make sure that +# also VERBATIM_HEADERS is set to NO. +# The default value is: NO. + +SOURCE_BROWSER = NO + +# Setting the INLINE_SOURCES tag to YES will include the body of functions, +# classes and enums directly into the documentation. +# The default value is: NO. + +INLINE_SOURCES = NO + +# Setting the STRIP_CODE_COMMENTS tag to YES will instruct doxygen to hide any +# special comment blocks from generated source code fragments. Normal C, C++ and +# Fortran comments will always remain visible. +# The default value is: YES. + +STRIP_CODE_COMMENTS = YES + +# If the REFERENCED_BY_RELATION tag is set to YES then for each documented +# function all documented functions referencing it will be listed. +# The default value is: NO. + +REFERENCED_BY_RELATION = NO + +# If the REFERENCES_RELATION tag is set to YES then for each documented function +# all documented entities called/used by that function will be listed. +# The default value is: NO. + +REFERENCES_RELATION = NO + +# If the REFERENCES_LINK_SOURCE tag is set to YES and SOURCE_BROWSER tag is set +# to YES then the hyperlinks from functions in REFERENCES_RELATION and +# REFERENCED_BY_RELATION lists will link to the source code. Otherwise they will +# link to the documentation. +# The default value is: YES. + +REFERENCES_LINK_SOURCE = YES + +# If SOURCE_TOOLTIPS is enabled (the default) then hovering a hyperlink in the +# source code will show a tooltip with additional information such as prototype, +# brief description and links to the definition and documentation. Since this +# will make the HTML file larger and loading of large files a bit slower, you +# can opt to disable this feature. +# The default value is: YES. +# This tag requires that the tag SOURCE_BROWSER is set to YES. + +SOURCE_TOOLTIPS = YES + +# If the USE_HTAGS tag is set to YES then the references to source code will +# point to the HTML generated by the htags(1) tool instead of doxygen built-in +# source browser. The htags tool is part of GNU's global source tagging system +# (see http://www.gnu.org/software/global/global.html). You will need version +# 4.8.6 or higher. +# +# To use it do the following: +# - Install the latest version of global +# - Enable SOURCE_BROWSER and USE_HTAGS in the config file +# - Make sure the INPUT points to the root of the source tree +# - Run doxygen as normal +# +# Doxygen will invoke htags (and that will in turn invoke gtags), so these +# tools must be available from the command line (i.e. in the search path). +# +# The result: instead of the source browser generated by doxygen, the links to +# source code will now point to the output of htags. +# The default value is: NO. +# This tag requires that the tag SOURCE_BROWSER is set to YES. + +USE_HTAGS = NO + +# If the VERBATIM_HEADERS tag is set the YES then doxygen will generate a +# verbatim copy of the header file for each class for which an include is +# specified. Set to NO to disable this. +# See also: Section \class. +# The default value is: YES. + +VERBATIM_HEADERS = YES + +# If the CLANG_ASSISTED_PARSING tag is set to YES then doxygen will use the +# clang parser (see: http://clang.llvm.org/) for more accurate parsing at the +# cost of reduced performance. This can be particularly helpful with template +# rich C++ code for which doxygen's built-in parser lacks the necessary type +# information. +# Note: The availability of this option depends on whether or not doxygen was +# generated with the -Duse-libclang=ON option for CMake. +# The default value is: NO. + +CLANG_ASSISTED_PARSING = NO + +# If clang assisted parsing is enabled you can provide the compiler with command +# line options that you would normally use when invoking the compiler. Note that +# the include paths will already be set by doxygen for the files and directories +# specified with INPUT and INCLUDE_PATH. +# This tag requires that the tag CLANG_ASSISTED_PARSING is set to YES. + +CLANG_OPTIONS = + +#--------------------------------------------------------------------------- +# Configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index of all +# compounds will be generated. Enable this if the project contains a lot of +# classes, structs, unions or interfaces. +# The default value is: YES. + +ALPHABETICAL_INDEX = YES + +# The COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns in +# which the alphabetical index list will be split. +# Minimum value: 1, maximum value: 20, default value: 5. +# This tag requires that the tag ALPHABETICAL_INDEX is set to YES. + +COLS_IN_ALPHA_INDEX = 5 + +# In case all classes in a project start with a common prefix, all classes will +# be put under the same header in the alphabetical index. The IGNORE_PREFIX tag +# can be used to specify a prefix (or a list of prefixes) that should be ignored +# while generating the index headers. +# This tag requires that the tag ALPHABETICAL_INDEX is set to YES. + +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# Configuration options related to the HTML output +#--------------------------------------------------------------------------- + +# If the GENERATE_HTML tag is set to YES, doxygen will generate HTML output +# The default value is: YES. + +GENERATE_HTML = YES + +# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. If a +# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of +# it. +# The default directory is: html. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_OUTPUT = html + +# The HTML_FILE_EXTENSION tag can be used to specify the file extension for each +# generated HTML page (for example: .htm, .php, .asp). +# The default value is: .html. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_FILE_EXTENSION = .html + +# The HTML_HEADER tag can be used to specify a user-defined HTML header file for +# each generated HTML page. If the tag is left blank doxygen will generate a +# standard header. +# +# To get valid HTML the header file that includes any scripts and style sheets +# that doxygen needs, which is dependent on the configuration options used (e.g. +# the setting GENERATE_TREEVIEW). It is highly recommended to start with a +# default header using +# doxygen -w html new_header.html new_footer.html new_stylesheet.css +# YourConfigFile +# and then modify the file new_header.html. See also section "Doxygen usage" +# for information on how to generate the default header that doxygen normally +# uses. +# Note: The header is subject to change so you typically have to regenerate the +# default header when upgrading to a newer version of doxygen. For a description +# of the possible markers and block names see the documentation. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_HEADER = + +# The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each +# generated HTML page. If the tag is left blank doxygen will generate a standard +# footer. See HTML_HEADER for more information on how to generate a default +# footer and what special commands can be used inside the footer. See also +# section "Doxygen usage" for information on how to generate the default footer +# that doxygen normally uses. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_FOOTER = + +# The HTML_STYLESHEET tag can be used to specify a user-defined cascading style +# sheet that is used by each HTML page. It can be used to fine-tune the look of +# the HTML output. If left blank doxygen will generate a default style sheet. +# See also section "Doxygen usage" for information on how to generate the style +# sheet that doxygen normally uses. +# Note: It is recommended to use HTML_EXTRA_STYLESHEET instead of this tag, as +# it is more robust and this tag (HTML_STYLESHEET) will in the future become +# obsolete. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_STYLESHEET = + +# The HTML_EXTRA_STYLESHEET tag can be used to specify additional user-defined +# cascading style sheets that are included after the standard style sheets +# created by doxygen. Using this option one can overrule certain style aspects. +# This is preferred over using HTML_STYLESHEET since it does not replace the +# standard style sheet and is therefore more robust against future updates. +# Doxygen will copy the style sheet files to the output directory. +# Note: The order of the extra style sheet files is of importance (e.g. the last +# style sheet in the list overrules the setting of the previous ones in the +# list). For an example see the documentation. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_EXTRA_STYLESHEET = + +# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or +# other source files which should be copied to the HTML output directory. Note +# that these files will be copied to the base HTML output directory. Use the +# $relpath^ marker in the HTML_HEADER and/or HTML_FOOTER files to load these +# files. In the HTML_STYLESHEET file, use the file name only. Also note that the +# files will be copied as-is; there are no commands or markers available. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_EXTRA_FILES = + +# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen +# will adjust the colors in the style sheet and background images according to +# this color. Hue is specified as an angle on a colorwheel, see +# http://en.wikipedia.org/wiki/Hue for more information. For instance the value +# 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300 +# purple, and 360 is red again. +# Minimum value: 0, maximum value: 359, default value: 220. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_COLORSTYLE_HUE = 220 + +# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors +# in the HTML output. For a value of 0 the output will use grayscales only. A +# value of 255 will produce the most vivid colors. +# Minimum value: 0, maximum value: 255, default value: 100. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_COLORSTYLE_SAT = 100 + +# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to the +# luminance component of the colors in the HTML output. Values below 100 +# gradually make the output lighter, whereas values above 100 make the output +# darker. The value divided by 100 is the actual gamma applied, so 80 represents +# a gamma of 0.8, The value 220 represents a gamma of 2.2, and 100 does not +# change the gamma. +# Minimum value: 40, maximum value: 240, default value: 80. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_COLORSTYLE_GAMMA = 80 + +# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML +# page will contain the date and time when the page was generated. Setting this +# to YES can help to show when doxygen was last run and thus if the +# documentation is up to date. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_TIMESTAMP = NO + +# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML +# documentation will contain sections that can be hidden and shown after the +# page has loaded. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_DYNAMIC_SECTIONS = NO + +# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of entries +# shown in the various tree structured indices initially; the user can expand +# and collapse entries dynamically later on. Doxygen will expand the tree to +# such a level that at most the specified number of entries are visible (unless +# a fully collapsed tree already exceeds this amount). So setting the number of +# entries 1 will produce a full collapsed tree by default. 0 is a special value +# representing an infinite number of entries and will result in a full expanded +# tree by default. +# Minimum value: 0, maximum value: 9999, default value: 100. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_INDEX_NUM_ENTRIES = 100 + +# If the GENERATE_DOCSET tag is set to YES, additional index files will be +# generated that can be used as input for Apple's Xcode 3 integrated development +# environment (see: http://developer.apple.com/tools/xcode/), introduced with +# OSX 10.5 (Leopard). To create a documentation set, doxygen will generate a +# Makefile in the HTML output directory. Running make will produce the docset in +# that directory and running make install will install the docset in +# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at +# startup. See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html +# for more information. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_DOCSET = NO + +# This tag determines the name of the docset feed. A documentation feed provides +# an umbrella under which multiple documentation sets from a single provider +# (such as a company or product suite) can be grouped. +# The default value is: Doxygen generated docs. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_FEEDNAME = "Doxygen generated docs" + +# This tag specifies a string that should uniquely identify the documentation +# set bundle. This should be a reverse domain-name style string, e.g. +# com.mycompany.MyDocSet. Doxygen will append .docset to the name. +# The default value is: org.doxygen.Project. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_BUNDLE_ID = org.doxygen.Project + +# The DOCSET_PUBLISHER_ID tag specifies a string that should uniquely identify +# the documentation publisher. This should be a reverse domain-name style +# string, e.g. com.mycompany.MyDocSet.documentation. +# The default value is: org.doxygen.Publisher. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_PUBLISHER_ID = org.doxygen.Publisher + +# The DOCSET_PUBLISHER_NAME tag identifies the documentation publisher. +# The default value is: Publisher. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_PUBLISHER_NAME = Publisher + +# If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three +# additional HTML index files: index.hhp, index.hhc, and index.hhk. The +# index.hhp is a project file that can be read by Microsoft's HTML Help Workshop +# (see: http://www.microsoft.com/en-us/download/details.aspx?id=21138) on +# Windows. +# +# The HTML Help Workshop contains a compiler that can convert all HTML output +# generated by doxygen into a single compiled HTML file (.chm). Compiled HTML +# files are now used as the Windows 98 help format, and will replace the old +# Windows help format (.hlp) on all Windows platforms in the future. Compressed +# HTML files also contain an index, a table of contents, and you can search for +# words in the documentation. The HTML workshop also contains a viewer for +# compressed HTML files. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_HTMLHELP = NO + +# The CHM_FILE tag can be used to specify the file name of the resulting .chm +# file. You can add a path in front of the file if the result should not be +# written to the html output directory. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +CHM_FILE = + +# The HHC_LOCATION tag can be used to specify the location (absolute path +# including file name) of the HTML help compiler (hhc.exe). If non-empty, +# doxygen will try to run the HTML help compiler on the generated index.hhp. +# The file has to be specified with full path. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +HHC_LOCATION = + +# The GENERATE_CHI flag controls if a separate .chi index file is generated +# (YES) or that it should be included in the master .chm file (NO). +# The default value is: NO. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +GENERATE_CHI = NO + +# The CHM_INDEX_ENCODING is used to encode HtmlHelp index (hhk), content (hhc) +# and project file content. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +CHM_INDEX_ENCODING = + +# The BINARY_TOC flag controls whether a binary table of contents is generated +# (YES) or a normal table of contents (NO) in the .chm file. Furthermore it +# enables the Previous and Next buttons. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +BINARY_TOC = NO + +# The TOC_EXPAND flag can be set to YES to add extra items for group members to +# the table of contents of the HTML help documentation and to the tree view. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +TOC_EXPAND = NO + +# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and +# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated that +# can be used as input for Qt's qhelpgenerator to generate a Qt Compressed Help +# (.qch) of the generated HTML documentation. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_QHP = NO + +# If the QHG_LOCATION tag is specified, the QCH_FILE tag can be used to specify +# the file name of the resulting .qch file. The path specified is relative to +# the HTML output folder. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QCH_FILE = + +# The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help +# Project output. For more information please see Qt Help Project / Namespace +# (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#namespace). +# The default value is: org.doxygen.Project. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_NAMESPACE = org.doxygen.Project + +# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt +# Help Project output. For more information please see Qt Help Project / Virtual +# Folders (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#virtual- +# folders). +# The default value is: doc. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_VIRTUAL_FOLDER = doc + +# If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom +# filter to add. For more information please see Qt Help Project / Custom +# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom- +# filters). +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_CUST_FILTER_NAME = + +# The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the +# custom filter to add. For more information please see Qt Help Project / Custom +# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom- +# filters). +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_CUST_FILTER_ATTRS = + +# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this +# project's filter section matches. Qt Help Project / Filter Attributes (see: +# http://qt-project.org/doc/qt-4.8/qthelpproject.html#filter-attributes). +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_SECT_FILTER_ATTRS = + +# The QHG_LOCATION tag can be used to specify the location of Qt's +# qhelpgenerator. If non-empty doxygen will try to run qhelpgenerator on the +# generated .qhp file. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHG_LOCATION = + +# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files will be +# generated, together with the HTML files, they form an Eclipse help plugin. To +# install this plugin and make it available under the help contents menu in +# Eclipse, the contents of the directory containing the HTML and XML files needs +# to be copied into the plugins directory of eclipse. The name of the directory +# within the plugins directory should be the same as the ECLIPSE_DOC_ID value. +# After copying Eclipse needs to be restarted before the help appears. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_ECLIPSEHELP = NO + +# A unique identifier for the Eclipse help plugin. When installing the plugin +# the directory name containing the HTML and XML files should also have this +# name. Each documentation set should have its own identifier. +# The default value is: org.doxygen.Project. +# This tag requires that the tag GENERATE_ECLIPSEHELP is set to YES. + +ECLIPSE_DOC_ID = org.doxygen.Project + +# If you want full control over the layout of the generated HTML pages it might +# be necessary to disable the index and replace it with your own. The +# DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) at top +# of each HTML page. A value of NO enables the index and the value YES disables +# it. Since the tabs in the index contain the same information as the navigation +# tree, you can set this option to YES if you also set GENERATE_TREEVIEW to YES. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +DISABLE_INDEX = NO + +# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index +# structure should be generated to display hierarchical information. If the tag +# value is set to YES, a side panel will be generated containing a tree-like +# index structure (just like the one that is generated for HTML Help). For this +# to work a browser that supports JavaScript, DHTML, CSS and frames is required +# (i.e. any modern browser). Windows users are probably better off using the +# HTML help feature. Via custom style sheets (see HTML_EXTRA_STYLESHEET) one can +# further fine-tune the look of the index. As an example, the default style +# sheet generated by doxygen has an example that shows how to put an image at +# the root of the tree instead of the PROJECT_NAME. Since the tree basically has +# the same information as the tab index, you could consider setting +# DISABLE_INDEX to YES when enabling this option. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_TREEVIEW = NO + +# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that +# doxygen will group on one line in the generated HTML documentation. +# +# Note that a value of 0 will completely suppress the enum values from appearing +# in the overview section. +# Minimum value: 0, maximum value: 20, default value: 4. +# This tag requires that the tag GENERATE_HTML is set to YES. + +ENUM_VALUES_PER_LINE = 4 + +# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be used +# to set the initial width (in pixels) of the frame in which the tree is shown. +# Minimum value: 0, maximum value: 1500, default value: 250. +# This tag requires that the tag GENERATE_HTML is set to YES. + +TREEVIEW_WIDTH = 250 + +# If the EXT_LINKS_IN_WINDOW option is set to YES, doxygen will open links to +# external symbols imported via tag files in a separate window. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +EXT_LINKS_IN_WINDOW = NO + +# Use this tag to change the font size of LaTeX formulas included as images in +# the HTML documentation. When you change the font size after a successful +# doxygen run you need to manually remove any form_*.png images from the HTML +# output directory to force them to be regenerated. +# Minimum value: 8, maximum value: 50, default value: 10. +# This tag requires that the tag GENERATE_HTML is set to YES. + +FORMULA_FONTSIZE = 10 + +# Use the FORMULA_TRANPARENT tag to determine whether or not the images +# generated for formulas are transparent PNGs. Transparent PNGs are not +# supported properly for IE 6.0, but are supported on all modern browsers. +# +# Note that when changing this option you need to delete any form_*.png files in +# the HTML output directory before the changes have effect. +# The default value is: YES. +# This tag requires that the tag GENERATE_HTML is set to YES. + +FORMULA_TRANSPARENT = YES + +# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see +# http://www.mathjax.org) which uses client side Javascript for the rendering +# instead of using pre-rendered bitmaps. Use this if you do not have LaTeX +# installed or if you want to formulas look prettier in the HTML output. When +# enabled you may also need to install MathJax separately and configure the path +# to it using the MATHJAX_RELPATH option. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +USE_MATHJAX = NO + +# When MathJax is enabled you can set the default output format to be used for +# the MathJax output. See the MathJax site (see: +# http://docs.mathjax.org/en/latest/output.html) for more details. +# Possible values are: HTML-CSS (which is slower, but has the best +# compatibility), NativeMML (i.e. MathML) and SVG. +# The default value is: HTML-CSS. +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_FORMAT = HTML-CSS + +# When MathJax is enabled you need to specify the location relative to the HTML +# output directory using the MATHJAX_RELPATH option. The destination directory +# should contain the MathJax.js script. For instance, if the mathjax directory +# is located at the same level as the HTML output directory, then +# MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax +# Content Delivery Network so you can quickly see the result without installing +# MathJax. However, it is strongly recommended to install a local copy of +# MathJax from http://www.mathjax.org before deployment. +# The default value is: http://cdn.mathjax.org/mathjax/latest. +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest + +# The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax +# extension names that should be enabled during MathJax rendering. For example +# MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_EXTENSIONS = + +# The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces +# of code that will be used on startup of the MathJax code. See the MathJax site +# (see: http://docs.mathjax.org/en/latest/output.html) for more details. For an +# example see the documentation. +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_CODEFILE = + +# When the SEARCHENGINE tag is enabled doxygen will generate a search box for +# the HTML output. The underlying search engine uses javascript and DHTML and +# should work on any modern browser. Note that when using HTML help +# (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET) +# there is already a search function so this one should typically be disabled. +# For large projects the javascript based search engine can be slow, then +# enabling SERVER_BASED_SEARCH may provide a better solution. It is possible to +# search using the keyboard; to jump to the search box use + S +# (what the is depends on the OS and browser, but it is typically +# , /