Workshop example

Dependencies:   X_NUCLEO_COMMON ST_INTERFACES

Embed: (wiki syntax)

« Back to documentation index

Init functions

Init functions

Wrapper functions. More...

Functions

virtual int init (void *init)
 One time device initialization.
int prepare ()
 Prepare device for operation.
int range_start_continuous_mode ()
 Start continuous ranging mode.
virtual int get_distance (uint32_t *p_data)
 Get ranging result and only that.

Detailed Description

Wrapper functions.

API init functions


Function Documentation

virtual int get_distance ( uint32_t *  p_data ) [virtual, inherited]

Get ranging result and only that.

Function Description
Unlike VL53L0X_get_ranging_measurement_data() this function only retrieves the range in millimeter
It does any required up-scale translation
It can be called after success status polling or in interrupt mode
Warning:
these function is not doing wrap around filtering
This function doesn't perform any data ready check!
Parameters:
p_dataPointer to range distance
Returns:
"0" on success

Definition at line 555 of file VL53L0X.h.

virtual int init ( void *  init ) [virtual, inherited]

One time device initialization.

To be called once and only once after device is brought out of reset (Chip enable) and booted.

Function Description
When not used after a fresh device "power up" or reset, it may return CALIBRATION_WARNING meaning wrong calibration data may have been fetched from device that can result in ranging offset error
If application cannot execute device reset or need to run VL53L0X_data_init multiple time then it must ensure proper offset calibration saving and restore on its own by using VL53L0X_get_offset_calibration_data_micro_meter() on first power up and then VL53L0X_set_offset_calibration_data_micro_meter() all all subsequent init
Parameters:
void
Returns:
"0" on success, CALIBRATION_WARNING if failed

Definition at line 476 of file VL53L0X.h.

int prepare (  ) [inherited]

Prepare device for operation.

Function Description
Does static initialization and reprogram common default settings
Device is prepared for new measure, ready single shot ranging or ALS typical polling operation
After prepare user can :
  • Call other API function to set other settings
  • Configure the interrupt pins, etc...
  • Then start ranging or ALS operations in single shot or continuous mode
Parameters:
void
Returns:
"0" on success

Definition at line 494 of file VL53L0X.h.

int range_start_continuous_mode (  ) [inherited]

Start continuous ranging mode.

End user should ensure device is in idle state and not already running

Returns:
"0" on success

Definition at line 529 of file VL53L0X.h.