From 7b298995bb5484fc286c4140a735831bd2026f48 Mon Sep 17 00:00:00 2001 From: Alexandre B Date: Tue, 9 Jul 2024 14:42:28 -0400 Subject: [PATCH] . --- ESP32-IDF_BMP280/main/bme280.h | 6 ++++-- ESP32-IDF_BMP280/main/main.c | 30 +++++++++++++++++++----------- 2 files changed, 23 insertions(+), 13 deletions(-) diff --git a/ESP32-IDF_BMP280/main/bme280.h b/ESP32-IDF_BMP280/main/bme280.h index 1e5737f43..5c2e4af89 100644 --- a/ESP32-IDF_BMP280/main/bme280.h +++ b/ESP32-IDF_BMP280/main/bme280.h @@ -1,9 +1,11 @@ #ifndef __BME280_H__ #define __BME280_H__ -#define BME280_CHIP_ID (0x60) +#define BME280_CHIP_ID (0xD0) #define BME280_I2C_ADDRESS1 (0x76) // BME280 Data sheet p. 32 #define BME280_I2C_ADDRESS2 (0x77) +#define BME280_TEMPERATURE_REGISTER (0xFA) + #define BME280_TEMPERATURE_DATA_SIZE (3) #define BME280_TEMPERATURE_DATA_LENGTH (3) #define BME280_PRESSURE_DATA_SIZE (3) @@ -22,7 +24,7 @@ * 0xFA-0xFC -> Temperature -> 16- to 20-bit resolution, unsigned * 0xFD-0xFE -> Humidity -> 16-bit resolution */ -#define BME280_TEMPERATURE_REGISTER (0xFA) + #endif diff --git a/ESP32-IDF_BMP280/main/main.c b/ESP32-IDF_BMP280/main/main.c index cd73f805b..9eb0b066d 100644 --- a/ESP32-IDF_BMP280/main/main.c +++ b/ESP32-IDF_BMP280/main/main.c @@ -1,20 +1,28 @@ -/* i2c - Simple example - Simple I2C example that shows how to initialize I2C - as well as reading and writing from and to registers for a sensor connected over I2C. +/* ESP32 Module I2C Master Device - The sensor used in this example is a MPU9250 inertial measurement unit. + Author: Alexander Bobkov + Date: July 3, 2024 + Modified: July 9, 2024 + + + Adopted from i2c - Simple example - For other examples please check: - https://github.com/espressif/esp-idf/tree/master/examples + Simple I2C example that shows how to initialize I2C + as well as reading and writing from and to registers for a sensor connected over I2C. - See README.md file to get detailed usage of this example. + The sensor used in this example is a MPU9250 inertial measurement unit. - This example code is in the Public Domain (or CC0 licensed, at your option.) + For other examples please check: + https://github.com/espressif/esp-idf/tree/master/examples - Unless required by applicable law or agreed to in writing, this - software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR - CONDITIONS OF ANY KIND, either express or implied. + See README.md file to get detailed usage of this example. + + This example code is in the Public Domain (or CC0 licensed, at your option.) + + Unless required by applicable law or agreed to in writing, this + software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. */ #include #include "esp_log.h"