mirror of
https://github.com/alexandrebobkov/ESP-Nodes.git
synced 2024-10-05 20:47:50 -04:00
Update main.c
This commit is contained in:
parent
9995b8f245
commit
4dbb79d0e7
@ -194,30 +194,4 @@ void app_main(void)
|
||||
}
|
||||
free(data);
|
||||
i2c_driver_delete(I2C_NUM_0);
|
||||
|
||||
|
||||
/*uint8_t data[2];
|
||||
uint8_t raw_temp[BME280_TEMPERATURE_DATA_SIZE] = {0,0,0};
|
||||
|
||||
ESP_ERROR_CHECK(i2c_master_init());
|
||||
ESP_LOGI(TAG, "I2C initialized successfully");
|
||||
|
||||
// Read the MPU9250 WHO_AM_I register, on power up the register should have the value 0x71
|
||||
|
||||
int read = 0;
|
||||
read = i2c_master_read_from_device(0, 0x76, data, 1, I2C_MASTER_TIMEOUT_MS / portTICK_PERIOD_MS);
|
||||
//int read = i2c_master_write_read_device(0, 0x76, 0xD0, 1, data, 1024, I2C_MASTER_TIMEOUT_MS / portTICK_PERIOD_MS);
|
||||
//ESP_ERROR_CHECK(mpu9250_register_read(MPU9250_WHO_AM_I_REG_ADDR, data, 1));
|
||||
ESP_LOGI(TAG, "WHO_AM_I = %X", data[0]);
|
||||
ESP_ERROR_CHECK(i2c_driver_delete(I2C_MASTER_NUM));
|
||||
ESP_LOGI(TAG, "I2C de-initialized successfully");
|
||||
|
||||
ESP_ERROR_CHECK(i2c_master_init());
|
||||
ESP_LOGI(TAG, "I2C initialized successfully");
|
||||
read = bme280_read_raw_temperature(0x76, raw_temp);
|
||||
ESP_LOGI(TAG, "Raw Temperature: %X", raw_temp[0]);
|
||||
// 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(i2c_driver_delete(I2C_MASTER_NUM));
|
||||
ESP_LOGI(TAG, "I2C de-initialized successfully");*/
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user