Changes to the library related to interrupt mode.

Dependencies:   ST_INTERFACES X_NUCLEO_COMMON

Dependents:   Display_53L0A1_IntSatelites Display_53L0A1_InterruptMode

Fork of X_NUCLEO_53L0A1 by ST

Embed: (wiki syntax)

« Back to documentation index

VL53L0X Class Reference

VL53L0X Class Reference

Class representing a VL53L0 sensor component. More...

#include <vl53l0x_class.h>

Public Member Functions

 VL53L0X (DevI2C &i2c, DigitalOut &pin, PinName pin_gpio1, uint8_t DevAddr=DEFAULT_DEVICE_ADDRESS)
 Constructor.
 VL53L0X (DevI2C &i2c, STMPE1600DigiOut &pin, PinName pin_gpio1, uint8_t DevAddr=DEFAULT_DEVICE_ADDRESS)
 Constructor 2 (STMPE1600DigiOut)
virtual ~VL53L0X ()
 Destructor.
void VL53L0X_On (void)
 PowerOn the sensor.
void VL53L0X_Off (void)
 PowerOff the sensor.
int InitSensor (uint8_t NewAddr)
 Initialize the sensor with default values.
int StartMeasurement (OperatingMode operating_mode, void(*fptr)(void))
 Start the measure indicated by operating mode.
int GetMeasurement (OperatingMode operating_mode, VL53L0X_RangingMeasurementData_t *Data)
 Get results for the measure indicated by operating mode.
int StopMeasurement (OperatingMode operating_mode)
 Stop the currently running measure indicate by operating_mode.
int HandleIRQ (OperatingMode operating_mode, VL53L0X_RangingMeasurementData_t *Data)
 Interrupt handling func to be called by user after an INT is occourred.
void EnableInterruptMeasureDetectionIRQ (void)
 Enable interrupt measure IRQ.
void DisableInterruptMeasureDetectionIRQ (void)
 Disable interrupt measure IRQ.
void AttachInterruptMeasureDetectionIRQ (void(*fptr)(void))
 Attach a function to call when an interrupt is detected, i.e.
unsigned Present ()
 Check the sensor presence.
int WaitDeviceBooted ()
 Wait for device booted after chip enable (hardware standby)
virtual int init (void *init)
 One time device initialization.
virtual int Init (void *NewAddr)
 deprecated Init funtion from ComponentObject.
int SetupGPIO1 (uint8_t InitFunction, int ActiveHigh)
 Configure GPIO1 function and set polarity.
int Prepare ()
 Prepare device for operation.
int RangeStartContinuousMode ()
 Start continuous ranging mode.
int RangeStartSingleShot ()
 Start single shot ranging measure.
int RangeSetMaxConvergenceTime (uint8_t MaxConTime_msec)
 Set maximum convergence time.
int RangePollMeasurement (VL53L0X_RangingMeasurementData_t *pRangeData)
 Single shot Range measurement in polling mode.
int RangeGetMeasurementIfReady (VL53L0X_RangingMeasurementData_t *pRangeData)
 Check for measure readiness and get it if ready.
int RangeGetMeasurement (VL53L0X_RangingMeasurementData_t *pRangeData)
 Retrieve range measurements set from device.
virtual int get_distance (uint32_t *piData)
 Get ranging result and only that.
int RangeConfigInterrupt (uint8_t ConfigGpioInt)
 Configure ranging interrupt reported to application.
int RangeGetInterruptStatus (uint8_t *pIntStatus)
 Return ranging error interrupt status.
int StaticInit ()
 Low level ranging and ALS register static settings (you should call VL6180x_Prepare() function instead)
int RangeWaitDeviceReady (int MaxLoop)
 Wait for device to be ready (before a new ranging command can be issued by application)
int RangeSetInterMeasPeriod (uint32_t InterMeasTime_msec)
 Program Inter measurement period (used only in continuous mode)
int UpscaleSetScaling (uint8_t scaling)
 Set device ranging scaling factor.
int UpscaleGetScaling ()
 Get current ranging scaling factor.
uint16_t GetUpperLimit ()
 Get the maximal distance for actual scaling.
int RangeSetThresholds (uint16_t low, uint16_t high, int SafeHold)
 Apply low and high ranging thresholds that are considered only in continuous mode.
int RangeGetThresholds (uint16_t *low, uint16_t *high)
 Get scaled high and low threshold from device.
int RangeSetRawThresholds (uint8_t low, uint8_t high)
 Set ranging raw thresholds (scaling not considered so not recommended to use it)
int RangeSetEceFactor (uint16_t FactorM, uint16_t FactorD)
 Set Early Convergence Estimate ratio.
int RangeSetEceState (int enable)
 Set Early Convergence Estimate state (See SYSRANGE_RANGE_CHECK_ENABLES register)
int FilterSetState (int state)
 Set activation state of the wrap around filter.
int FilterGetState ()
 Get activation state of the wrap around filter.
int DMaxSetState (int state)
 Set activation state of DMax computation.
