* UART: only implement constructors with config, define ConfigError * UART: only implement interrupt functions for Blocking * I2C: fallible constructors * Lcd/Cam * SPI * Update tests and examples * Changelog * Add note about ConfigError * Fmt
39 lines
896 B
Rust
39 lines
896 B
Rust
//! Read calibration data from BMP180 sensor
|
|
//!
|
|
//! This example dumps the calibration data from a BMP180 sensor
|
|
//!
|
|
//! The following wiring is assumed:
|
|
//! - SDA => GPIO4
|
|
//! - SCL => GPIO5
|
|
|
|
//% CHIPS: esp32 esp32c2 esp32c3 esp32c6 esp32h2 esp32s2 esp32s3
|
|
|
|
#![no_std]
|
|
#![no_main]
|
|
|
|
use esp_backtrace as _;
|
|
use esp_hal::{
|
|
i2c::master::{Config, I2c},
|
|
prelude::*,
|
|
};
|
|
use esp_println::println;
|
|
|
|
#[entry]
|
|
fn main() -> ! {
|
|
let peripherals = esp_hal::init(esp_hal::Config::default());
|
|
|
|
// Create a new peripheral object with the described wiring and standard
|
|
// I2C clock speed:
|
|
let mut i2c = I2c::new(peripherals.I2C0, Config::default())
|
|
.unwrap()
|
|
.with_sda(peripherals.GPIO4)
|
|
.with_scl(peripherals.GPIO5);
|
|
|
|
loop {
|
|
let mut data = [0u8; 22];
|
|
i2c.write_read(0x77, &[0xaa], &mut data).ok();
|
|
|
|
println!("{:02x?}", data);
|
|
}
|
|
}
|