bh1750-embedded
A platform-agnostic, no_std driver for the BH1750 / BH1750FVI ambient light sensor, built on the embedded-hal traits.
This implementation is a clean reimplementation based on the existing Rust crate:
bh1750by Jona Wilmsmann: https://github.com/jona-wilmsmann/bh1750-rs
Features
- Blocking (synchronous) API using
embedded-hal1.0 (I2c+DelayNs) - Optional async I2C + delay API behind the
asyncfeature usingembedded-hal-async
Feature flags
async: enable async driver API (embedded-hal-async)
Blocking example
use ;
# let i2c = todo!;
# let delay = todo!;
let mut sensor = new;
let lux = sensor.one_time_measurement?;
# Ok::
Async example
Enable the feature:
[]
= { = "0.1", = ["async"] }
use r#Bh1750Async;
use Resolution;
# let i2c = todo!;
# let delay = todo!;
let mut sensor = new;
let lux = sensor.one_time_measurement.await?;
# Ok::
License
MIT