pub struct Vl53l0x<SCL, SDA> { /* private fields */ }Implementations§
Source§impl<SCL, SDA> Vl53l0x<SCL, SDA>where
SCL: PinScl<I2C1>,
SDA: PinSda<I2C1>,
impl<SCL, SDA> Vl53l0x<SCL, SDA>where
SCL: PinScl<I2C1>,
SDA: PinSda<I2C1>,
Sourcepub fn new(bus: I2cBus<SCL, SDA>) -> Result<Self, Error>
pub fn new(bus: I2cBus<SCL, SDA>) -> Result<Self, Error>
Verify device identity and run mandatory data init (2V8 I/O, stop_variable, MSRC, sequence).
Sourcepub fn static_init(&mut self) -> Result<(), Error>
pub fn static_init(&mut self) -> Result<(), Error>
Read SPAD info from NVM and configure the SPAD enable map.
Sourcepub fn load_tuning(&mut self) -> Result<(), Error>
pub fn load_tuning(&mut self) -> Result<(), Error>
Write ST’s default tuning register table.
This is a magic blob copied verbatim from ST’s proprietary VL53L0X API (vl53l0x_tuning.h). It configures internal analog/digital parameters that ST does not publicly document. Every open-source VL53L0X driver reproduces this table as-is. Do not modify individual values.
Sourcepub fn calibrate(&mut self) -> Result<(), Error>
pub fn calibrate(&mut self) -> Result<(), Error>
Run VHV (voltage) and phase reference calibration.
Must be called after load_tuning. The two calibration passes (VHV = 0x40,
phase = 0x00) compensate for chip-to-chip variation. Register 0x01 is
SYSTEM_SEQUENCE_CONFIG — each write selects which calibration step runs.
Sourcepub fn read_range_mm(&mut self) -> Result<u16, Error>
pub fn read_range_mm(&mut self) -> Result<u16, Error>
Single-shot range measurement in mm