Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/utkumaden/esp-idf-bmx280
BMP280 and BME280 I2C driver for ESP32 boards using the IDF toolchain.
https://github.com/utkumaden/esp-idf-bmx280
bme280 bmp280 bosch-sensor c esp-idf esp32 esspressif humidity-sensor pressure-sensor temperature-sensor
Last synced: 4 months ago
JSON representation
BMP280 and BME280 I2C driver for ESP32 boards using the IDF toolchain.
- Host: GitHub
- URL: https://github.com/utkumaden/esp-idf-bmx280
- Owner: utkumaden
- License: mit
- Created: 2020-11-06T10:03:00.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2024-05-01T08:51:27.000Z (9 months ago)
- Last Synced: 2024-05-01T17:27:00.853Z (9 months ago)
- Topics: bme280, bmp280, bosch-sensor, c, esp-idf, esp32, esspressif, humidity-sensor, pressure-sensor, temperature-sensor
- Language: C
- Homepage:
- Size: 16.6 KB
- Stars: 18
- Watchers: 1
- Forks: 6
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
BMX280 for ESP-IDF
==================
BMX280 is a basic I2C based driver for ESP32 devices licensed mostly under MIT.
(See caption "License" for details.)Usage
-----
Clone this repository or add it as a submodule into your components directory.
Add the module as a requirement to your main module, or other modules.Example Code
------------
```c
#include "esp_log.h"
#include "bmx280.h"void app_main(void)
{
// Entry Point
//ESP_ERROR_CHECK(nvs_flash_init());
i2c_config_t i2c_cfg = {
.mode = I2C_MODE_MASTER,
.sda_io_num = GPIO_NUM_17,
.scl_io_num = GPIO_NUM_16,
.sda_pullup_en = false,
.scl_pullup_en = false,.master = {
.clk_speed = 100000
}
};ESP_ERROR_CHECK(i2c_param_config(I2C_NUM_0, &i2c_cfg));
ESP_ERROR_CHECK(i2c_driver_install(I2C_NUM_0, I2C_MODE_MASTER, 0, 0, 0));bmx280_t* bmx280 = bmx280_create(I2C_NUM_0);
if (!bmx280) {
ESP_LOGE("test", "Could not create bmx280 driver.");
return;
}ESP_ERROR_CHECK(bmx280_init(bmx280));
bmx280_config_t bmx_cfg = BMX280_DEFAULT_CONFIG;
ESP_ERROR_CHECK(bmx280_configure(bmx280, &bmx_cfg));while (1)
{
ESP_ERROR_CHECK(bmx280_setMode(bmx280, BMX280_MODE_FORCE));
do {
vTaskDelay(pdMS_TO_TICKS(1));
} while(bmx280_isSampling(bmx280));float temp = 0, pres = 0, hum = 0;
ESP_ERROR_CHECK(bmx280_readoutFloat(bmx280, &temp, &pres, &hum));ESP_LOGI("test", "Read Values: temp = %f, pres = %f, hum = %f", temp, pres, hum);
}
}
```License
-------
This repository contains a lot of code I have written which is licensed under
MIT, however there are sections modified from the BME280 datasheet which is
unclearly licensed.The unclearly licensed section is clearly marked with two comments. Any code
between `// HERE BE DRAGONS` and `// END OF DRAGONS` contains modified versions
of the Bosch Sensortec code.Please take note of this in production.