From 0b243f0ec1d574ffb820f65ef94d5258c1d2c9af Mon Sep 17 00:00:00 2001 From: Lady Ada Date: Sun, 29 Dec 2019 02:41:32 -0500 Subject: [PATCH 1/7] add actions & bump major version --- .github/workflows/githubci.yml | 32 ++++++++++++++++++++++++++++++++ .travis.yml | 26 -------------------------- README.md | 2 +- library.properties | 2 +- 4 files changed, 34 insertions(+), 28 deletions(-) create mode 100644 .github/workflows/githubci.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/githubci.yml b/.github/workflows/githubci.yml new file mode 100644 index 0000000..863911e --- /dev/null +++ b/.github/workflows/githubci.yml @@ -0,0 +1,32 @@ +name: Arduino Library CI + +on: [pull_request, push] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/setup-python@v1 + with: + python-version: '3.x' + - uses: actions/checkout@v2 + - uses: actions/checkout@v2 + with: + repository: adafruit/ci-arduino + path: ci + + - name: pre-install + run: bash ci/actions_install.sh + + - name: test platforms + run: python3 ci/build_platform.py main_platforms + + - name: clang + run: python3 ci/run-clang-format.py -e "ci/*" -e "bin/*" -r . + + - name: doxygen + env: + GH_REPO_TOKEN: ${{ secrets.GH_REPO_TOKEN }} + PRETTYNAME : "Adafruit BME280 Library" + run: bash ci/doxy_gen_and_deploy.sh diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index bdf8cd1..0000000 --- a/.travis.yml +++ /dev/null @@ -1,26 +0,0 @@ -language: c -sudo: false -cache: - directories: - - ~/arduino_ide - - ~/.arduino15/packages/ -git: - depth: false - quiet: true -env: - global: - - PRETTYNAME="Adafruit BME280 Arduino Library" - -before_install: - - source <(curl -SLs https://raw.githubusercontent.com/adafruit/travis-ci-arduino/master/install.sh) - -install: - - arduino --install-library "Adafruit Unified Sensor" - -script: - - build_main_platforms - -# Generate and deploy documentation -after_success: - - source <(curl -SLs https://raw.githubusercontent.com/adafruit/travis-ci-arduino/master/library_check.sh) - - source <(curl -SLs https://raw.githubusercontent.com/adafruit/travis-ci-arduino/master/doxy_gen_and_deploy.sh) diff --git a/README.md b/README.md index 2ba2668..397b400 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Adafruit BME280 Library [![Build Status](https://travis-ci.com/adafruit/Adafruit_BME280_Library.svg?branch=master)](https://travis-ci.com/adafruit/Adafruit_BME280_Library) +# Adafruit BME280 Library ![Build Status](https://github.com/adafruit/Adafruit_BME280_Library/workflows/Arduino%20Library%20CI/badge.svg) diff --git a/library.properties b/library.properties index 28559a4..67d0164 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=Adafruit BME280 Library -version=1.1.0 +version=2.0.0 author=Adafruit maintainer=Adafruit sentence=Arduino library for BME280 sensors. From f107b13f1f75017838e9c368ace1195f5bc06c14 Mon Sep 17 00:00:00 2001 From: Lady Ada Date: Sun, 29 Dec 2019 02:46:31 -0500 Subject: [PATCH 2/7] fix advanced begin() --- examples/advancedsettings/advancedsettings.ino | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/advancedsettings/advancedsettings.ino b/examples/advancedsettings/advancedsettings.ino index b4f0810..df1f5eb 100644 --- a/examples/advancedsettings/advancedsettings.ino +++ b/examples/advancedsettings/advancedsettings.ino @@ -38,7 +38,7 @@ void setup() { Serial.begin(9600); Serial.println(F("BME280 test")); - if (! bme.begin(&Wire)) { + if (! bme.begin(0x77, &Wire)) { Serial.println("Could not find a valid BME280 sensor, check wiring!"); while (1); } From 9c75a42a5c1264fa060d8762e8c13ae44fef2ce4 Mon Sep 17 00:00:00 2001 From: Lady Ada Date: Sun, 29 Dec 2019 02:54:44 -0500 Subject: [PATCH 3/7] clang & add temp/pressure Adafruit_Sensor components --- Adafruit_BME280.cpp | 98 ++++++++++++++++++++++++++++++++++++++++++++- Adafruit_BME280.h | 57 ++++++++++++++++---------- 2 files changed, 133 insertions(+), 22 deletions(-) diff --git a/Adafruit_BME280.cpp b/Adafruit_BME280.cpp index bc0bdad..e716c2a 100644 --- a/Adafruit_BME280.cpp +++ b/Adafruit_BME280.cpp @@ -153,7 +153,6 @@ void Adafruit_BME280::setSampling(sensor_mode mode, // making sure sensor is in sleep mode before setting configuration // as it otherwise may be ignored write8(BME280_REGISTER_CONTROL, MODE_SLEEP); - // you must make sure to also set REGISTER_CONTROL after setting the // CONTROLHUMID register, otherwise the values won't be applied (see @@ -528,3 +527,100 @@ float Adafruit_BME280::seaLevelForAltitude(float altitude, float atmospheric) { * @returns Sensor ID 0x60 for BME280, 0x56, 0x57, 0x58 BMP280 */ uint32_t Adafruit_BME280::sensorID(void) { return _sensorID; } + +/*! + @brief Gets an Adafruit Unified Sensor object for the temp sensor component + @return Adafruit_Sensor pointer to temperature sensor + */ +Adafruit_Sensor *Adafruit_BME280::getTemperatureSensor(void) { + return temp_sensor; +} + +/*! + @brief Gets an Adafruit Unified Sensor object for the pressure sensor + component + @return Adafruit_Sensor pointer to pressure sensor + */ +Adafruit_Sensor *Adafruit_BME280::getPressureSensor(void) { + return pressure_sensor; +} + +/**************************************************************************/ +/*! + @brief Gets the sensor_t data for the BME280's temperature sensor +*/ +/**************************************************************************/ +void Adafruit_BME280_Temp::getSensor(sensor_t *sensor) { + /* Clear the sensor_t object */ + memset(sensor, 0, sizeof(sensor_t)); + + /* Insert the sensor name in the fixed length char array */ + strncpy(sensor->name, "BME280", sizeof(sensor->name) - 1); + sensor->name[sizeof(sensor->name) - 1] = 0; + sensor->version = 1; + sensor->sensor_id = _sensorID; + sensor->type = SENSOR_TYPE_AMBIENT_TEMPERATURE; + sensor->min_delay = 0; + sensor->max_value = -40.0; /* Temperature range -40 ~ +85 C */ + sensor->min_value = +85.0; + sensor->resolution = 0.01; /* 0.01 C */ +} + +/**************************************************************************/ +/*! + @brief Gets the temperature as a standard sensor event + @param event Sensor event object that will be populated + @returns True +*/ +/**************************************************************************/ +bool Adafruit_BME280_Temp::getEvent(sensors_event_t *event) { + /* Clear the event */ + memset(event, 0, sizeof(sensors_event_t)); + + event->version = sizeof(sensors_event_t); + event->sensor_id = _sensorID; + event->type = SENSOR_TYPE_AMBIENT_TEMPERATURE; + event->timestamp = millis(); + event->temperature = _theBME280->readTemperature(); + return true; +} + +/**************************************************************************/ +/*! + @brief Gets the sensor_t data for the BME280's pressure sensor +*/ +/**************************************************************************/ +void Adafruit_BME280_Pressure::getSensor(sensor_t *sensor) { + /* Clear the sensor_t object */ + memset(sensor, 0, sizeof(sensor_t)); + + /* Insert the sensor name in the fixed length char array */ + strncpy(sensor->name, "BME280", sizeof(sensor->name) - 1); + sensor->name[sizeof(sensor->name) - 1] = 0; + sensor->version = 1; + sensor->sensor_id = _sensorID; + sensor->type = SENSOR_TYPE_PRESSURE; + sensor->min_delay = 0; + sensor->max_value = 300.0; /* 300 ~ 1100 hPa */ + sensor->min_value = 1100.0; + sensor->resolution = 0.012; /* 0.12 hPa relative */ +} + +/**************************************************************************/ +/*! + @brief Gets the pressure as a standard sensor event + @param event Sensor event object that will be populated + @returns True +*/ +/**************************************************************************/ +bool Adafruit_BME280_Pressure::getEvent(sensors_event_t *event) { + /* Clear the event */ + memset(event, 0, sizeof(sensors_event_t)); + + event->version = sizeof(sensors_event_t); + event->sensor_id = _sensorID; + event->type = SENSOR_TYPE_PRESSURE; + event->timestamp = millis(); + event->pressure = _theBME280->readPressure() / 100; // convert Pa to hPa + return true; +} diff --git a/Adafruit_BME280.h b/Adafruit_BME280.h index db1cdda..552b6b8 100644 --- a/Adafruit_BME280.h +++ b/Adafruit_BME280.h @@ -105,26 +105,35 @@ typedef struct { } 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; + +/** Adafruit Unified Sensor interface for temperature component of BME280 */ +class Adafruit_BME280_Temp : public Adafruit_Sensor { +public: + /** @brief Create an Adafruit_Sensor compatible object for the temp sensor + @param parent A pointer to the BME280 class */ + Adafruit_BME280_Temp(Adafruit_BME280 *parent) { _theBME280 = parent; } + bool getEvent(sensors_event_t *); + void getSensor(sensor_t *); + +private: + int _sensorID = 280; + Adafruit_BME280 *_theBME280 = NULL; }; -*/ +/** Adafruit Unified Sensor interface for pressure component of BME280 */ +class Adafruit_BME280_Pressure : public Adafruit_Sensor { +public: + /** @brief Create an Adafruit_Sensor compatible object for the pressure sensor + @param parent A pointer to the BME280 class */ + Adafruit_BME280_Pressure(Adafruit_BME280 *parent) { _theBME280 = parent; } + bool getEvent(sensors_event_t *); + void getSensor(sensor_t *); + +private: + int _sensorID = 0; + Adafruit_BME280 *_theBME280 = NULL; +}; /**************************************************************************/ /*! @@ -190,10 +199,9 @@ class Adafruit_BME280 { // constructors Adafruit_BME280(); Adafruit_BME280(int8_t cspin, SPIClass *theSPI = &SPI); - Adafruit_BME280(int8_t cspin, int8_t mosipin, int8_t misopin, - int8_t sckpin); + Adafruit_BME280(int8_t cspin, int8_t mosipin, int8_t misopin, int8_t sckpin); - bool begin(uint8_t addr=BME280_ADDRESS, TwoWire *theWire=&Wire); + bool begin(uint8_t addr = BME280_ADDRESS, TwoWire *theWire = &Wire); bool init(); void setSampling(sensor_mode mode = MODE_NORMAL, @@ -212,9 +220,16 @@ class Adafruit_BME280 { float seaLevelForAltitude(float altitude, float pressure); uint32_t sensorID(void); + Adafruit_Sensor *getTemperatureSensor(void); + Adafruit_Sensor *getPressureSensor(void); + protected: TwoWire *_wire; //!< pointer to a TwoWire object SPIClass *_spi; //!< pointer to SPI object + + Adafruit_BME280_Temp *temp_sensor = NULL; + Adafruit_BME280_Pressure *pressure_sensor = NULL; + void readCoefficients(void); bool isReadingCalibration(void); uint8_t spixfer(uint8_t x); From 610d7292df14c6403ef829634c747c39b790917d Mon Sep 17 00:00:00 2001 From: Lady Ada Date: Sun, 29 Dec 2019 03:01:52 -0500 Subject: [PATCH 4/7] clang some more, add a humidity object --- Adafruit_BME280.cpp | 49 +++++++++++++++++++++++++++++++++++++++++++++ Adafruit_BME280.h | 18 ++++++++++++++++- 2 files changed, 66 insertions(+), 1 deletion(-) diff --git a/Adafruit_BME280.cpp b/Adafruit_BME280.cpp index e716c2a..18112ce 100644 --- a/Adafruit_BME280.cpp +++ b/Adafruit_BME280.cpp @@ -545,6 +545,15 @@ Adafruit_Sensor *Adafruit_BME280::getPressureSensor(void) { return pressure_sensor; } +/*! + @brief Gets an Adafruit Unified Sensor object for the humidity sensor + component + @return Adafruit_Sensor pointer to humidity sensor + */ +Adafruit_Sensor *Adafruit_BME280::getHumiditySensor(void) { + return humidity_sensor; +} + /**************************************************************************/ /*! @brief Gets the sensor_t data for the BME280's temperature sensor @@ -624,3 +633,43 @@ bool Adafruit_BME280_Pressure::getEvent(sensors_event_t *event) { event->pressure = _theBME280->readPressure() / 100; // convert Pa to hPa return true; } + +/**************************************************************************/ +/*! + @brief Gets the sensor_t data for the BME280's humidity sensor +*/ +/**************************************************************************/ +void Adafruit_BME280_Humidity::getSensor(sensor_t *sensor) { + /* Clear the sensor_t object */ + memset(sensor, 0, sizeof(sensor_t)); + + /* Insert the sensor name in the fixed length char array */ + strncpy(sensor->name, "BME280", sizeof(sensor->name) - 1); + sensor->name[sizeof(sensor->name) - 1] = 0; + sensor->version = 1; + sensor->sensor_id = _sensorID; + sensor->type = SENSOR_TYPE_RELATIVE_HUMIDITY; + sensor->min_delay = 0; + sensor->min_value = 0; + sensor->max_value = 100; /* 0 - 100 % */ + sensor->resolution = 3; /* 3% accuracy */ +} + +/**************************************************************************/ +/*! + @brief Gets the humidity as a standard sensor event + @param event Sensor event object that will be populated + @returns True +*/ +/**************************************************************************/ +bool Adafruit_BME280_Humidity::getEvent(sensors_event_t *event) { + /* Clear the event */ + memset(event, 0, sizeof(sensors_event_t)); + + event->version = sizeof(sensors_event_t); + event->sensor_id = _sensorID; + event->type = SENSOR_TYPE_RELATIVE_HUMIDITY; + event->timestamp = millis(); + event->relative_humidity = _theBME280->readHumidity(); + return true; +} diff --git a/Adafruit_BME280.h b/Adafruit_BME280.h index 552b6b8..203edf0 100644 --- a/Adafruit_BME280.h +++ b/Adafruit_BME280.h @@ -135,6 +135,20 @@ class Adafruit_BME280_Pressure : public Adafruit_Sensor { Adafruit_BME280 *_theBME280 = NULL; }; +/** Adafruit Unified Sensor interface for humidity component of BME280 */ +class Adafruit_BME280_Humidity : public Adafruit_Sensor { +public: + /** @brief Create an Adafruit_Sensor compatible object for the humidity sensor + @param parent A pointer to the BME280 class */ + Adafruit_BME280_Humidity(Adafruit_BME280 *parent) { _theBME280 = parent; } + bool getEvent(sensors_event_t *); + void getSensor(sensor_t *); + +private: + int _sensorID = 0; + Adafruit_BME280 *_theBME280 = NULL; +}; + /**************************************************************************/ /*! @brief Class that stores state and functions for interacting with BME280 IC @@ -222,13 +236,15 @@ class Adafruit_BME280 { Adafruit_Sensor *getTemperatureSensor(void); Adafruit_Sensor *getPressureSensor(void); + Adafruit_Sensor *getHumiditySensor(void); protected: TwoWire *_wire; //!< pointer to a TwoWire object SPIClass *_spi; //!< pointer to SPI object - + Adafruit_BME280_Temp *temp_sensor = NULL; Adafruit_BME280_Pressure *pressure_sensor = NULL; + Adafruit_BME280_Humidity *humidity_sensor = NULL; void readCoefficients(void); bool isReadingCalibration(void); From ebf5715aba3e780cd0b19112ffad302423d1e1c4 Mon Sep 17 00:00:00 2001 From: Lady Ada Date: Sun, 29 Dec 2019 03:24:43 -0500 Subject: [PATCH 5/7] example for unified sensors --- Adafruit_BME280.cpp | 33 ++++++++++-- Adafruit_BME280.h | 9 ++-- examples/bme280_unified/bme280_unified.ino | 62 ++++++++++++++++++++++ 3 files changed, 97 insertions(+), 7 deletions(-) create mode 100644 examples/bme280_unified/bme280_unified.ino diff --git a/Adafruit_BME280.cpp b/Adafruit_BME280.cpp index 18112ce..cb4fe58 100644 --- a/Adafruit_BME280.cpp +++ b/Adafruit_BME280.cpp @@ -61,6 +61,21 @@ Adafruit_BME280::Adafruit_BME280(int8_t cspin, int8_t mosipin, int8_t misopin, int8_t sckpin) : _cs(cspin), _mosi(mosipin), _miso(misopin), _sck(sckpin) {} + + +Adafruit_BME280::~Adafruit_BME280(void) { + if (temp_sensor) { + delete temp_sensor; + } + if (pressure_sensor) { + delete pressure_sensor; + } + if (humidity_sensor) { + delete humidity_sensor; + } +} + + /*! * @brief Initialise sensor with given parameters / settings * @param addr the I2C address the device can be found on @@ -533,6 +548,10 @@ uint32_t Adafruit_BME280::sensorID(void) { return _sensorID; } @return Adafruit_Sensor pointer to temperature sensor */ Adafruit_Sensor *Adafruit_BME280::getTemperatureSensor(void) { + if (! temp_sensor) { + temp_sensor = new Adafruit_BME280_Temp(this); + } + return temp_sensor; } @@ -542,6 +561,9 @@ Adafruit_Sensor *Adafruit_BME280::getTemperatureSensor(void) { @return Adafruit_Sensor pointer to pressure sensor */ Adafruit_Sensor *Adafruit_BME280::getPressureSensor(void) { + if (! pressure_sensor) { + pressure_sensor = new Adafruit_BME280_Pressure(this); + } return pressure_sensor; } @@ -551,6 +573,9 @@ Adafruit_Sensor *Adafruit_BME280::getPressureSensor(void) { @return Adafruit_Sensor pointer to humidity sensor */ Adafruit_Sensor *Adafruit_BME280::getHumiditySensor(void) { + if (! humidity_sensor) { + humidity_sensor = new Adafruit_BME280_Humidity(this); + } return humidity_sensor; } @@ -570,8 +595,8 @@ void Adafruit_BME280_Temp::getSensor(sensor_t *sensor) { sensor->sensor_id = _sensorID; sensor->type = SENSOR_TYPE_AMBIENT_TEMPERATURE; sensor->min_delay = 0; - sensor->max_value = -40.0; /* Temperature range -40 ~ +85 C */ - sensor->min_value = +85.0; + sensor->min_value = -40.0; /* Temperature range -40 ~ +85 C */ + sensor->max_value = +85.0; sensor->resolution = 0.01; /* 0.01 C */ } @@ -610,8 +635,8 @@ void Adafruit_BME280_Pressure::getSensor(sensor_t *sensor) { sensor->sensor_id = _sensorID; sensor->type = SENSOR_TYPE_PRESSURE; sensor->min_delay = 0; - sensor->max_value = 300.0; /* 300 ~ 1100 hPa */ - sensor->min_value = 1100.0; + sensor->min_value = 300.0; /* 300 ~ 1100 hPa */ + sensor->max_value = 1100.0; sensor->resolution = 0.012; /* 0.12 hPa relative */ } diff --git a/Adafruit_BME280.h b/Adafruit_BME280.h index 203edf0..aac229a 100644 --- a/Adafruit_BME280.h +++ b/Adafruit_BME280.h @@ -131,7 +131,7 @@ class Adafruit_BME280_Pressure : public Adafruit_Sensor { void getSensor(sensor_t *); private: - int _sensorID = 0; + int _sensorID = 280; Adafruit_BME280 *_theBME280 = NULL; }; @@ -145,7 +145,7 @@ class Adafruit_BME280_Humidity : public Adafruit_Sensor { void getSensor(sensor_t *); private: - int _sensorID = 0; + int _sensorID = 280; Adafruit_BME280 *_theBME280 = NULL; }; @@ -214,7 +214,7 @@ class Adafruit_BME280 { Adafruit_BME280(); Adafruit_BME280(int8_t cspin, SPIClass *theSPI = &SPI); Adafruit_BME280(int8_t cspin, int8_t mosipin, int8_t misopin, int8_t sckpin); - + ~Adafruit_BME280(void); bool begin(uint8_t addr = BME280_ADDRESS, TwoWire *theWire = &Wire); bool init(); @@ -242,8 +242,11 @@ class Adafruit_BME280 { TwoWire *_wire; //!< pointer to a TwoWire object SPIClass *_spi; //!< pointer to SPI object + //!< Adafruit_Sensor compat temperature sensor component Adafruit_BME280_Temp *temp_sensor = NULL; + //!< Adafruit_Sensor compat pressure sensor component Adafruit_BME280_Pressure *pressure_sensor = NULL; + //!< Adafruit_Sensor compat humidity sensor component Adafruit_BME280_Humidity *humidity_sensor = NULL; void readCoefficients(void); diff --git a/examples/bme280_unified/bme280_unified.ino b/examples/bme280_unified/bme280_unified.ino new file mode 100644 index 0000000..8a67af4 --- /dev/null +++ b/examples/bme280_unified/bme280_unified.ino @@ -0,0 +1,62 @@ +/*************************************************************************** + This is a library for the BME280 humidity, temperature & pressure sensor + This example shows how to take Sensor Events instead of direct readings + + Designed specifically to work with the Adafruit BME280 Breakout + ----> http://www.adafruit.com/products/2652 + + 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 and open-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 + +Adafruit_BME280 bme; // use I2C interface +Adafruit_Sensor *bme_temp = bme.getTemperatureSensor(); +Adafruit_Sensor *bme_pressure = bme.getPressureSensor(); +Adafruit_Sensor *bme_humidity = bme.getHumiditySensor(); + +void setup() { + Serial.begin(9600); + Serial.println(F("BME280 Sensor event test")); + + if (!bme.begin()) { + Serial.println(F("Could not find a valid BME280 sensor, check wiring!")); + while (1) delay(10); + } + + bme_temp->printSensorDetails(); + bme_pressure->printSensorDetails(); + bme_humidity->printSensorDetails(); +} + +void loop() { + sensors_event_t temp_event, pressure_event, humidity_event; + bme_temp->getEvent(&temp_event); + bme_pressure->getEvent(&pressure_event); + bme_humidity->getEvent(&humidity_event); + + Serial.print(F("Temperature = ")); + Serial.print(temp_event.temperature); + Serial.println(" *C"); + + Serial.print(F("Humidity = ")); + Serial.print(humidity_event.relative_humidity); + Serial.println(" %"); + + Serial.print(F("Pressure = ")); + Serial.print(pressure_event.pressure); + Serial.println(" hPa"); + + Serial.println(); + delay(1000); +} \ No newline at end of file From 0213f84f9fe1344b99042f3a8051f489ec1ddc5a Mon Sep 17 00:00:00 2001 From: Lady Ada Date: Sun, 29 Dec 2019 03:29:12 -0500 Subject: [PATCH 6/7] another clanground --- Adafruit_BME280.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/Adafruit_BME280.cpp b/Adafruit_BME280.cpp index cb4fe58..3be3280 100644 --- a/Adafruit_BME280.cpp +++ b/Adafruit_BME280.cpp @@ -61,8 +61,6 @@ Adafruit_BME280::Adafruit_BME280(int8_t cspin, int8_t mosipin, int8_t misopin, int8_t sckpin) : _cs(cspin), _mosi(mosipin), _miso(misopin), _sck(sckpin) {} - - Adafruit_BME280::~Adafruit_BME280(void) { if (temp_sensor) { delete temp_sensor; @@ -75,7 +73,6 @@ Adafruit_BME280::~Adafruit_BME280(void) { } } - /*! * @brief Initialise sensor with given parameters / settings * @param addr the I2C address the device can be found on @@ -548,7 +545,7 @@ uint32_t Adafruit_BME280::sensorID(void) { return _sensorID; } @return Adafruit_Sensor pointer to temperature sensor */ Adafruit_Sensor *Adafruit_BME280::getTemperatureSensor(void) { - if (! temp_sensor) { + if (!temp_sensor) { temp_sensor = new Adafruit_BME280_Temp(this); } @@ -561,7 +558,7 @@ Adafruit_Sensor *Adafruit_BME280::getTemperatureSensor(void) { @return Adafruit_Sensor pointer to pressure sensor */ Adafruit_Sensor *Adafruit_BME280::getPressureSensor(void) { - if (! pressure_sensor) { + if (!pressure_sensor) { pressure_sensor = new Adafruit_BME280_Pressure(this); } return pressure_sensor; @@ -573,7 +570,7 @@ Adafruit_Sensor *Adafruit_BME280::getPressureSensor(void) { @return Adafruit_Sensor pointer to humidity sensor */ Adafruit_Sensor *Adafruit_BME280::getHumiditySensor(void) { - if (! humidity_sensor) { + if (!humidity_sensor) { humidity_sensor = new Adafruit_BME280_Humidity(this); } return humidity_sensor; From ed29ee6360ce824c7f68b77c446aeceb7caf4292 Mon Sep 17 00:00:00 2001 From: Lady Ada Date: Sun, 29 Dec 2019 03:36:16 -0500 Subject: [PATCH 7/7] try fixing doxyplaint --- Adafruit_BME280.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Adafruit_BME280.h b/Adafruit_BME280.h index aac229a..5721a9a 100644 --- a/Adafruit_BME280.h +++ b/Adafruit_BME280.h @@ -242,12 +242,14 @@ class Adafruit_BME280 { TwoWire *_wire; //!< pointer to a TwoWire object SPIClass *_spi; //!< pointer to SPI object - //!< Adafruit_Sensor compat temperature sensor component Adafruit_BME280_Temp *temp_sensor = NULL; - //!< Adafruit_Sensor compat pressure sensor component + //!< Adafruit_Sensor compat temperature sensor component + Adafruit_BME280_Pressure *pressure_sensor = NULL; - //!< Adafruit_Sensor compat humidity sensor component + //!< Adafruit_Sensor compat pressure sensor component + Adafruit_BME280_Humidity *humidity_sensor = NULL; + //!< Adafruit_Sensor compat humidity sensor component void readCoefficients(void); bool isReadingCalibration(void);