LTR-303ALS
This is a platform-agnostic Rust driver for the LTR-303 Ambient Light Sensor using embedded-hal traits.
Supported devices
Tested with the following sensor(s):
Status
- Starting a measurement with configurable gain, integration time and measurement rate. See:
start_measurement() - Polling for new data. See:
data_ready() - Checking latest measurement status. See:
get_status() - Reading the latest illuminance value in lux. See:
get_lux_data() - Putting the sensor in standby. See:
standby() - Reading part ID and manufacturer ID. See:
get_part_id()andget_mfc_id() - Option to pass a delay function to the driver. Similar to the opt300x driver.
- Sensor reset in case of error.
- Wait for sensor start-up before triggering measurement after cold startup (100ms)
- Interrupts.
Examples
On Linux using i2cdev:
use I2cdev;
use ;
On an ESP32-based development board:
use *;
use esp_idf_sys as _;
use ;
use Peripherals;
use ;
Development
For easy development, a flake.nix is provided. Make sure you have Nix installed, as well as the flake command enabled (for example by adding experimental-features = nix-command flakes to ~/.config/nix/nix.conf)
and then simply run
nix develop
inside the project folder to have a complete build and development environment with all required dependencies for ltr303-rs.