ST Expansion SW Team / VL53L1

Dependencies:   X_NUCLEO_COMMON ST_INTERFACES

Dependents:   X_NUCLEO_53L1CB

Embed: (wiki syntax)

« Back to documentation index

VL53L1CB Class Reference

VL53L1CB Class Reference

defines SW Version More...

#include <VL53L1CB.h>

Public Member Functions

 VL53L1CB (ToF_DevI2C *i2c, Stmpe1600DigiOut *pin, PinName pin_gpio1, uint8_t dev_addr=VL53L1CB_DEFAULT_DEVICE_ADDRESS)
 Constructor.
virtual ~VL53L1CB ()
 Destructor.
virtual void VL53L1CB_On (void)
 PowerOn the sensor.
virtual void VL53L1CB_Off (void)
 PowerOff the sensor.
VL53L1CB_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.
int handle_irq (uint16_t *distance)
 Interrupt handling func to be called by user after an INT is occurred.
int start_measurement (void(*fptr)(void))
 Start the measure indicated by operating mode.
int stop_measurement ()
 Stop the currently running measure indicate by operating_mode.
int get_measurement (uint16_t *distance)
 Get results for the measure.
void enable_interrupt_measure_detection_irq (void)
 Enable interrupt measure IRQ.
void disable_interrupt_measure_detection_irq (void)
 Disable interrupt measure IRQ.
void attach_interrupt_measure_detection_irq (void(*fptr)(void))
 Attach a function to call when an interrupt is detected, i.e.
virtual int get_distance (uint32_t *piData)
 Get ranging result and only that.
VL53L1CB_ERROR VL53L1CB_GetSWVersion (VL53L1_Version_t *pVersion)
 This function returns the SW driver version.
VL53L1CB_ERROR VL53L1CB_SetI2CAddress (uint8_t new_address)
 This function sets the sensor I2C address used in case multiple devices application, default address 0x52.
VL53L1CB_ERROR VL53L1CB_SensorInit ()
 This function loads the 135 bytes default values to initialize the sensor.
VL53L1CB_ERROR VL53L1CB_ClearInterrupt ()
 This function clears the interrupt, to be called after a ranging data reading to arm the interrupt for the next data ready event.
VL53L1CB_ERROR VL53L1CB_GetInterruptPolarity (uint8_t *pIntPol)
 This function returns the current interrupt polarity
1=active high (default), 0=active low.
VL53L1CB_ERROR VL53L1CB_StartRanging ()
 This function starts the ranging distance operation
The ranging operation is continuous.
VL53L1CB_ERROR VL53L1CB_StopRanging ()
 This function stops the ranging.
VL53L1CB_ERROR VL53L1CB_BootState (uint8_t *state)
 This function returns the boot state of the device (1:booted, 0:not booted)
VL53L1CB_ERROR VL53L1CB_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

defines SW Version

Class representing a VL53L1CB sensor component

Definition at line 121 of file VL53L1CB.h.


Constructor & Destructor Documentation

VL53L1CB ( ToF_DevI2C *  i2c,
Stmpe1600DigiOut pin,
PinName  pin_gpio1,
uint8_t  dev_addr = VL53L1CB_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 Constructor 2 (STMPE1600DigiOut)
[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 157 of file VL53L1CB.h.

virtual ~VL53L1CB (  ) [virtual]

Destructor.

Definition at line 174 of file VL53L1CB.h.


Member Function Documentation

void attach_interrupt_measure_detection_irq ( void(*)(void)  fptr )

Attach a function to call when an interrupt is detected, i.e.

measurement is ready

Parameters:
[in]fptrpointer to call back function to be called whenever an interrupt occours
Returns:
0 on Success

Definition at line 373 of file VL53L1CB.h.

void disable_interrupt_measure_detection_irq ( void   )

Disable interrupt measure IRQ.

Returns:
0 on Success

Definition at line 363 of file VL53L1CB.h.

void enable_interrupt_measure_detection_irq ( void   )

Enable interrupt measure IRQ.

Returns:
0 on Success

Definition at line 353 of file VL53L1CB.h.

virtual int get_distance ( uint32_t *  piData ) [virtual]

Get ranging result and only that.

Parameters:
pRange_mmPointer to range distance
Returns:
0 on success

Definition at line 384 of file VL53L1CB.h.

int get_measurement ( uint16_t *  distance )

Get results for the measure.

Parameters:
[out]Datapointer to the distance_data to read data in to
Returns:
0 on Success

Definition at line 929 of file VL53l1CB.cpp.

int handle_irq ( uint16_t *  distance )

Interrupt handling func to be called by user after an INT is occurred.

Parameters:
[out]Datapointer to the distance to read data in to
Returns:
0 on Success

Definition at line 921 of file VL53l1CB.cpp.

virtual int init ( void *  init ) [virtual]

One time device initialization.

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

Definition at line 282 of file VL53L1CB.h.

int init_sensor ( uint8_t  new_addr )

Initialize the sensor with default values.

Returns:
"0" on success

Definition at line 96 of file VL53l1CB.cpp.

VL53L1CB_ERROR InitSensor ( uint8_t  address )

Initialize the sensor with default values.

Returns:
0 on Success

Definition at line 252 of file VL53L1CB.h.

int start_measurement ( void(*)(void)  fptr )

Start the measure indicated by operating mode.

Parameters:
[in]fptrspecifies call back function must be !NULL in case of interrupt measure
Returns:
0 on Success

Definition at line 939 of file VL53l1CB.cpp.

int stop_measurement (  )

Stop the currently running measure indicate by operating_mode.

Returns:
0 on Success

Definition at line 962 of file VL53l1CB.cpp.

VL53L1CB_ERROR VL53L1CB_BootState ( uint8_t *  state )

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

Definition at line 189 of file VL53l1CB.cpp.

VL53L1CB_ERROR VL53L1CB_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 VL53l1CB.cpp.

VL53L1CB_ERROR VL53L1CB_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 VL53l1CB.cpp.

VL53L1CB_ERROR VL53L1CB_GetInterruptPolarity ( uint8_t *  pIntPol )

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

Definition at line 156 of file VL53l1CB.cpp.

VL53L1CB_ERROR VL53L1CB_GetSWVersion ( VL53L1_Version_t pVersion )

This function returns the SW driver version.

Definition at line 68 of file VL53l1CB.cpp.

virtual void VL53L1CB_Off ( void   ) [virtual]

PowerOff the sensor.

Returns:
void

Definition at line 218 of file VL53L1CB.h.

virtual void VL53L1CB_On ( void   ) [virtual]

PowerOn the sensor.

Returns:
void

Definition at line 196 of file VL53L1CB.h.

VL53L1CB_ERROR VL53L1CB_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 VL53l1CB.cpp.

VL53L1CB_ERROR VL53L1CB_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 VL53l1CB.cpp.

VL53L1CB_ERROR VL53L1CB_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 VL53l1CB.cpp.

VL53L1CB_ERROR VL53L1CB_StopRanging (  )

This function stops the ranging.

Definition at line 178 of file VL53l1CB.cpp.


Field Documentation

VL53L1_Dev_t MyDevice [protected]

* Digital out pin */

Definition at line 694 of file VL53L1CB.h.