Crates.io | veml6030 |
lib.rs | veml6030 |
version | 0.1.2 |
source | src |
created_at | 2019-12-20 18:23:48.905074 |
updated_at | 2020-11-05 14:55:42.405969 |
description | Platform-agnostic Rust driver for the VEML6030 and VEML7700 high-accuracy ambient light sensors. |
homepage | https://github.com/eldruin/veml6030-rs |
repository | https://github.com/eldruin/veml6030-rs |
max_upload_size | |
id | 191047 |
size | 64,736 |
This is a platform agnostic Rust driver for the VEML6030 and VEML7700 high accuracy ambient
light sensors using the embedded-hal
traits.
This driver allows you to:
enable()
.read_lux()
.read_white()
.read_raw()
.convert_raw_als_to_lux()
.set_gain()
.set_integration_time()
.set_fault_count()
.enable_power_saving()
.enable_interrupts()
.read_interrupt_status()
.set_high_threshold_lux()
.calculate_raw_threshold_value()
.Vishay's VEML6030 and VEML7700 are high accuracy ambient light digital 16-bit resolution sensors in a miniature transparent package. They include a high sensitive photodiode, a low noise amplifier, a 16-bit A/D converter and support an easy to use I2C bus communication interface and additional interrupt feature. The ambient light result is as digital value available.
Datasheets: VEML6030 - VEML7700
Application Notes:
To use this driver, import this crate and an embedded_hal
implementation,
then instantiate the device.
VEML6030 and VEML7700 expose the same interface over I2C. To communicate with a VEML7700 simply use this driver as if communicating with a VEML6030.
Please find additional examples using hardware in this repository: driver-examples
use linux_embedded_hal::I2cdev;
use veml6030::{SlaveAddr, Veml6030};
fn main() {
let dev = I2cdev::new("/dev/i2c-1").unwrap();
let address = SlaveAddr::default();
let mut sensor = Veml6030::new(dev, address);
sensor.enable().unwrap();
loop {
let lux = sensor.read_lux().unwrap();
println!("lux: {:2}", lux);
}
}
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.