BH1750 driver
A platform-agnostic, 'no_std' compatible Rust driver for the BH1750 ambient light sensor using the embedded-hal traits.
The I²C instruction set is based on the following datasheet: BH1750 datasheet
All instructions are implemented and supported.
The raw values read from the sensor are converted to lux, taking into account the resolution mode and measurement time register value.
Usage
To use this driver, import it and an embedded_hal implementation, then create an instance of the driver.
You can call the get_one_time_measurement function to get a single measurement from the sensor.
Alternatively, you can call start_continuous_measurement to start continuous measurements and then call get_current_measurement to get the latest measurement.
Example
This example uses the esp-hal crate to interface with the sensor on an ESP32 microcontroller.
use esp_backtrace as _;
use ;
use ;
use I2C;
!