Crates.io | isl29125 |
lib.rs | isl29125 |
version | 0.1.0 |
source | src |
created_at | 2020-04-14 20:02:33.126373 |
updated_at | 2020-04-14 20:02:33.126373 |
description | Platform-agnostic Rust driver for the ISL29125 low-power digital RGB color light sensor with IR blocking filter. |
homepage | https://github.com/eldruin/isl29125-rs |
repository | https://github.com/eldruin/isl29125-rs |
max_upload_size | |
id | 230283 |
size | 56,342 |
This is a platform agnostic Rust driver for the low-power digital RGB color
light sensor with IR blocking filter using the embedded-hal
traits.
This driver allows you to:
read()
.red()
.set_operating_mode()
.set_resolution()
.set_range()
.set_ir_filtering()
.status()
.clear_status()
.device_id()
.reset()
.set_interrupt_thresholds()
.set_interrupt_threshold_assignment()
.set_fault_count()
.set_interrupt_pin_mode()
.enable_interrupt_on_conversion_done()
.The ISL29125 is a low power, high sensitivity, RED, GREEN and BLUE color light sensor (RGB) with an I2C (SMBus compatible) interface. Its state-of-the-art photodiode array provides an accurate RGB spectral response and excellent light source to light source variation (LS2LS).
The ISL29125 is designed to reject IR in light sources allowing the device to operate in environments from sunlight to dark rooms. The integrating ADC rejects 50Hz and 60Hz flicker caused by artificial light sources. A selectable range allows the user to optimize sensitivity suitable for the specific application. In normal operation mode the device consumes 56μA, which reduces to 0.5μA in power-down mode.
The ISL29125 supports hardware and software user programmable interrupt thresholds. The Interrupt persistency feature reduces false trigger notification.
Datasheet: ISL29125
To use this driver, import this crate and an embedded_hal
implementation,
then instantiate the device.
Please find additional examples using hardware in this repository: driver-examples
extern crate linux_embedded_hal as hal;
use isl29125::{Isl29125, OperatingMode};
fn main() {
let dev = hal::I2cdev::new("/dev/i2c-1").unwrap();
let mut sensor = Isl29125::new(dev);
sensor
.set_operating_mode(OperatingMode::RedGreenBlue)
.unwrap();
loop {
let m = sensor.read().unwrap();
println!("R: {}, G: {}, B: {}", m.red, m.green, m.blue);
}
}
For questions, issues, feature requests, and other changes, please file an issue in the github project.
Licensed under either of
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.