Expand description
A pure-Rust port of the official ST VL53L1X ToF sensor C API.
The majority of the documentation within this crate is directly ported from the original source and user manual. Reading the VL53L1X API User Manual (by ST) is highly recommended in order to gain an understanding of how to use the API.
While much of the code has been Rust-ified, the function tree and overall architecture are still very much a direct port of the original C code. Feel free to submit PRs or issues related to rustifying the library further!
Re-exports§
pub use outcome::Outcome;pub use vl53l1_reg as reg;
Modules§
Structs§
- Additional
Offset CalData - CalPeak
Rate Map - CalStatus
- Data
- Device
- Device
Gpio Mode - Device
Info - Device
Interrupt Polarity - Device
Parameters - Defines all parameters for the device.
- Device
SscArray - Driver
State - Gain
Calibration Data - Gpio
Interrupt Config - LlResults
- LowPower
Auto Data - Offset
Range Data - Offset
Range Results - Offsetcal
Config - Optical
Centre - Range
Data - Range
Results - Ranging
Measurement Data - Single range measurement data.
- Refspadchar
Config - SscConfig
- Tuning
Parm Storage - UserRoi
- User Zone (region of interest) parameters.
- User
Zone - Version
- Xtalk
Config
Enums§
- Device
Config Level - Device
DssMode - Device
Error - Device
Measurement Mode - Device
Preset Modes - Device
Report Status - Device
Results Level - Device
State - Device
Test Mode - Distance
Mode - Distance mode is a parameter provided to optimize the internal settings and tunings to get the best ranging performances depending on the ranging distance required by the application and ambient light conditions.
- Error
- Gpio
Interrupt Mode - Offset
Calibration Mode - Offset
Correction Mode - Preset
Mode - Range
Status - StError
- State
- Wait
Method - Warning
- Separate warnings into their own type in order to allow for handling them separately.
Constants§
- FIRMWARE_
BOOT_ TIME_ US - The estimated boot time for the device.
- SOFTWARE_
RESET_ DURATION - The delay duration when resetting the software.
Traits§
- Delay
- The set of all delays required by the API.
Functions§
- clear_
interrupt_ and_ start_ measurement - The interrupt must be cleared by calling this function.
- data_
init - Performs device initialization.
- get_
device_ info - Retrieve some information about the device.
- get_
inter_ measurement_ period_ milli_ seconds - Get the currently configured delay between two ranging operations.
- get_
measurement_ timing_ budget_ micro_ seconds - Get the currently configured time required by the sensor to perform one range measurement.
- get_
ranging_ measurement_ data - Used to get ranging data.
- perform_
ref_ spad_ management - Calibration that allows adjustment of the number of SPADs to optimize the device dynamic.
- read_
byte - Shorthand for reading a single byte from the register at the given index.
- read_
entry - Read the value for a single entry.
- read_
slice - Read the value at the given index into the given slice.
- read_
word - Shorthand for reading two consecutive bytes from the given index.
- set_
distance_ mode - Distance mode is a parameter provided to optimize the internal settings and tunings to get the best ranging performances depending on the ranging distance required by the application and ambient light conditions.
- set_
inter_ measurement_ period_ milli_ seconds - set_
measurement_ timing_ budget_ micro_ seconds - set_
preset_ mode - Undocumented, but appears to allow for choosing from a set of pre-determined distance modes and timing values.
- set_
user_ roi - Set the region of interest by specifying the grid of SPADs to use.
- set_
xtalk_ compensation_ enable - Enable (1) or disable (0) crosstalk compensation.
- software_
reset - Reset the device.
- start_
measurement - Must be called to start a measurement.
- static_
init - Allows loading of the device settings that are specific for a given use case.
- stop_
measurement - Stops any in-progress measurement.
- wait_
measurement_ data_ ready - Polls on the device interrupt status until ranging data are ready.
- write_
byte - Shorthand for writing a slice with a single byte.
- write_
entry - Read the the given entry.
- write_
slice - Write given slice of data to the device at the given index.
- write_
word - Shorthand for writing a slice with a single word.