mirror of
https://github.com/alexandrebobkov/ESP-Nodes.git
synced 2024-10-05 20:47:50 -04:00
BME280 I2C
This commit is contained in:
parent
1a271d1a36
commit
7835cc0a2d
@ -8,9 +8,12 @@
|
|||||||
/** GLOBAL MEMORY MAN AND REGISTERS
|
/** GLOBAL MEMORY MAN AND REGISTERS
|
||||||
* BME280 Data Sheet p. 26
|
* BME280 Data Sheet p. 26
|
||||||
* 0xD0 -> Chip ID -> 0x60 for BME280 or 0x56;0x58 for BMP280
|
* 0xD0 -> Chip ID -> 0x60 for BME280 or 0x56;0x58 for BMP280
|
||||||
|
* 0xF3 -> Status ->
|
||||||
|
* 0xE0 -> Reset -> Write 0xB6 for complete power-on-reset procedure (BME280 Data Sheet p. 27)
|
||||||
* 0xF5 -> Config -> 110 for 10ms or 111 for 20ms
|
* 0xF5 -> Config -> 110 for 10ms or 111 for 20ms
|
||||||
* 0xF7-0xF9 -> Pressure -> 16- to 20-bit resolution
|
* 0xF7-0xF9 -> Pressure -> 16- to 20-bit resolution, unsigned
|
||||||
* 0xFA-0xFC -> Temperature -> 16- to 20-bit resolution
|
* 0xFA-0xFC -> Temperature -> 16- to 20-bit resolution, unsigned
|
||||||
|
* 0xFD-0xFE -> Humidity -> 16-bit resolution
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
@ -44,6 +44,11 @@ static esp_err_t mpu9250_register_read(uint8_t reg_addr, uint8_t *data, size_t l
|
|||||||
return i2c_master_write_read_device(I2C_MASTER_NUM, MPU9250_SENSOR_ADDR, ®_addr, 1, data, len, I2C_MASTER_TIMEOUT_MS / portTICK_PERIOD_MS);
|
return i2c_master_write_read_device(I2C_MASTER_NUM, MPU9250_SENSOR_ADDR, ®_addr, 1, data, len, I2C_MASTER_TIMEOUT_MS / portTICK_PERIOD_MS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static esp_err_t bme280_I2C_burst_read(uint8_t device_addr, uint8_t *data, size_t len)
|
||||||
|
{
|
||||||
|
return i2c_master_write_read_device(I2C_MASTER_NUM, MPU9250_SENSOR_ADDR, ®_addr, 1, data, len, I2C_MASTER_TIMEOUT_MS / portTICK_PERIOD_MS);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Write a byte to a MPU9250 sensor register
|
* @brief Write a byte to a MPU9250 sensor register
|
||||||
*/
|
*/
|
||||||
|
@ -82,6 +82,8 @@ The BME280 sensor board interface uses 4 pins and is 13mm by 10.5mm in size. The
|
|||||||
i2c_master_write_read_device(I2C_MASTER_NUM, 0x76, ®_addr, 1, data, len, I2C_MASTER_TIMEOUT_MS / portTICK_PERIOD_MS);
|
i2c_master_write_read_device(I2C_MASTER_NUM, 0x76, ®_addr, 1, data, len, I2C_MASTER_TIMEOUT_MS / portTICK_PERIOD_MS);
|
||||||
```
|
```
|
||||||
|
|
||||||
|
<p>Data readout is done by starting a burst read from 0xF7 to 0xFC (temperature and pressure) or from 0xF7 to 0xFE (temperature, pressure, and humidity). The data are rad out in an unsigned 20-bit format both for pressure and for temperature, and in an unsigned 26-bit format for humidity. After the uncompensated values for pressure, temperature, and humidity have been read, the actual humidity, pressure and temperature needs to be calculated using the compensation parameters stored in the device.</p>
|
||||||
|
|
||||||
[^2]: https://www.bosch-sensortec.com/products/environmental-sensors/humidity-sensors-bme280/
|
[^2]: https://www.bosch-sensortec.com/products/environmental-sensors/humidity-sensors-bme280/
|
||||||
[^3]: https://www.bosch-sensortec.com/products/environmental-sensors/pressure-sensors/bmp280/
|
[^3]: https://www.bosch-sensortec.com/products/environmental-sensors/pressure-sensors/bmp280/
|
||||||
[^4]: https://www.bosch-sensortec.com/media/boschsensortec/downloads/datasheets/bst-bme280-ds002.pdf
|
[^4]: https://www.bosch-sensortec.com/media/boschsensortec/downloads/datasheets/bst-bme280-ds002.pdf
|
Loading…
Reference in New Issue
Block a user