From 0ad0062f03795acd04ac1ec9885addfadee7a084 Mon Sep 17 00:00:00 2001 From: hasenradball Date: Fri, 27 Oct 2023 08:10:30 +0200 Subject: [PATCH] rework to be ready for Arduino Library registriy --- README.md | 44 +++++++++++++++---- ...o_example.cpp => Arduino_Nano_example.ino} | 0 keyword.txt | 20 +++++++++ library.json | 4 +- library.properties | 10 +++++ .../Bosch_BME280_Arduino.cpp | 0 .../Bosch_BME280_Arduino.h | 0 7 files changed, 67 insertions(+), 11 deletions(-) rename examples/{Arduino_Nano_example.cpp => Arduino_Nano_example.ino} (100%) create mode 100644 keyword.txt create mode 100644 library.properties rename Bosch_BME280_Arduino.cpp => src/Bosch_BME280_Arduino.cpp (100%) rename Bosch_BME280_Arduino.h => src/Bosch_BME280_Arduino.h (100%) diff --git a/README.md b/README.md index 91eef53..5143060 100644 --- a/README.md +++ b/README.md @@ -1,21 +1,31 @@ # Bosch BME280 Arduino based on Bosch BME280_driver v3.5.1 +List of content
+* [About](#about)
+* [Functionality](#functionality)
+* [Namespace](#namespace)
+* [Methods](#methods)
+* [Example](#example)
+* [Compatibility](#compatibility) +* [Copyright](#copyright) + + ## About The Bosch BME280 is an environmental sensor which is able to measure temperature, humidity and air pressure. -This library is based on the Bosch Sensortec BME280 driver API v3.5.1, and is intented to measure the these environmental signals via I²C connection on an Arduino based or ESP based microcontroller. +This library is based on the Bosch Sensortec BME280 driver API v3.5.1, and is intented to measure these environmental signals via I²C connection on an Arduino based or ESP based microcontroller. -The github repository of Bosch Sensortec is: https://github.com/BoschSensortec/BME280_driver +The github repository of Bosch Sensortec is: [Github BOSCH Sensor Driver](https://github.com/BoschSensortec/BME280_driver) -The website of the BME280 on Bosch Sensortec is: https://www.bosch-sensortec.com/products/environmental-sensors/humidity-sensors-bme280/ +The website of the BME280 on Bosch Sensortec is: [Bosch Sensortec BME280](https://www.bosch-sensortec.com/products/environmental-sensors/humidity-sensors-bme280/) ## Functionality The original Bosch driver is included in this package and it has not been modified in any way. The Bosch BME280 sensor do have 3 operation modes. -1. Sleep mode - the sensor is in sleep mode after power on reset. No measurements are performed and power consumtion is on minimum. -2. Forced mode - one single measurement is performed and returns then to sleep mode. The measurements can be obtained from the data registers. -3. Normal mode - cyclic measurements are performed. The measurements can be obtained fron the data registers. +1. **Sleep mode** - the sensor is in sleep mode after power on reset. No measurements are performed and power consumtion is on minimum. +2. **Forced mode** - one single measurement is performed and returns then to sleep mode. The measurements can be obtained from the data registers. +3. **Normal mode** - cyclic measurements are performed. The measurements can be obtained fron the data registers. ## Namespace This Bosch BME280 Wraper uses a namespace as `BME` so if you construct the object you have to call: @@ -52,7 +62,17 @@ getHumidity() getPressure() getSealevelForAltitude() ``` -### Short Example +#### Sensor Status +Also it is possible to get and set the sensor status. +``` +int8_t status = getSensorStatus(); +setSensorStatus(status); +``` + +### Example +See also in: +[Arduino_Nano_example.ino](https://github.com/hasenradball/Bosch_BME280_Arduino/blob/master/examples/Arduino_Nano_example.ino) + ``` #include #include @@ -89,12 +109,18 @@ void loop() { ## Compatibility -* Tested with Arduino Nano, ESP8266 and ESP32 +Tested with: +* Arduino Nano +* ESP8266 +* ESP32 +* Arduino Nano 33 IOT ## Copyright -The Files: +The Files of the original Bosch BME280 driver API: * bme280.c * bme280.h * bme280_defs.h are Copyright (c) 2013 - 2017 by Bosch Sensortec GmbH + +[back to top](#bosch-bme280-arduino) \ No newline at end of file diff --git a/examples/Arduino_Nano_example.cpp b/examples/Arduino_Nano_example.ino similarity index 100% rename from examples/Arduino_Nano_example.cpp rename to examples/Arduino_Nano_example.ino diff --git a/keyword.txt b/keyword.txt new file mode 100644 index 0000000..44cc8df --- /dev/null +++ b/keyword.txt @@ -0,0 +1,20 @@ +# Syntax Coloring Map For Bosch_BME280_Arduino Library + +# Datatypes (KEYWORD1) +BME KEYWORD1 +Bosch_BME280 KEYWORD1 + +# Methods and Functions (KEYWORD2) +begin KEYWORD2 +measure KEYWORD2 +getTemperature KEYWORD2 +getHumidity KEYWORD2 +getPressure KEYWORD2 +getSealevelForAltitude KEYWORD2 +getSensorStatus KEYWORD2 +setSensorStatus KEYWORD2 + + +# Constants (LITERAL1) +BME280_I2C_ADDR_PRIM LITERAL1 +BME280_I2C_ADDR_SEC LITERAL1 \ No newline at end of file diff --git a/library.json b/library.json index c9904dd..15c9779 100644 --- a/library.json +++ b/library.json @@ -1,6 +1,6 @@ { "name": "Bosch_BME280_Arduino", - "version": "1.0.1", + "version": "1.0.2", "repository": { "type": "git", @@ -16,5 +16,5 @@ "maintainer": true }, "frameworks": ["Arduino"], - "platforms": ["atmelavr", "espressif8266", "espressif32"] + "platforms": ["atmelavr", "espressif8266", "espressif32", "atmelsam"] } \ No newline at end of file diff --git a/library.properties b/library.properties new file mode 100644 index 0000000..4c986ba --- /dev/null +++ b/library.properties @@ -0,0 +1,10 @@ +name=Bosch_BME280_Arduino +version=1.0.2 +author=Frank Häfele +maintainer=Frank Häfele +sentence=C++ Library for the Bosch BME280 Sensor based on the original Bosch Sensor API v3.5.1 +paragraph=Provides a Namespace, setter and getter functions to get access to read temperature, humidity amd pressure signals. +category=Sensors +url=https://github.com/hasenradball/Bosch_BME280_Arduino +architectures=* +includes=Bosch_BME280_Arduino.h \ No newline at end of file diff --git a/Bosch_BME280_Arduino.cpp b/src/Bosch_BME280_Arduino.cpp similarity index 100% rename from Bosch_BME280_Arduino.cpp rename to src/Bosch_BME280_Arduino.cpp diff --git a/Bosch_BME280_Arduino.h b/src/Bosch_BME280_Arduino.h similarity index 100% rename from Bosch_BME280_Arduino.h rename to src/Bosch_BME280_Arduino.h