![]() |
Qwiic_VL53L1X_Py
packaging_test0-1-gc769ef3
Python for SFE Qwiic VL53L1X
|
Public Member Functions | |
def | __init__ (self, address=None, debug=None, i2c_driver=None) |
This method initializes the class object. More... | |
def | get_distance (self) |
This function returns the distance measured by the sensor in mm. More... | |
def | init_sensor (self, address) |
Initialize the sensor with default values. More... | |
def | get_sw_version (self) |
This function returns the SW driver version. More... | |
def | set_i2c_address (self, new_address) |
This function sets the sensor I2C address used in case multiple devices application, default address 0x29 (0x52 >> 1) More... | |
def | sensor_init (self) |
This function loads the 135 bytes default values to initialize the sensor. More... | |
def | clear_interrupt (self) |
This function clears the interrupt, to be called after a ranging data reading to arm the interrupt for the next data ready event. More... | |
def | set_interrupt_polarity (self, NewPolarity) |
This function programs the interrupt polarity. More... | |
def | get_interrupt_polarity (self) |
This function returns the current interrupt polarity. More... | |
def | start_ranging (self) |
This function starts the ranging distance operation The ranging operation is continuous. More... | |
def | stop_ranging (self) |
This function stops the ranging. More... | |
def | check_for_data_ready (self) |
This function checks if the new ranging data is available by polling the dedicated register. More... | |
def | set_timing_budget_in_ms (self, TimingBudgetInMs) |
This function programs the timing budget in ms. More... | |
def | get_timing_budget_in_ms (self) |
This function returns the current timing budget in ms. More... | |
def | set_distance_mode (self, DM) |
This function programs the distance mode (1=short, 2=long(default)). More... | |
def | get_distance_mode (self) |
This function returns the current distance mode (1=short, 2=long). More... | |
def | set_inter_measurement_in_ms (self, InterMeasMs) |
This function programs the Intermeasurement period in ms. More... | |
def | get_inter_measurement_in_ms (self) |
This function returns the Intermeasurement period in ms. More... | |
def | boot_state (self) |
This function returns the boot state of the device (1:booted, 0:not booted) More... | |
def | get_sensor_id (self) |
This function returns the sensor id, sensor Id must be 0xEEAC. More... | |
def | get_signal_per_spad (self) |
This function returns the returned signal per SPAD in kcps/SPAD (kcps stands for Kilo Count Per Second). More... | |
def | get_ambient_per_spad (self) |
This function returns the ambient per SPAD in kcps/SPAD. More... | |
def | get_signal_rate (self) |
This function returns the returned signal in kcps. More... | |
def | get_spad_nb (self) |
This function returns the current number of enabled SPADs. More... | |
def | get_ambient_rate (self) |
This function returns the ambient rate in kcps. More... | |
def | get_range_status (self) |
This function returns the ranging status error. More... | |
def | set_offset (self, OffsetValue) |
This function programs the offset correction in mm. More... | |
def | get_offset (self) |
This function returns the programmed offset correction value in mm. More... | |
def | set_xtalk (self, XtalkValue) |
This function programs the xtalk correction value in cps (Count Per Second). More... | |
def | get_xtalk (self) |
This function returns the current programmed xtalk correction value in cps. More... | |
def | set_distance_threshold (self, ThreshLow, ThreshHigh, Window, IntOnNoTarget) |
This function programs the threshold detection mode. More... | |
def | get_distance_threshold_window (self) |
This function returns the window detection mode (0=below 1=above 2=out 3=in) More... | |
def | get_distance_threshold_low (self) |
This function returns the low threshold in mm. More... | |
def | get_distance_threshold_high (self) |
This function returns the high threshold in mm. More... | |
def | set_roi (self, X, Y, OpticalCenter=199) |
This function programs the ROI (Region of Interest). More... | |
def | get_roi_xy (self) |
This function returns width X and height Y. More... | |
def | set_signal_threshold (self, Signal) |
This function programs a new signal threshold in kcps (default=1024 kcps) More... | |
def | get_signal_threshold (self) |
This function returns the current signal threshold in kcps. More... | |
def | set_sigma_threshold (self, Sigma) |
This function programs a new sigma threshold in mm (default=15 mm) More... | |
def | get_sigma_threshold (self) |
This function returns the current sigma threshold in mm. More... | |
def | start_temperature_update (self) |
This function performs the temperature calibration. More... | |
def | calibrate_offset (self, TargetDistInMm) |
This function performs the offset calibration. More... | |
def | calibrate_xtalk (self, TargetDistInMm) |
This function performs the xtalk calibration. More... | |
Public Attributes | |
address | |
debug | |
status | |
Static Public Attributes | |
int | VL53L1X_IMPLEMENTATION_VER_MAJOR = 1 |
int | VL53L1X_IMPLEMENTATION_VER_MINOR = 0 |
int | VL53L1X_IMPLEMENTATION_VER_SUB = 1 |
int | VL53L1X_IMPLEMENTATION_VER_REVISION = 0000 |
device_name = _DEFAULT_NAME | |
available_addresses = _AVAILABLE_I2C_ADDRESS | |
def qwiic_vl53l1x.QwiicVL53L1X.__init__ | ( | self, | |
address = None , |
|||
debug = None , |
|||
i2c_driver = None |
|||
) |
This method initializes the class object.
If no 'address' or 'i2c_driver' are inputed or 'None' is specified, the method will use the defaults.
address | The I2C address to use for the device. If not provided, the method will default to the first address in the 'available_addresses' list. Default = 0x29 |
debug | Designated whether or not to print debug statements. 0- Don't print debug statements 1- Print debug statements |
i2c_driver | An existing i2c driver object. If not provided a driver object is created from the 'qwiic_i2c' I2C driver of the SparkFun Qwiic library. |
def qwiic_vl53l1x.QwiicVL53L1X.boot_state | ( | self | ) |
This function returns the boot state of the device (1:booted, 0:not booted)
def qwiic_vl53l1x.QwiicVL53L1X.calibrate_offset | ( | self, | |
TargetDistInMm | |||
) |
This function performs the offset calibration.
The function returns the offset value found and programs the offset compensation into the device.
TargetDistInMm | * Target distance in mm, ST recommended 100 mm
|
def qwiic_vl53l1x.QwiicVL53L1X.calibrate_xtalk | ( | self, | |
TargetDistInMm | |||
) |
This function performs the xtalk calibration.
The function returns the xtalk value found and programs the xtalk compensation to the device
TargetDistInMm | Target distance in mm
|
def qwiic_vl53l1x.QwiicVL53L1X.check_for_data_ready | ( | self | ) |
This function checks if the new ranging data is available by polling the dedicated register.
def qwiic_vl53l1x.QwiicVL53L1X.clear_interrupt | ( | self | ) |
This function clears the interrupt, to be called after a ranging data reading to arm the interrupt for the next data ready event.
def qwiic_vl53l1x.QwiicVL53L1X.get_ambient_per_spad | ( | self | ) |
This function returns the ambient per SPAD in kcps/SPAD.
def qwiic_vl53l1x.QwiicVL53L1X.get_ambient_rate | ( | self | ) |
This function returns the ambient rate in kcps.
def qwiic_vl53l1x.QwiicVL53L1X.get_distance | ( | self | ) |
This function returns the distance measured by the sensor in mm.
def qwiic_vl53l1x.QwiicVL53L1X.get_distance_mode | ( | self | ) |
This function returns the current distance mode (1=short, 2=long).
def qwiic_vl53l1x.QwiicVL53L1X.get_distance_threshold_high | ( | self | ) |
This function returns the high threshold in mm.
def qwiic_vl53l1x.QwiicVL53L1X.get_distance_threshold_low | ( | self | ) |
This function returns the low threshold in mm.
def qwiic_vl53l1x.QwiicVL53L1X.get_distance_threshold_window | ( | self | ) |
This function returns the window detection mode (0=below 1=above 2=out 3=in)
def qwiic_vl53l1x.QwiicVL53L1X.get_inter_measurement_in_ms | ( | self | ) |
This function returns the Intermeasurement period in ms.
def qwiic_vl53l1x.QwiicVL53L1X.get_interrupt_polarity | ( | self | ) |
This function returns the current interrupt polarity.
def qwiic_vl53l1x.QwiicVL53L1X.get_offset | ( | self | ) |
This function returns the programmed offset correction value in mm.
def qwiic_vl53l1x.QwiicVL53L1X.get_range_status | ( | self | ) |
This function returns the ranging status error.
* 0- no error * 1- sigma failed * 2- signal failed * 7- wrap-around
def qwiic_vl53l1x.QwiicVL53L1X.get_roi_xy | ( | self | ) |
This function returns width X and height Y.
def qwiic_vl53l1x.QwiicVL53L1X.get_sensor_id | ( | self | ) |
This function returns the sensor id, sensor Id must be 0xEEAC.
def qwiic_vl53l1x.QwiicVL53L1X.get_sigma_threshold | ( | self | ) |
This function returns the current sigma threshold in mm.
def qwiic_vl53l1x.QwiicVL53L1X.get_signal_per_spad | ( | self | ) |
This function returns the returned signal per SPAD in kcps/SPAD (kcps stands for Kilo Count Per Second).
def qwiic_vl53l1x.QwiicVL53L1X.get_signal_rate | ( | self | ) |
This function returns the returned signal in kcps.
def qwiic_vl53l1x.QwiicVL53L1X.get_signal_threshold | ( | self | ) |
This function returns the current signal threshold in kcps.
def qwiic_vl53l1x.QwiicVL53L1X.get_spad_nb | ( | self | ) |
This function returns the current number of enabled SPADs.
def qwiic_vl53l1x.QwiicVL53L1X.get_sw_version | ( | self | ) |
This function returns the SW driver version.
def qwiic_vl53l1x.QwiicVL53L1X.get_timing_budget_in_ms | ( | self | ) |
This function returns the current timing budget in ms.
def qwiic_vl53l1x.QwiicVL53L1X.get_xtalk | ( | self | ) |
This function returns the current programmed xtalk correction value in cps.
def qwiic_vl53l1x.QwiicVL53L1X.init_sensor | ( | self, | |
address | |||
) |
Initialize the sensor with default values.
address | Device address |
def qwiic_vl53l1x.QwiicVL53L1X.sensor_init | ( | self | ) |
This function loads the 135 bytes default values to initialize the sensor.
def qwiic_vl53l1x.QwiicVL53L1X.set_distance_mode | ( | self, | |
DM | |||
) |
This function programs the distance mode (1=short, 2=long(default)).
Integer | DM: Distance Mode
|
def qwiic_vl53l1x.QwiicVL53L1X.set_distance_threshold | ( | self, | |
ThreshLow, | |||
ThreshHigh, | |||
Window, | |||
IntOnNoTarget | |||
) |
This function programs the threshold detection mode.
mm | ThreshLow: The threshold under which one the device raises an interrupt if Window = 0 |
mm | ThreshHigh: The threshold above which one the device raises an interrupt if Window = 1 |
Window | Window detection mode:
|
IntOnNoTarget | 1 (No longer used - just set to 1) |
Example:
def qwiic_vl53l1x.QwiicVL53L1X.set_i2c_address | ( | self, | |
new_address | |||
) |
This function sets the sensor I2C address used in case multiple devices application, default address 0x29 (0x52 >> 1)
new_address | I2C address to change device to |
def qwiic_vl53l1x.QwiicVL53L1X.set_inter_measurement_in_ms | ( | self, | |
InterMeasMs | |||
) |
This function programs the Intermeasurement period in ms.
InterMeasMs | Intermeasurement period must be >/= timing budget. This condition is not checked by the API, the customer has the duty to check the condition. Default = 100 ms |
def qwiic_vl53l1x.QwiicVL53L1X.set_interrupt_polarity | ( | self, | |
NewPolarity | |||
) |
This function programs the interrupt polarity.
**Integer** | NewPolarity: 1 = active high (default), 0 = active low |
def qwiic_vl53l1x.QwiicVL53L1X.set_offset | ( | self, | |
OffsetValue | |||
) |
This function programs the offset correction in mm.
OffsetValue | The offset correction value to program in mm |
def qwiic_vl53l1x.QwiicVL53L1X.set_roi | ( | self, | |
X, | |||
Y, | |||
OpticalCenter = 199 |
|||
) |
This function programs the ROI (Region of Interest).
The height and width of the ROI (X, Y) are set in SPADs; the smallest acceptable ROI size = 4 (4 x 4). The optical center is set based on table below. To set the center, use the pad that is to the right and above (i.e. upper right of) the exact center of the region you'd like to measure as your optical center.
Table of Optical Centers:
128,136,144,152,160,168,176,184, 192,200,208,216,224,232,240,248 129,137,145,153,161,169,177,185, 193,201,209,217,225,233,241,249 130,138,146,154,162,170,178,186, 194,202,210,218,226,234,242,250 131,139,147,155,163,171,179,187, 195,203,211,219,227,235,243,251 132,140,148,156,164,172,180,188, 196,204,212,220,228,236,244,252 133,141,149,157,165,173,181,189, 197,205,213,221,229,237,245,253 134,142,150,158,166,174,182,190, 198,206,214,222,230,238,246,254 135,143,151,159,167,175,183,191, 199,207,215,223,231,239,247,255 127,119,111,103,095,087,079,071, 063,055,047,039,031,023,015,007 126,118,110,102,094,086,078,070, 062,054,046,038,030,022,014,006 125,117,109,101,093,085,077,069, 061,053,045,037,029,021,013,005 124,116,108,100,092,084,076,068, 060,052,044,036,028,020,012,004 123,115,107,099,091,083,075,067, 059,051,043,035,027,019,011,003 122,114,106,098,090,082,074,066, 058,050,042,034,026,018,010,002 121,113,105,097,089,081,073,065, 057,049,041,033,025,017,009,001 120,112,104,096,088,080,072,064, 056,048,040,032,024,016,008,0 Pin 1 (Each SPAD has a number which is not obvious.)
X | ROI Width |
Y | ROI Height |
OpticalCenter | The pad that is to the upper right of the exact center of the ROI (see table above). (default=199) |
def qwiic_vl53l1x.QwiicVL53L1X.set_sigma_threshold | ( | self, | |
Sigma | |||
) |
This function programs a new sigma threshold in mm (default=15 mm)
Sigma | Sigma threshold in mm (default=15 mm) |
def qwiic_vl53l1x.QwiicVL53L1X.set_signal_threshold | ( | self, | |
Signal | |||
) |
This function programs a new signal threshold in kcps (default=1024 kcps)
Signal | Signal threshold in kcps (default=1024 kcps) |
def qwiic_vl53l1x.QwiicVL53L1X.set_timing_budget_in_ms | ( | self, | |
TimingBudgetInMs | |||
) |
This function programs the timing budget in ms.
TimingBudgetInMs | Predefined values = 15, 20, 33, 50, 100 (default), 200, 500. |
def qwiic_vl53l1x.QwiicVL53L1X.set_xtalk | ( | self, | |
XtalkValue | |||
) |
This function programs the xtalk correction value in cps (Count Per Second).
This is the number of photons reflected back from the cover glass in cps.
XTalkValue | xtalk correction value in count per second to avoid float type |
def qwiic_vl53l1x.QwiicVL53L1X.start_ranging | ( | self | ) |
This function starts the ranging distance operation The ranging operation is continuous.
The clear interrupt has to be done after each get data to allow the interrupt to raise when the next data is ready 1=active high (default), 0=active low, use set_interrupt_polarity() to change the interrupt polarity if required.
def qwiic_vl53l1x.QwiicVL53L1X.start_temperature_update | ( | self | ) |
This function performs the temperature calibration.
It is recommended to call this function any time the temperature might have changed by more than 8 deg C without sensor ranging activity for an extended period.
def qwiic_vl53l1x.QwiicVL53L1X.stop_ranging | ( | self | ) |
This function stops the ranging.
qwiic_vl53l1x.QwiicVL53L1X.address |
|
static |
qwiic_vl53l1x.QwiicVL53L1X.debug |
|
static |
qwiic_vl53l1x.QwiicVL53L1X.status |
|
static |
|
static |
|
static |
|
static |