mirror of
https://github.com/utkumaden/esp-idf-bmx280
synced 2025-01-23 05:26:33 +01:00
Add more license notes.
This commit is contained in:
parent
275ea4444c
commit
efb3985572
73
README.md
Normal file
73
README.md
Normal file
@ -0,0 +1,73 @@
|
||||
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.
|
After Width: | Height: | Size: 2.0 KiB |
21
bmx280.c
21
bmx280.c
@ -1,8 +1,18 @@
|
||||
/**
|
||||
* BMX280 - BME280 & BMP280 Driver for Esspressif ESP-32.
|
||||
* Copyright (C) 2020
|
||||
* H. Utku Maden <utkumaden@hotmail.com>
|
||||
*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (C) 2020 Halit Utku Maden
|
||||
* Please contact at <utkumaden@hotmail.com>
|
||||
*/
|
||||
|
||||
// LEGAL NOTE:
|
||||
// Any code between below the caption "// HERE BE DRAGONS" and above the caption
|
||||
// "// END OF DRAGONS" contains modified versions of code owned by Bosch
|
||||
// Sensortec GmbH and it is not clearly licensed, therefore this code is not
|
||||
// covered by the MIT of this repository. Use at your own risk.
|
||||
|
||||
#include "bmx280.h"
|
||||
#include "esp_log.h"
|
||||
|
||||
@ -422,6 +432,13 @@ bool bmx280_isSampling(bmx280_t* bmx280)
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// LEGAL NOTE:
|
||||
// Any code between below the caption "// HERE BE DRAGONS" and above the caption
|
||||
// "// END OF DRAGONS" contains modified versions of code owned by Bosch
|
||||
// Sensortec GmbH and it is not clearly licensed, therefore this code is not
|
||||
// covered by the MIT of this repository. Use at your own risk.
|
||||
|
||||
// HERE BE DRAGONS
|
||||
// This code is revised from the Bosch code within the datasheet of the BME280.
|
||||
// I do not understand it enough to tell you what it does.
|
||||
|
@ -1,8 +1,12 @@
|
||||
/**
|
||||
* BMX280 - BME280 & BMP280 Driver for Esspressif ESP-32.
|
||||
* Copyright (C) 2020
|
||||
* H. Utku Maden <utkumaden@hotmail.com>
|
||||
*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (C) 2020 Halit Utku Maden
|
||||
* Please contact at <utkumaden@hotmail.com>
|
||||
*/
|
||||
|
||||
#ifndef _BMX280_H_
|
||||
#define _BMX280_H_
|
||||
|
||||
|
@ -1,3 +1,12 @@
|
||||
/**
|
||||
* BMX280 - BME280 & BMP280 Driver for Esspressif ESP-32.
|
||||
*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (C) 2020 Halit Utku Maden
|
||||
* Please contact at <utkumaden@hotmail.com>
|
||||
*/
|
||||
|
||||
#ifndef _BMX280_DEFAULT_H_
|
||||
#define _BMX280_DEFAULT_H_
|
||||
#ifndef _BMX280_H_
|
||||
|
Loading…
Reference in New Issue
Block a user