Remarks

Based on logic from https://github.com/adafruit/Adafruit_CircuitPython_VL53L0X/blob/master/adafruit_vl53l0x.py

Characteristic Locus
Inheritance System.Object > Vl53l0x
Namespace Meadow.Foundation.Sensors.Distance
Assembly Vl53l0x.dll

Syntax

public class Vl53l0x : IRangeFinder

Constructors

Vl53l0x(II2cBus, IDigitalOutputPort, Byte, Vl53l0x.UnitType)

Declaration
public Vl53l0x(II2cBus i2cBus, IDigitalOutputPort shutdownPin, byte address = 41, Vl53l0x.UnitType units = Vl53l0x.UnitType.mm)

Parameters

Type Name Description
II2cBus i2cBus

I2C bus

IDigitalOutputPort shutdownPin
System.Byte address

VL53L0X address

Vl53l0x.UnitType units

Unit of measure

Vl53l0x(II2cBus, Byte, Vl53l0x.UnitType)

Declaration
public Vl53l0x(II2cBus i2cBus, byte address = 41, Vl53l0x.UnitType units = Vl53l0x.UnitType.mm)

Parameters

Type Name Description
II2cBus i2cBus
System.Byte address
Vl53l0x.UnitType units

Fields

AlgoPartToPartRangeOffsetMm

Declaration
protected const byte AlgoPartToPartRangeOffsetMm = 40

Field Value

Type Description
System.Byte

AlgoPhasecalConfigTimeout

Declaration
protected const byte AlgoPhasecalConfigTimeout = 48

Field Value

Type Description
System.Byte

AlgoPhasecalLim

Declaration
protected const byte AlgoPhasecalLim = 48

Field Value

Type Description
System.Byte

CrosstalkCompensationPeakRateMcps

Declaration
protected const byte CrosstalkCompensationPeakRateMcps = 32

Field Value

Type Description
System.Byte

DynamicSpadNumRequestedRefSpad

Declaration
protected const byte DynamicSpadNumRequestedRefSpad = 78

Field Value

Type Description
System.Byte

DynamicSpadRefEnStartOffset

Declaration
protected const byte DynamicSpadRefEnStartOffset = 79

Field Value

Type Description
System.Byte

FinalRangeConfigMinCountRateRtnLimit

Declaration
protected const byte FinalRangeConfigMinCountRateRtnLimit = 68

Field Value

Type Description
System.Byte

FinalRangeConfigMinSnr

Declaration
protected const byte FinalRangeConfigMinSnr = 103

Field Value

Type Description
System.Byte

FinalRangeConfigTimeoutMacropHi

Declaration
protected const byte FinalRangeConfigTimeoutMacropHi = 113

Field Value

Type Description
System.Byte

FinalRangeConfigTimeoutMacropLo

Declaration
protected const byte FinalRangeConfigTimeoutMacropLo = 114

Field Value

Type Description
System.Byte

FinalRangeConfigValidPhaseHigh

Declaration
protected const byte FinalRangeConfigValidPhaseHigh = 72

Field Value

Type Description
System.Byte

FinalRangeConfigValidPhaseLow

Declaration
protected const byte FinalRangeConfigValidPhaseLow = 71

Field Value

Type Description
System.Byte

FinalRangeConfigVcselPeriod

Declaration
protected const byte FinalRangeConfigVcselPeriod = 112

Field Value

Type Description
System.Byte

GlobalConfigRefEnStartSelect

Declaration
protected const byte GlobalConfigRefEnStartSelect = 182

Field Value

Type Description
System.Byte

GlobalConfigSpadEnablesRef0

Declaration
protected const byte GlobalConfigSpadEnablesRef0 = 176

Field Value

Type Description
System.Byte

GlobalConfigSpadEnablesRef1

Declaration
protected const byte GlobalConfigSpadEnablesRef1 = 177

Field Value

Type Description
System.Byte

GlobalConfigSpadEnablesRef2

Declaration
protected const byte GlobalConfigSpadEnablesRef2 = 178

Field Value

Type Description
System.Byte

GlobalConfigSpadEnablesRef3

Declaration
protected const byte GlobalConfigSpadEnablesRef3 = 179

Field Value

Type Description
System.Byte

