Code petit robot

Dependencies:   X_NUCLEO_COMMON X_NUCLEO_IHM01A1 mbed

Embed: (wiki syntax)

« Back to documentation index

VL6180X Class Reference

VL6180X Class Reference

Class representing a VL6180X sensor component. More...

#include <vl6180x_class.h>

Inherits RangeSensor, and LightSensor.

Public Member Functions

 VL6180X (DevI2C &i2c, uint8_t DevAddr=DEFAULT_DEVICE_ADDRESS)
 Constructor 1.
virtual ~VL6180X ()
 Destructor.
void VL6180x_On (void)
 PowerOn the sensor.
void VL6180x_Off (void)
 PowerOff the sensor.
int InitSensor (uint8_t NewAddr)
 Initialize the sensor with default values.
int StartMeasurement (OperatingMode operating_mode, void(*fptr)(void), uint16_t low, uint16_t high)
 Start the measure indicated by operating mode.
int GetMeasurement (OperatingMode operating_mode, MeasureData_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, MeasureData_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 ()
 One time device initialization.
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 (VL6180x_RangeData_t *pRangeData)
 Single shot Range measurement in polling mode.
int RangeGetMeasurementIfReady (VL6180x_RangeData_t *pRangeData)
 Check for measure readiness and get it if ready.
int RangeGetMeasurement (VL6180x_RangeData_t *pRangeData)
 Retrieve range measurements set from device.
virtual int GetRange (int32_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 AlsPollMeasurement (VL6180x_AlsData_t *pAlsData)
 Run a single ALS measurement in single shot polling mode.
int AlsGetMeasurement (VL6180x_AlsData_t *pAlsData)
 Get actual ALS measurement.
int AlsConfigInterrupt (uint8_t ConfigGpioInt)
 Configure ALS interrupts provide to application.
int AlsSetIntegrationPeriod (uint16_t period_ms)
 Set ALS integration period.
int AlsSetInterMeasurementPeriod (uint16_t intermeasurement_period_ms)
 Set ALS "inter-measurement period".
int AlsSetAnalogueGain (uint8_t gain)
 Set ALS analog gain code.
int AlsSetThresholds (uint16_t lux_threshold_low, uint16_t lux_threshold_high)
 Set thresholds for ALS continuous mode.
int AlsGetInterruptStatus (uint8_t *pIntStatus)
 Read ALS 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 (FixPoint97_t Rate)
 Set Cross talk compensation rate.
int AlsWaitDeviceReady (int MaxLoop)
 Wait for device to be ready for new als operation or max pollign loop (time out)
int AlsSetSystemMode (uint8_t mode)
 Set ALS system mode and start/stop measure.
int SetGroupParamHold (int Hold)
 Set Group parameter Hold state.
int SetI2CAddress (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.
virtual int GetLight (uint32_t *piData)
 Get the ALS (light in Lux) level.
int AlsStartContinuousMode ()
 Start the ALS (light) measure in continous mode.
int AlsStartSingleShot ()
 Start the ALS (light) measure in single shot mode.

Detailed Description

Class representing a VL6180X sensor component.

Definition at line 96 of file vl6180x_class.h.


Constructor & Destructor Documentation

VL6180X ( DevI2C &  i2c,
uint8_t  DevAddr = DEFAULT_DEVICE_ADDRESS 
)

Constructor 1.

Parameters:
[in]&i2cdevice I2C to be used for communication
[in]&pinMbed DigitalOut pin to be used as component GPIO_0 CE
[in]pin_gpio1pin Mbed InterruptIn PinName to be used as component GPIO_1 INT
[in]DevAddrdevice address, 0x29 by default

Definition at line 105 of file vl6180x_class.h.

virtual ~VL6180X (  ) [virtual]

Destructor.

Definition at line 115 of file vl6180x_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 200 of file vl6180x_class.h.

void DisableInterruptMeasureDetectionIRQ ( void   )

Disable interrupt measure IRQ.

Returns:
0 on Success

Definition at line 190 of file vl6180x_class.h.

void EnableInterruptMeasureDetectionIRQ ( void   )

Enable interrupt measure IRQ.

Returns:
0 on Success

Definition at line 182 of file vl6180x_class.h.

unsigned Present (  )

Check the sensor presence.

Returns:
1 when device is present

Definition at line 208 of file vl6180x_class.h.

void VL6180x_Off ( void   )

PowerOff the sensor.

Returns:
void

Definition at line 135 of file vl6180x_class.h.

void VL6180x_On ( void   )

PowerOn the sensor.

Returns:
void

Definition at line 126 of file vl6180x_class.h.