Crate vl53l4cd_ulp

Crate vl53l4cd_ulp 

Source
Expand description

§VL53L4CD Ultra-Low-Power Time-of-Flight Distance Sensor Driver

This crate provides a no_std driver for ST-Microelectronics’ VL53L4CD ultra-low-power time-of-flight distance sensor in both sync and async variants.

§Basic Usage

use vl53l4cd_ulp::VL53L4cd;

let i2c = embedded_hal_mock::eh1::i2c::Mock::new(&[]);
let delay = embedded_hal_mock::eh1::delay::NoopDelay;
let mut sensor = VL53L4cd::new(i2c, delay);

sensor.sensor_init().unwrap();
sensor.start_ranging().unwrap();

// Wait for data ready (you can connect a GPIO to the interrupt pin to detect when new data is available)
if sensor.check_for_data_ready().unwrap() {
    let measurement = sensor.get_estimated_measurement().unwrap();
    println!("Distance: {} mm", measurement.estimated_distance_mm);
    sensor.clear_interrupt().unwrap();
}

Structs§

EstimatedMeasurement
Distance measurement result from the VL53L4CD sensor.
VL53L4cd
VL53L4CD ultra-low-power time-of-flight distance sensor driver.

Enums§

Error
Error type for VL53L4CD sensor operations.
InterruptOn
Interrupt configuration options for the VL53L4CD sensor.
Register
Register addresses for the VL53L4CD sensor.