Initial release. Mbed library for VL53L1CB

Embed: (wiki syntax)

« Back to documentation index

VL53L1X Class Reference

VL53L1X Class Reference

Class representing a VL53L1 sensor component. More...

#include <vl53l1x.h>

Inherits RangeSensor.

Public Member Functions

 VL53L1X (ToF_DevI2C *i2c, DigitalOut *pin, PinName pin_gpio1, uint8_t dev_addr=VL53L1X_DEFAULT_DEVICE_ADDRESS)
 Constructor.
 VL53L1X (ToF_DevI2C *i2c, Stmpe1600DigiOut *pin, PinName pin_gpio1, uint8_t dev_addr=VL53L1X_DEFAULT_DEVICE_ADDRESS)
 Constructor 2 (STMPE1600DigiOut)
virtual ~VL53L1X ()
 Destructor.
virtual void VL53L1_On (void)
 PowerOn the sensor.
virtual void VL53L1_Off (void)
 PowerOff the sensor.
VL53L1X_ERROR InitSensor (uint8_t address)
 Initialize the sensor with default values.
virtual int init (void *init)
 One time device initialization.
int init_sensor (uint8_t new_addr)
 Initialize the sensor with default values.
virtual int read_id (uint8_t *id)
 Getting the ID of the component.
virtual int get_distance (uint32_t *piData)
 Get ranging result and only that.
VL53L1X_ERROR VL53L1X_GetSWVersion (VL53L1X_Version_t *pVersion)
 This function returns the SW driver version.
VL53L1X_ERROR vl53L1X_SetI2CAddress (uint8_t new_address)
 This function sets the sensor I2C address used in case multiple devices application, default address 0x52.
VL53L1X_ERROR VL53L1X_SensorInit ()
 This function loads the 135 bytes default values to initialize the sensor.
VL53L1X_ERROR VL53L1X_ClearInterrupt ()
 This function clears the interrupt, to be called after a ranging data reading to arm the interrupt for the next data ready event.
VL53L1X_ERROR VL53L1X_GetInterruptPolarity (uint8_t *pIntPol)
 This function returns the current interrupt polarity
1=active high (default), 0=active low.
VL53L1X_ERROR VL53L1X_StartRanging ()
 This function starts the ranging distance operation
The ranging operation is continuous.
VL53L1X_ERROR VL53L1X_StopRanging ()
 This function stops the ranging.
VL53L1X_ERROR vl53L1X_BootState (uint8_t *state)
 This function returns the boot state of the device (1:booted, 0:not booted)
VL53L1X_ERROR VL53L1X_GetDistance (uint16_t *distance)
 This function returns the sensor id, sensor Id must be 0xEEAC.

Protected Attributes

VL53L1_Dev_t MyDevice
 * Digital out pin */

Detailed Description

Class representing a VL53L1 sensor component.

Definition at line 135 of file vl53l1x.h.


Constructor & Destructor Documentation

VL53L1X ( ToF_DevI2C *  i2c,
DigitalOut *  pin,
PinName  pin_gpio1,
uint8_t  dev_addr = VL53L1X_DEFAULT_DEVICE_ADDRESS 
)

Constructor.

Parameters:
[in]&i2cdevice I2C to be used for communication
[in]&pin_gpio1pin Mbed InterruptIn PinName to be used as component GPIO_1 INT
[in]DevAddrdevice address, 0x52 by default

Definition at line 150 of file vl53l1x.h.

VL53L1X ( ToF_DevI2C *  i2c,
Stmpe1600DigiOut pin,
PinName  pin_gpio1,
uint8_t  dev_addr = VL53L1X_DEFAULT_DEVICE_ADDRESS 
)

Constructor 2 (STMPE1600DigiOut)

Parameters:
[in]i2cdevice I2C to be used for communication
[in]&pinGpio Expander STMPE1600DigiOut pin to be used as component GPIO_0 CE
[in]pin_gpio1pin Mbed InterruptIn PinName to be used as component GPIO_1 INT
[in]deviceaddress, 0x29 by default

Definition at line 171 of file vl53l1x.h.

virtual ~VL53L1X (  ) [virtual]

Destructor.

Definition at line 188 of file vl53l1x.h.


Member Function Documentation

virtual int get_distance ( uint32_t *  piData ) [virtual]

Get ranging result and only that.

Parameters:
pRange_mmPointer to range distance
Returns:
0 on success

Implements RangeSensor.

Definition at line 332 of file vl53l1x.h.

virtual int init ( void *  init ) [virtual]

One time device initialization.

Parameters:
void
Returns:
0 on success, CALIBRATION_WARNING if failed

Implements Component.

Definition at line 283 of file vl53l1x.h.

int init_sensor ( uint8_t  new_addr )

Initialize the sensor with default values.

Returns:
"0" on success

Definition at line 96 of file vl53l1x.cpp.

VL53L1X_ERROR InitSensor ( uint8_t  address )

Initialize the sensor with default values.

Returns:
0 on Success

Definition at line 258 of file vl53l1x.h.

virtual int read_id ( uint8_t *  id ) [virtual]

Getting the ID of the component.

Parameters:
[out]idpointer to an allocated variable to store the ID into.
Return values:
0in case of success, an error code otherwise.

Implements Component.

Definition at line 297 of file vl53l1x.h.

virtual void VL53L1_Off ( void   ) [virtual]

PowerOff the sensor.

Returns:
void

Definition at line 228 of file vl53l1x.h.

virtual void VL53L1_On ( void   ) [virtual]

PowerOn the sensor.

Returns:
void

Definition at line 210 of file vl53l1x.h.

VL53L1X_ERROR vl53L1X_BootState ( uint8_t *  state )

This function returns the boot state of the device (1:booted, 0:not booted)

Definition at line 189 of file vl53l1x.cpp.

VL53L1X_ERROR VL53L1X_ClearInterrupt (  )

This function clears the interrupt, to be called after a ranging data reading to arm the interrupt for the next data ready event.

Definition at line 143 of file vl53l1x.cpp.

VL53L1X_ERROR VL53L1X_GetDistance ( uint16_t *  distance )

This function returns the sensor id, sensor Id must be 0xEEAC.

This function returns the distance measured by the sensor in mm

Definition at line 200 of file vl53l1x.cpp.

VL53L1X_ERROR VL53L1X_GetInterruptPolarity ( uint8_t *  pIntPol )

This function returns the current interrupt polarity
1=active high (default), 0=active low.

Definition at line 156 of file vl53l1x.cpp.

VL53L1X_ERROR VL53L1X_GetSWVersion ( VL53L1X_Version_t pVersion )

This function returns the SW driver version.

Definition at line 68 of file vl53l1x.cpp.

VL53L1X_ERROR VL53L1X_SensorInit (  )

This function loads the 135 bytes default values to initialize the sensor.

Parameters:
devDevice address
Returns:
0:success, != 0:failed

Definition at line 112 of file vl53l1x.cpp.

VL53L1X_ERROR vl53L1X_SetI2CAddress ( uint8_t  new_address )

This function sets the sensor I2C address used in case multiple devices application, default address 0x52.

Definition at line 79 of file vl53l1x.cpp.

VL53L1X_ERROR VL53L1X_StartRanging (  )

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 SetInterruptPolarity() to change the interrupt polarity if required.

Definition at line 169 of file vl53l1x.cpp.

VL53L1X_ERROR VL53L1X_StopRanging (  )

This function stops the ranging.

Definition at line 178 of file vl53l1x.cpp.


Field Documentation

VL53L1_Dev_t MyDevice [protected]

* Digital out pin */

Definition at line 644 of file vl53l1x.h.