int DMaxGetState ()
 Get activation state of DMax computation.
int RangeSetSystemMode (uint8_t mode)
 Set ranging mode and start/stop measure (use high level functions instead : VL6180x_RangeStartSingleShot() or VL6180x_RangeStartContinuousMode())
int8_t GetOffsetCalibrationData ()
 Get part to part calibration offset.
void SetOffsetCalibrationData (int8_t offset)
 Set or over-write part to part calibration offset.
int SetXTalkCompensationRate (uint16_t Rate)
 Set Cross talk compensation rate.
int SetDeviceAddress (int NewAddr)
 Set new device i2c address.
int SetupGPIOx (int pin, uint8_t IntFunction, int ActiveHigh)
 Fully configure gpio 0/1 pin : polarity and functionality.
int SetGPIOxPolarity (int pin, int active_high)
 Set interrupt pin polarity for the given GPIO.
int SetGPIOxFunctionality (int pin, uint8_t functionality)
 Select interrupt functionality for the given GPIO.
int DisableGPIOxOut (int pin)
 brief Disable and turn to Hi-Z gpio output pin
int GetInterruptStatus (uint8_t *status)
 Get all interrupts cause.
int ClearInterrupt (uint8_t IntClear)
 Clear given system interrupt condition.

Detailed Description

Class representing a VL53L0 sensor component.

Definition at line 298 of file vl53l0x_class.h.


Constructor & Destructor Documentation

VL53L0X ( DevI2C &  i2c,
DigitalOut &  pin,
PinName  pin_gpio1,
uint8_t  DevAddr = 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, 0x29 by default

Definition at line 306 of file vl53l0x_class.h.

VL53L0X ( DevI2C &  i2c,
STMPE1600DigiOut pin,
PinName  pin_gpio1,
uint8_t  DevAddr = 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 323 of file vl53l0x_class.h.

virtual ~VL53L0X (  ) [virtual]

Destructor.

Definition at line 336 of file vl53l0x_class.h.


Member Function Documentation

void AttachInterruptMeasureDetectionIRQ ( 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 442 of file vl53l0x_class.h.

int DisableGPIOxOut ( int  pin )

brief Disable and turn to Hi-Z gpio output pin

Parameters:
pinThe pin number to disable 0 or 1
Returns:
0 on success

Definition at line 1137 of file vl53l0x_class.h.

void DisableInterruptMeasureDetectionIRQ ( void   )

Disable interrupt measure IRQ.

Returns:
0 on Success

Definition at line 431 of file vl53l0x_class.h.

void EnableInterruptMeasureDetectionIRQ ( void   )

Enable interrupt measure IRQ.

Returns:
0 on Success

Definition at line 422 of file vl53l0x_class.h.

unsigned Present (  )

Check the sensor presence.

Returns:
1 when device is present

Definition at line 451 of file vl53l0x_class.h.

int SetDeviceAddress ( int  NewAddr )

Set new device i2c address.

After completion the device will answer to the new address programmed.

See also:
AN4478: Using multiple VL6180X's in a single design
Parameters:
NewAddrThe new i2c address (7bit)
Returns:
0 on success

Definition at line 1077 of file vl53l0x_class.h.

int SetGPIOxFunctionality ( int  pin,
uint8_t  functionality 
)

Select interrupt functionality for the given GPIO.

Function Description
Functionality refer to SYSTEM_MODE_GPIO0
Parameters:
pinPin to configure 0 or 1 (gpio0 or gpio1) that gpio0 is chip enable at power up !
functionalityPin functionality : either GPIOx_SELECT_OFF or GPIOx_SELECT_GPIO_INTERRUPT_OUTPUT (refer to SYSTEM_MODE_GPIO1 register definition)
Returns:
0 on success

Definition at line 1125 of file vl53l0x_class.h.

int SetGPIOxPolarity ( int  pin,
int  active_high 
)

Set interrupt pin polarity for the given GPIO.

Parameters:
pinPin 0 or 1
active_highselect active high or low polarity using IntrPol_e
Returns:
0 on success

Definition at line 1109 of file vl53l0x_class.h.

int SetupGPIOx ( int  pin,
uint8_t  IntFunction,
int  ActiveHigh 
)

Fully configure gpio 0/1 pin : polarity and functionality.

Parameters:
pingpio pin 0 or 1
IntFunctionPin functionality : either GPIOx_SELECT_OFF or GPIOx_SELECT_GPIO_INTERRUPT_OUTPUT (refer to SYSTEM_MODE_GPIO1 register definition)
ActiveHighSet active high polarity, or active low see IntrPol_e
Returns:
0 on success

Definition at line 1096 of file vl53l0x_class.h.

void VL53L0X_Off ( void   )

PowerOff the sensor.

Returns:
void

Definition at line 363 of file vl53l0x_class.h.

void VL53L0X_On ( void   )

PowerOn the sensor.

Returns:
void

Definition at line 349 of file vl53l0x_class.h.