apds9253 1.0.0

Driver for APDS9253 light sensor
Documentation
  • Coverage
  • 100%
    57 out of 57 items documented1 out of 39 items with examples
  • Size
  • Source code size: 46.18 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 4.34 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 10s Average build duration of successful builds.
  • all releases: 10s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Repository
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • embedded-rust-iml-user

apds9253

This crate implements the driver for the APDS9253 RGB, ambient and IR light sensor from Broadcom. The sensor can be initialized in RGB mode, where all color channels and the infrared channel is available or in ALS mode, where only the ambient light and the infrared light channel is available.

Resources

Broadcom APDS9253

APDS9253 Datasheet

Features

  • Up to 20-bit resolution
  • I2C compatible interface with dedicated interrupt pin
  • Individual channels for red (R), green (G), blue (B) and infrared (IR)
  • Approximate human eye response with green channel
  • ALS and RGB sensing with integrated IR-blocking filter
  • Low power consumption

Examples

The APDS has to be configured in RGB or ALS mode.

ALS mode:

## use embedded_hal_mock::*;
## let expectations = [];
## let mut i2c = i2c::Mock::new(&expectations);
##
use apds9253::*;

let mut sensor = Apds9253::new_als(i2c);
sensor.init().unwrap();

let ambient = sensor.read_ambient_light();
let infrared = sensor.read_infrared();

log::info!("Ambient: {ambient:?}, Infrared: {infrared:?}");

```rust

RGB mode:
```rust, no_run
#
use apds9253::*;

let mut sensor = Apds9253::new_rgb(i2c);
sensor.init().unwrap();

let red = sensor.read_red_channel();
let green = sensor.read_green_channel();
let blue = sensor.read_blue_channel();
let infrared = sensor.read_infrared();

log::info!("Red: {red:?}, Green: {green:?}, Blue: {blue:?}, Infrared: {infrared:?}");

License

Open Logistics Foundation License
Version 1.3, January 2023

See the LICENSE file in the top-level directory.

Contact Information

Fraunhofer IML Embedded Rust Group - embedded-rust@iml.fraunhofer.de