GlobalConfigSpadEnablesRef4

Declaration
protected const byte GlobalConfigSpadEnablesRef4 = 180

Field Value

Type Description
System.Byte

GlobalConfigSpadEnablesRef5

Declaration
protected const byte GlobalConfigSpadEnablesRef5 = 181

Field Value

Type Description
System.Byte

GlobalConfigVcselWidth

Declaration
protected const byte GlobalConfigVcselWidth = 50

Field Value

Type Description
System.Byte

GpioHvMuxActiveHigh

Declaration
protected const byte GpioHvMuxActiveHigh = 132

Field Value

Type Description
System.Byte

HistogramConfigInitialPhaseSelect

Declaration
protected const byte HistogramConfigInitialPhaseSelect = 51

Field Value

Type Description
System.Byte

HistogramConfigReadoutCtrl

Declaration
protected const byte HistogramConfigReadoutCtrl = 85

Field Value

Type Description
System.Byte

I2CSlaveDeviceAddress

Declaration
protected const byte I2CSlaveDeviceAddress = 138

Field Value

Type Description
System.Byte

IdentificationModelId

Declaration
protected const byte IdentificationModelId = 192

Field Value

Type Description
System.Byte

IdentificationRevisionId

Declaration
protected const byte IdentificationRevisionId = 194

Field Value

Type Description
System.Byte

MsrcConfigControl

Declaration
protected const byte MsrcConfigControl = 96

Field Value

Type Description
System.Byte

MsrcConfigTimeoutMacrop

Declaration
protected const byte MsrcConfigTimeoutMacrop = 70

Field Value

Type Description
System.Byte

OscCalibrateVal

Declaration
protected const byte OscCalibrateVal = 248

Field Value

Type Description
System.Byte

PowerManagementGo1PowerForce

Declaration
protected const byte PowerManagementGo1PowerForce = 128

Field Value

Type Description
System.Byte

PreRangeConfigMinSnr

Declaration
protected const byte PreRangeConfigMinSnr = 39

Field Value

Type Description
System.Byte

PreRangeConfigSigmaThreshHi

Declaration
protected const byte PreRangeConfigSigmaThreshHi = 97

Field Value

Type Description
System.Byte

PreRangeConfigSigmaThreshLo

Declaration
protected const byte PreRangeConfigSigmaThreshLo = 98

Field Value

Type Description
System.Byte

PreRangeConfigTimeoutMacropHi

Declaration
protected const byte PreRangeConfigTimeoutMacropHi = 81

Field Value

Type Description
System.Byte

PreRangeConfigTimeoutMacropLo

Declaration
protected const byte PreRangeConfigTimeoutMacropLo = 82

Field Value

Type Description
System.Byte

PreRangeConfigValidPhaseHigh

Declaration
protected const byte PreRangeConfigValidPhaseHigh = 87

Field Value

Type Description
System.Byte

PreRangeConfigValidPhaseLow

Declaration
protected const byte PreRangeConfigValidPhaseLow = 86

Field Value

Type Description
System.Byte

PreRangeConfigVcselPeriod

Declaration
protected const byte PreRangeConfigVcselPeriod = 80

Field Value

Type Description
System.Byte

PreRangeMinCountRateRtnLimit

Declaration
protected const byte PreRangeMinCountRateRtnLimit = 100

Field Value

Type Description
System.Byte

RangeStart

Declaration
protected const byte RangeStart = 0

Field Value

Type Description
System.Byte

ResultCoreAmbientWindowEventsRef

Declaration
protected const byte ResultCoreAmbientWindowEventsRef = 208

Field Value

Type Description
System.Byte

ResultCoreAmbientWindowEventsRtn

Declaration
protected const byte ResultCoreAmbientWindowEventsRtn = 188

Field Value

Type Description
System.Byte

ResultCoreRangingTotalEventsRef

Declaration
protected const byte ResultCoreRangingTotalEventsRef = 212

Field Value

Type Description
System.Byte

ResultCoreRangingTotalEventsRtn

Declaration
protected const byte ResultCoreRangingTotalEventsRtn = 192

Field Value

Type Description
System.Byte

ResultInterruptStatus

Declaration
protected const byte ResultInterruptStatus = 19

