Crates.io | sen66-interface |
lib.rs | sen66-interface |
version | 1.1.0 |
created_at | 2025-04-28 20:35:48.482431+00 |
updated_at | 2025-04-28 20:44:14.375471+00 |
description | An I2C driver for the SEN66 sensor in Rust. |
homepage | |
repository | https://github.com/Gronner/sen66-interface |
max_upload_size | |
id | 1652645 |
size | 154,041 |
A driver for interacting with Sensirion's SEN66 environment sensing platform via I2C. The driver is based on the embedded-hal traits and offers a synchronous and asynchronous interface.
Provides a full implementation of the SEN66 features:
This example showcases how to use the SEN66 with a ESP32-C6-DevKitM-1 using embassy.
use sen66_interface::asynch::Sen66;
#[esp_hal_embassy::main]
async fn main(spawner: Spawner) {
let config = esp_hal::Config::default().with_cpu_clock(CpuClock::max());
let peripherals = esp_hal::init(config);
let timer0 = esp_hal::timer::systimer::SystemTimer::new(peripherals.SYSTIMER);
esp_hal_embassy::init(timer0.alarm0);
let i2c = esp_hal::i2c::master::I2c::new(
peripherals.I2C0,
esp_hal::i2c::master::Config::default()
).unwrap()
.into_async()
.with_sda(peripherals.GPIO22)
.with_scl(peripherals.GPIO23);
let mut sensor = Sen66::new(embassy_time::Delay, i2c);
// Provide enough time to start up after power-on
embassy_time::Timer::after(embassy_time::Duration::from_millis(100)).await;
sensor.get_product_name().await.unwrap()
}
async
: Provides an async interface, enabled by default.
blocking
: Provides a blocking interface.
defmt
: Provides support for defmt.
If you want to contribute, open a Pull Request with your suggested changes and ensure that the integration pipeline runs.
Licensed under either of
SPDX-License-Identifier: Apache-2.0 OR MIT