pub struct VL53L1X<T>where
    T: Write + Read,
{ /* private fields */ }
Expand description

Instance of a single VL53L1X driver.

Implementations

Create a new instance of the VL53L1X driver with the given I2C address.

Arguments
  • i2c - Instance of object that implements I2C communication. Is used for further communication with the sensor
  • address - The address to use for communication with the VL53L1X.

Get the driver version.

Default configuration used during initialization.

Write bytes to register at address of variable length. (Number of bytes is limited to 4 for non iterator implementations)

Arguments
  • address - Address of the register to write to.
  • iter - Iterator of bytes that will be written at the address.

Read bytes from at the address into mutable slice

Arguments
  • address - Address of the register to read from.
  • bytes - Mutable slice that read data will be written to.

Set the I2C address of the current device in case multiple devices with the same address exists on the same bus.

Arguments
  • new_address - The new address to set for the current device.

Load the 88 byte default values for sensor initialisation.

Arguments
  • io_config - The io voltage that will be configured for the device.

Clear the interrupt flag on the device. Should be called after reading ranging data from the device to start the next measurement.

Set polarity of the interrupt.

Arguments
  • polarity - The polarity to set.

Get the currently set interrupt polarity.

Start a distance ranging operation. This operation is continuous, the interrupt flag should be cleared between each interrupt to start a new distance measurement.

Stop an ongoing ranging operation.

Check if new ranging data is available by polling the device.

Set the timing budget for a measurement operation in milliseconds.

Arguments
  • milliseconds - One of the following values = 15, 20, 33, 50, 100(default), 200, 500.

Get the currently set timing budget of the device.

Set the distance mode in which the device operates.

Arguments
  • mode - The distance mode to use.

Get the currently set distance mode of the device.

Set the inter measurement period in milliseconds. This value must be greater or equal to the timing budget. This condition is not checked by this driver.

Arguments
  • milliseconds - The number of milliseconds used for the inter measurement period.

Get the currently set inter measurement period in milliseconds.

Check if the device is booted.

Get the sensor id of the sensor. This id must be 0xEACC.

Get the distance measured in millimeters.

Get the returned signal per SPAD in kcps/SPAD where kcps stands for Kilo Count Per Second.

Get the ambient signal per SPAD in kcps/SPAD where kcps stands for Kilo Count Per Second.

Get the returned signal in kcps (Kilo Count Per Second).

Get the count of currently enabled SPADs.

Get the ambient signal in kcps (Kilo Count Per Second).

Get the ranging status.

Get a measurement result object which is read in a single access.

Set a offset in millimeters which is aplied to the distance.

Arguments
  • offset - The offset in millimeters.

Get the current offset in millimeters.

Set the crosstalk correction value in cps (Count Per Second).

Arguments
  • correction - The number of photons reflected back from the cover glass in cps.

Get the crosstalk correction value in cps.

Set a distance threshold.

Arguments
  • threshold - The threshold to apply.

Get the currently set distance threshold.

Set the region of interest of the sensor. The ROI is centered and only the size is settable. The smallest acceptable ROI size is 4.

Arguments
  • roi - The ROI to apply.

Get the currenly set ROI.

Arguments

Set the new ROI center. If the new ROI clips out of the border this function does not return an error but only when ranging is started will an error be returned.

Arguments
  • center - Tne ROI center to apply.

Get the current ROI center.

Set a signal threshold in kcps. Default is 1024

Arguments
  • threshold - The signal threshold.

Get the currently set signal threshold.

Set a sigma threshold in millimeter. Default is 15.

Arguments
  • threshold - The sigma threshold.

Get the currently set sigma threshold.

Perform temperature calibration of the sensor. It is recommended to call this function any time the temperature might have changed by more than 8 degrees Celsius without sensor ranging activity for an extended period.

Perform offset calibration. The function returns the offset value found and sets it as the new offset. Target reflectance = grey 17%

Arguments
  • target_distance_mm - Distance to the target in millimeters, ST recommends 100 mm.

Perform crosstalk calibration. The function returns the crosstalk value found and set it as the new crosstalk correction. Target reflectance = grey 17%

Arguments

  • target_distance_mm - Distance to the target in millimeters, ST recommends 100 mm.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.