public class VL53L0X extends I2cDeviceSynchDevice<I2cDeviceSynch> implements DistanceSensor
VL53L0X
implements support for the STMicroelectronics VL53L0x time-of-flight distance sensor.Modifier and Type | Class and Description |
---|---|
static class |
VL53L0X.Register |
protected class |
VL53L0X.SequenceStepEnables |
protected class |
VL53L0X.SequenceStepTimeouts |
HardwareDevice.Manufacturer
Modifier and Type | Field and Description |
---|---|
static I2cAddr |
ADDRESS_I2C_DEFAULT |
protected static int |
FAKE_DISTANCE_MM |
protected int |
io_timeout |
protected ElapsedTime |
ioElapsedTime |
protected java.lang.String |
MYTAG |
deviceClient, deviceClientIsOwned, isInitialized
distanceOutOfRange
Constructor and Description |
---|
VL53L0X(I2cDeviceSynch deviceClient) |
Modifier and Type | Method and Description |
---|---|
protected long |
calcMacroPeriod(int vcsel_period_pclks) |
protected int |
decodeVcselPeriod(int reg_val) |
boolean |
didTimeoutOccur()
Did a timeout occur?
|
protected boolean |
doInitialize()
Actually carries out the initialization of the instance.
|
protected long |
encodeTimeout(int timeout_mclks) |
java.lang.String |
getDeviceName()
Returns a string suitable for display to the user as to the type of device.
|
double |
getDistance(DistanceUnit unit)
Returns the current distance in the indicated distance units
|
HardwareDevice.Manufacturer |
getManufacturer()
Returns an indication of the manufacturer of this device.
|
byte |
getModelID() |
protected void |
getSequenceStepEnables(VL53L0X.SequenceStepEnables enables) |
protected void |
getSequenceStepTimeouts(VL53L0X.SequenceStepEnables enables,
VL53L0X.SequenceStepTimeouts timeouts) |
protected int |
getTimeout() |
protected int |
getVcselPulsePeriod(com.qualcomm.hardware.stmicroelectronics.VL53L0X.vcselPeriodType type) |
protected boolean |
performSingleRefCalibration(int vhv_init_byte) |
protected int |
readRangeContinuousMillimeters() |
protected byte |
readReg(byte bVal) |
protected byte |
readReg(int iVal) |
protected byte |
readReg(VL53L0X.Register reg) |
protected short |
readShort(VL53L0X.Register reg) |
protected int |
readUnsignedByte(VL53L0X.Register reg) |
protected boolean |
setMeasurementTimingBudget(long budget_us) |
protected void |
setTimeout(int timeout) |
protected void |
startContinuous() |
protected void |
startContinuous(int period_ms) |
protected void |
stopContinuous() |
protected long |
timeoutMclksToMicroseconds(int timeout_period_mclks,
int vcsel_period_pclks) |
protected long |
timeoutMicrosecondsToMclks(long timeout_period_us,
int vcsel_period_pclks) |
protected void |
writeReg(byte addr,
byte value) |
protected void |
writeReg(byte addr,
byte value,
I2cWaitControl waitControl) |
protected void |
writeReg(int addr,
int value) |
protected void |
writeReg(int addr,
int value,
I2cWaitControl waitControl) |
protected void |
writeReg(VL53L0X.Register reg,
byte value) |
protected void |
writeReg(VL53L0X.Register reg,
byte value,
I2cWaitControl waitControl) |
protected void |
writeShort(VL53L0X.Register reg,
short value) |
close, disengage, engage, getConnectionInfo, getDeviceClient, getVersion, initialize, initializeIfNecessary, onModuleStateChange, registerArmingStateCallback, resetDeviceConfigurationForOpMode
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
close, getConnectionInfo, getVersion, resetDeviceConfigurationForOpMode
public static final I2cAddr ADDRESS_I2C_DEFAULT
protected static final int FAKE_DISTANCE_MM
protected java.lang.String MYTAG
protected int io_timeout
protected ElapsedTime ioElapsedTime
public VL53L0X(I2cDeviceSynch deviceClient)
public HardwareDevice.Manufacturer getManufacturer()
HardwareDevice
getManufacturer
in interface HardwareDevice
public java.lang.String getDeviceName()
HardwareDevice
getDeviceName
in interface HardwareDevice
public byte getModelID()
public double getDistance(DistanceUnit unit)
DistanceSensor
getDistance
in interface DistanceSensor
unit
- the unit of distance in which the result should be returnedDistanceSensor.distanceOutOfRange
is
returned;public boolean didTimeoutOccur()
protected boolean doInitialize()
I2cDeviceSynchDevice
doInitialize
in class I2cDeviceSynchDevice<I2cDeviceSynch>
protected void getSequenceStepEnables(VL53L0X.SequenceStepEnables enables)
protected void getSequenceStepTimeouts(VL53L0X.SequenceStepEnables enables, VL53L0X.SequenceStepTimeouts timeouts)
protected int getVcselPulsePeriod(com.qualcomm.hardware.stmicroelectronics.VL53L0X.vcselPeriodType type)
protected int decodeVcselPeriod(int reg_val)
protected long timeoutMclksToMicroseconds(int timeout_period_mclks, int vcsel_period_pclks)
protected long calcMacroPeriod(int vcsel_period_pclks)
protected boolean setMeasurementTimingBudget(long budget_us)
protected long timeoutMicrosecondsToMclks(long timeout_period_us, int vcsel_period_pclks)
protected long encodeTimeout(int timeout_mclks)
protected boolean performSingleRefCalibration(int vhv_init_byte)
protected void startContinuous()
protected void startContinuous(int period_ms)
protected void stopContinuous()
protected void setTimeout(int timeout)
protected int getTimeout()
protected int readRangeContinuousMillimeters()
protected byte readReg(VL53L0X.Register reg)
protected byte readReg(byte bVal)
protected byte readReg(int iVal)
protected void writeReg(VL53L0X.Register reg, byte value)
protected void writeReg(byte addr, byte value)
protected void writeReg(int addr, int value)
protected void writeReg(VL53L0X.Register reg, byte value, I2cWaitControl waitControl)
protected void writeReg(byte addr, byte value, I2cWaitControl waitControl)
protected void writeReg(int addr, int value, I2cWaitControl waitControl)
protected int readUnsignedByte(VL53L0X.Register reg)
protected void writeShort(VL53L0X.Register reg, short value)
protected short readShort(VL53L0X.Register reg)