Crates.io | veml6040 |
lib.rs | veml6040 |
version | 0.1.1 |
source | src |
created_at | 2018-10-23 16:30:41.575997 |
updated_at | 2021-01-25 20:49:48.818738 |
description | Platform-agnostic Rust driver for the VEML6040 RGBW color light sensor. |
homepage | https://github.com/eldruin/veml6040-rs |
repository | https://github.com/eldruin/veml6040-rs |
max_upload_size | |
id | 92191 |
size | 36,916 |
This is a platform agnostic Rust driver for the VEML6040 RGBW color light
sensor, based on the embedded-hal
traits.
This driver allows you to:
VEML6040 color sensor senses red, green, blue, and white light and incorporates photodiodes, amplifiers, and analog / digital circuits into a single chip using CMOS process. With the color sensor applied, the brightness, and color temperature of backlight can be adjusted base on ambient light source that makes panel looks more comfortable for end user's eyes. VEML6040's adoption of Filtron TM technology achieves the closest ambient light spectral sensitivity to real human eye responses. VEML6040 provides excellent temperature compensation capability for keeping the output stable under changing temperature. VEML6040's function are easily operated via the simple command format of I2C (SMBus compatible) interface protocol. VEML6040's operating voltage ranges from 2.5 V to 3.6 V.
Datasheet: VEML6040
Application note: VEML6040 AN
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
use linux_embedded_hal::I2cdev;
use veml6040::Veml6040;
fn main() {
let dev = I2cdev::new("/dev/i2c-1").unwrap();
let mut sensor = Veml6040::new(dev);
sensor.enable().unwrap();
let red = sensor.read_red_channel().unwrap();
let green = sensor.read_green_channel().unwrap();
let blue = sensor.read_blue_channel().unwrap();
let white = sensor.read_white_channel().unwrap();
println!(
"Measurements: R: {}, G: {}, B: {}, W: {}",
red, green, blue, white
);
}
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.