Rust APDS9151 Digital Proximity and RGB Color I2C Sensor
This is a platform agnostic Rust driver for the APDS9151 Digital Proximity and RGB Color I2C Sensor, based on the embedded-hal traits.
This driver allows you to:
- Initialize the device. See
initialize() - Get color sensor IR channel data. See
get_ir() - Get color sensor red channel data. See
get_red() - Get color sensor blue channel data. See
get_blue() - Get color sensor green channel data. See
get_green() - Get proximity sensor data. See
get_proximity() - Configure proximity sensor LED fequency, current, and number of pulses. See
config_proximity_led() - Configure proximity sensor measurement rate and resolution. See
config_proximity() - Configure color sensor measurement rate and resolution. See
config_color() - Configre color sensor gain. See
set_gain()
The device
This device offers both RGB+IR color sensing controlled via I2C.
An example of the APDS9151 used in a product is the Rev Robotics v3 color sensor. link
Datasheet: APDS9151
Usage
To use the driver, import the crate and the embedded_hal i2c interface for your platform.
The below example uses stm32f1xx_hal and gets the colors in a loop.
use entry;
use panic_probe as _;
use ;
use ;
use delay;
use Apds9151;
!
Support
For questions, issues, feature requests, and other changes, please file an issue in the github project.
License
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Contributing
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.