Field Value

Type Description
System.Byte

ResultPeakSignalRateRef

Declaration
protected const byte ResultPeakSignalRateRef = 182

Field Value

Type Description
System.Byte

ResultRangeStatus

Declaration
protected const byte ResultRangeStatus = 20

Field Value

Type Description
System.Byte

SoftResetGo2SoftResetN

Declaration
protected const byte SoftResetGo2SoftResetN = 191

Field Value

Type Description
System.Byte

SystemHistogramBin

Declaration
protected const byte SystemHistogramBin = 129

Field Value

Type Description
System.Byte

SystemIntermeasurementPeriod

Declaration
protected const byte SystemIntermeasurementPeriod = 4

Field Value

Type Description
System.Byte

SystemInterruptClear

Declaration
protected const byte SystemInterruptClear = 11

Field Value

Type Description
System.Byte

SystemInterruptConfigGpio

Declaration
protected const byte SystemInterruptConfigGpio = 10

Field Value

Type Description
System.Byte

SystemRangeConfig

Declaration
protected const byte SystemRangeConfig = 9

Field Value

Type Description
System.Byte

SystemSequenceConfig

Declaration
protected const byte SystemSequenceConfig = 1

Field Value

Type Description
System.Byte

SystemThreahHigh

Declaration
protected const byte SystemThreahHigh = 12

Field Value

Type Description
System.Byte

SystemThreshLow

Declaration
protected const byte SystemThreshLow = 14

Field Value

Type Description
System.Byte

VcselPeriodFinalRange

Declaration
protected const int VcselPeriodFinalRange = 1

Field Value

Type Description
System.Int32

VcselPeriodPreRange

Declaration
protected const int VcselPeriodPreRange = 0

Field Value

Type Description
System.Int32

VhvConfigPadSclSdaExtsupHv

Declaration
protected const byte VhvConfigPadSclSdaExtsupHv = 137

Field Value

Type Description
System.Byte

Properties

CurrentDistance

Declaration
public float CurrentDistance { get; }

Property Value

Type Description
System.Single

IsShutdown

Declaration
public bool IsShutdown { get; }

Property Value

Type Description
System.Boolean

MaximumDistance

Maximum valid distance in mm (CurrentDistance returns -1 if above).

Declaration
public float MaximumDistance { get; }

Property Value

Type Description
System.Single

MinimumDistance

Minimum valid distance in mm.

Declaration
public float MinimumDistance { get; }

Property Value

Type Description
System.Single

Units

Declaration
public Vl53l0x.UnitType Units { get; set; }

Property Value

Type Description
Vl53l0x.UnitType

Methods

GetRange()

Declaration
protected virtual int GetRange()

Returns

Type Description
System.Int32

GetSpadInfo()

Declaration
protected virtual Tuple<int, bool> GetSpadInfo()

Returns

Type Description
System.Tuple<System.Int32, System.Boolean>

Initialize()

Initializes the VL53L0X

Declaration
public void Initialize()

PerformSingleRefCalibration(Byte)

Declaration
protected virtual void PerformSingleRefCalibration(byte vhvInitByte)

Parameters

Type Name Description
System.Byte vhvInitByte

Range()

Returns the current distance/range

Declaration
public virtual float Range()

Returns

Type Description
System.Single

The distance in the specified Units. Default mm. Returns -1 if the shutdown pin is used and is off

Read(Byte)

Declaration
protected virtual byte Read(byte address)

Parameters

Type Name Description
System.Byte address

Returns

Type Description
System.Byte

Read16(Byte)

Declaration
protected virtual int Read16(byte address)

Parameters

Type Name Description
System.Byte address

Returns

Type Description
System.Int32

SetAddress(Byte)

Set a new I2C address

Declaration
public virtual void SetAddress(byte newAddress)

Parameters

Type Name Description
System.Byte newAddress

Shutdown(Boolean)

Set the Shutdown state of the device

Declaration
public virtual void Shutdown(bool state)

Parameters

Type Name Description
System.Boolean state

true = off/shutdown. false = on

Events

DistanceDetected

Declaration
public event EventHandler<DistanceEventArgs> DistanceDetected

Event Type

Type Description
System.EventHandler<DistanceEventArgs>