esp-hal/esp-lp-hal/examples/i2c.rs
Jesse Braham 2bef914e7c
Update and improve esp-lp-hal (#1754)
* Fix warning in `esp-hal-procmacros` when building for `esp-lp-hal`

* Document cargo features, use `embedded-hal@1.x.x` by default

* Derive more traits on public types, assorted cleanup and improvements

* Implement `embedded-hal-nb` and `embedded-io` traits for UART

* Update `CHANGELOG.md`

* Silence `clippy` for now...

* Module documentation for UART

* Update module documentation format
2024-07-09 17:06:54 +00:00

29 lines
676 B
Rust

//! Uses `LP_I2C` and reads calibration data from BMP180 sensor.
//!
//! This example dumps the calibration data from a BMP180 sensor, to view them,
//! logic analyzer or oscilloscope is required.
//!
//! The following wiring is assumed:
//! - SDA => GPIO6
//! - SCL => GPIO7
//% CHIPS: esp32c6
//% FEATURES: embedded-hal-02
#![no_std]
#![no_main]
use embedded_hal_02::blocking::i2c::WriteRead;
use esp_lp_hal::{i2c::LpI2c, prelude::*};
use panic_halt as _;
#[entry]
fn main(mut i2c: LpI2c) -> ! {
let _peripherals = esp32c6_lp::Peripherals::take().unwrap();
loop {
let mut data = [0u8; 22];
i2c.write_read(0x77, &[0xaa], &mut data).ok();
}
}