mirror of
https://github.com/alexandrebobkov/ESP-Nodes.git
synced 2025-08-08 11:50:53 +00:00
.
This commit is contained in:
@@ -105,13 +105,13 @@ static esp_err_t i2c_master_init(void)
|
|||||||
|
|
||||||
void app_main(void)
|
void app_main(void)
|
||||||
{
|
{
|
||||||
uint8_t data[2];
|
/*uint8_t data[2];
|
||||||
uint8_t raw_temp[BME280_TEMPERATURE_DATA_SIZE] = {0,0,0};
|
uint8_t raw_temp[BME280_TEMPERATURE_DATA_SIZE] = {0,0,0};
|
||||||
|
|
||||||
ESP_ERROR_CHECK(i2c_master_init());
|
ESP_ERROR_CHECK(i2c_master_init());
|
||||||
ESP_LOGI(TAG, "I2C initialized successfully");
|
ESP_LOGI(TAG, "I2C initialized successfully");
|
||||||
|
|
||||||
/* Read the MPU9250 WHO_AM_I register, on power up the register should have the value 0x71 */
|
// Read the MPU9250 WHO_AM_I register, on power up the register should have the value 0x71
|
||||||
|
|
||||||
int read = 0;
|
int read = 0;
|
||||||
read = i2c_master_read_from_device(0, 0x76, data, 1, I2C_MASTER_TIMEOUT_MS / portTICK_PERIOD_MS);
|
read = i2c_master_read_from_device(0, 0x76, data, 1, I2C_MASTER_TIMEOUT_MS / portTICK_PERIOD_MS);
|
||||||
@@ -125,8 +125,8 @@ void app_main(void)
|
|||||||
ESP_LOGI(TAG, "I2C initialized successfully");
|
ESP_LOGI(TAG, "I2C initialized successfully");
|
||||||
read = bme280_read_raw_temperature(0x76, raw_temp);
|
read = bme280_read_raw_temperature(0x76, raw_temp);
|
||||||
ESP_LOGI(TAG, "Raw Temperature: %X", raw_temp[0]);
|
ESP_LOGI(TAG, "Raw Temperature: %X", raw_temp[0]);
|
||||||
/* Demonstrate writing by reseting the MPU9250 */
|
// Demonstrate writing by reseting the MPU9250
|
||||||
//ESP_ERROR_CHECK(mpu9250_register_write_byte(MPU9250_PWR_MGMT_1_REG_ADDR, 1 << MPU9250_RESET_BIT));
|
//ESP_ERROR_CHECK(mpu9250_register_write_byte(MPU9250_PWR_MGMT_1_REG_ADDR, 1 << MPU9250_RESET_BIT));
|
||||||
ESP_ERROR_CHECK(i2c_driver_delete(I2C_MASTER_NUM));
|
ESP_ERROR_CHECK(i2c_driver_delete(I2C_MASTER_NUM));
|
||||||
ESP_LOGI(TAG, "I2C de-initialized successfully");
|
ESP_LOGI(TAG, "I2C de-initialized successfully");*/
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user