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
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] &i2c device I2C to be used for communication [in] &pin_gpio1 pin Mbed InterruptIn PinName to be used as component GPIO_1 INT [in] DevAddr device 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] i2c device I2C to be used for communication [in] &pin Gpio Expander STMPE1600DigiOut pin to be used as component GPIO_0 CE [in] pin_gpio1 pin Mbed InterruptIn PinName to be used as component GPIO_1 INT [in] device address, 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] fptr pointer 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:
-
pin The pin number to disable 0 or 1
- Returns:
- 0 on success
Definition at line 1137 of file vl53l0x_class.h.
void DisableInterruptMeasureDetectionIRQ | ( | void | ) |
void EnableInterruptMeasureDetectionIRQ | ( | void | ) |
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:
-
NewAddr The 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:
-
pin Pin to configure 0 or 1 (gpio0 or gpio1) that gpio0 is chip enable at power up ! functionality Pin 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:
-
pin Pin 0 or 1 active_high select 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:
-
pin gpio pin 0 or 1 IntFunction Pin functionality : either GPIOx_SELECT_OFF or GPIOx_SELECT_GPIO_INTERRUPT_OUTPUT (refer to SYSTEM_MODE_GPIO1 register definition) ActiveHigh Set 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 | ) |
void VL53L0X_On | ( | void | ) |
Generated on Tue Jul 12 2022 21:41:59 by 1.7.2