lightranger8 2.0.0.0
|
API for configuring and manipulating LightRanger 8 Click driver. More...
Topics | |
LightRanger 8 Registers List | |
List of registers of LightRanger 8 Click driver. | |
LightRanger 8 MikroBUS Map | |
MikroBUS pin mapping of LightRanger 8 Click driver. | |
Lightranger8_set | |
Distance_mode | |
Ranging_mode | |
Lightranger8_resp | |
8 error_code | |
Functions | |
void | lightranger8_cfg_setup (lightranger8_cfg_t *cfg) |
LightRanger 8 configuration object setup function. | |
err_t | lightranger8_init (lightranger8_t *ctx, lightranger8_cfg_t *cfg) |
LightRanger 8 initialization function. | |
err_t | lightranger8_default_cfg (lightranger8_t *ctx) |
LightRanger 8 default configuration function. | |
err_t | lightranger8_generic_write (lightranger8_t *ctx, uint16_t reg, uint8_t *tx_buf, uint8_t tx_len) |
LightRanger 8 I2C writing function. | |
err_t | lightranger8_generic_read (lightranger8_t *ctx, uint16_t reg, uint8_t *rx_buf, uint8_t rx_len) |
LightRanger 8 I2C reading function. | |
void | lightranger8_software_reset (lightranger8_t *ctx) |
LightRanger 8 software reset function. | |
void | lightranger8_system_interrupt_clear (lightranger8_t *ctx) |
LightRanger 8 system interrupt clear function. | |
void | lightranger8_start_ranging_cmd (lightranger8_t *ctx, uint8_t ranging_mode) |
LightRanger 8 start ranging function. | |
void | lightranger8_start_measurement (lightranger8_t *ctx, uint32_t period_ms) |
LightRanger 8 start measurement function. | |
void | lightranger8_stop_measurement (lightranger8_t *ctx) |
LightRanger 8 stop measurement function. | |
uint8_t | lightranger8_new_data_ready (lightranger8_t *ctx) |
LightRanger 8 data ready function. | |
uint16_t | lightranger8_get_distance (lightranger8_t *ctx) |
LightRanger 8 get distance function. | |
uint16_t | lightranger8_get_signal_rate (lightranger8_t *ctx) |
LightRanger 8 get signal rate function. | |
uint8_t | lightranger8_set_distance_mode (lightranger8_t *ctx, uint8_t mode) |
LightRanger 8 set distance mode function. | |
uint8_t | lightranger8_get_range_status (lightranger8_t *ctx) |
LightRanger 8 get range status function. | |
uint8_t | lightranger8_get_roi_center (lightranger8_t *ctx) |
LightRanger 8 get roi center function. | |
void | lightranger8_set_roi_center (lightranger8_t *ctx, uint8_t roi_center) |
LightRanger 8 set roi center function. | |
void | lightranger8_set_roi (lightranger8_t *ctx, uint16_t x, uint16_t y) |
LightRanger 8 set roi function. | |
void | lightranger8_get_roi (lightranger8_t *ctx, uint16_t *roi_x, uint16_t *roi_y) |
LightRanger 8 get roi function. | |
void | lightranger8_set_offset (lightranger8_t *ctx, int16_t offset_value) |
LightRanger 8 set offset function. | |
void | lightranger8_calibrate_offset (lightranger8_t *ctx, uint16_t target_distance_mm, uint32_t period_ms, int16_t *offset) |
LightRanger 8 calibrate offset function. | |
err_t | lightranger8_set_measurement_timing_budget (lightranger8_t *ctx, uint32_t budget_us) |
LightRanger 8 set measurement timing budget function. | |
uint8_t | lightranger8_get_interrupt_state (lightranger8_t *ctx) |
LightRanger 8 get int pin state function. | |
void | lightranger8_set_xshut_pin (lightranger8_t *ctx, uint8_t state) |
LightRanger 8 set xshut pin function. | |
void | lightranger8_power_on (lightranger8_t *ctx) |
LightRanger 8 power on function. | |
uint32_t | lightranger8_get_timing_budget (lightranger8_t *ctx) |
LightRanger 8 get timing budget function. | |
uint16_t | lightranger8_get_measurement_period (lightranger8_t *ctx) |
LightRanger 8 get intermeasurement period function. | |
API for configuring and manipulating LightRanger 8 Click driver.
Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.
void lightranger8_calibrate_offset | ( | lightranger8_t * | ctx, |
uint16_t | target_distance_mm, | ||
uint32_t | period_ms, | ||
int16_t * | offset ) |
LightRanger 8 calibrate offset function.
This function calibrates the offset which affects the final corrected measurement from the VL53Lx ranging sensor. The averaging is concluded 50 times before the actual measurement sets in place. The target distance value is in milimeters. Period should be set at the same value as inteded measurement later on.
[in] | ctx | : Click context object. See lightranger8_t object definition for detailed explanation. |
[in] | target_distance_mm | : Target distance value in milimeters. |
[in] | period_ms | : Intermeasurement period in miliseconds. |
[out] | offset | : Calibrated offset value. |
void lightranger8_cfg_setup | ( | lightranger8_cfg_t * | cfg | ) |
LightRanger 8 configuration object setup function.
This function initializes click configuration structure to initial values.
[out] | cfg | : Click configuration structure. See lightranger8_cfg_t object definition for detailed explanation. |
err_t lightranger8_default_cfg | ( | lightranger8_t * | ctx | ) |
LightRanger 8 default configuration function.
This function executes a default configuration of LightRanger 8 click board.
[in] | ctx | : Click context object. See lightranger8_t object definition for detailed explanation. |
0x01
( LIGHTRANGER8_RESP_DEVICE_ERROR_ID_IS_NOT_VALID ) - ID error, 0x02
( LIGHTRANGER8_RESP_FIRMWARE_TIMEOUT_ERROR ) - Firmware timeout error, 0x00
( LIGHTRANGER8_RESP_INIT_IS_SUCCESSFUL ) - Success.err_t lightranger8_generic_read | ( | lightranger8_t * | ctx, |
uint16_t | reg, | ||
uint8_t * | rx_buf, | ||
uint8_t | rx_len ) |
LightRanger 8 I2C reading function.
This function reads a desired number of data bytes starting from the selected register by using I2C serial interface.
[in] | ctx | : Click context object. See lightranger8_t object definition for detailed explanation. |
[in] | reg | : Start register address. |
[out] | rx_buf | : Output read data. |
[in] | rx_len | : Number of bytes to be read. |
0
- Success, -1
- Error.err_t lightranger8_generic_write | ( | lightranger8_t * | ctx, |
uint16_t | reg, | ||
uint8_t * | tx_buf, | ||
uint8_t | tx_len ) |
LightRanger 8 I2C writing function.
This function writes a desired number of data bytes starting from the selected register by using I2C serial interface.
[in] | ctx | : Click context object. See lightranger8_t object definition for detailed explanation. |
[in] | reg | : Start register address. |
[in] | tx_buf | : Data to be written. |
[in] | tx_len | : Number of bytes to be written. |
0
- Success, -1
- Error.uint16_t lightranger8_get_distance | ( | lightranger8_t * | ctx | ) |
LightRanger 8 get distance function.
This function returns the corrected measured distance from the VL53Lx ranging sensor described in milimeters.
[in] | ctx | : Click context object. See lightranger8_t object definition for detailed explanation. |
uint8_t lightranger8_get_interrupt_state | ( | lightranger8_t * | ctx | ) |
LightRanger 8 get int pin state function.
This function checks the interrupt pin state.
[in] | ctx | : Click context object. See lightranger8_t object definition for detailed explanation. |
uint16_t lightranger8_get_measurement_period | ( | lightranger8_t * | ctx | ) |
LightRanger 8 get intermeasurement period function.
This function returns the intermeasurement period in miliseconds currently set in the VL53Lx ranging sensor.
[in] | ctx | : Click context object. See lightranger8_t object definition for detailed explanation. |
uint8_t lightranger8_get_range_status | ( | lightranger8_t * | ctx | ) |
LightRanger 8 get range status function.
This function returns the range result status of the VL53Lx ranging sensor.
[in] | ctx | : Click context object. See lightranger8_t object definition for detailed explanation. |
void lightranger8_get_roi | ( | lightranger8_t * | ctx, |
uint16_t * | roi_x, | ||
uint16_t * | roi_y ) |
LightRanger 8 get roi function.
This function forwards the roi x and y coords of the VL53Lx ranging sensor.
[in] | ctx | : Click context object. See lightranger8_t object definition for detailed explanation. |
[out] | roi_x | : X coord value. |
[out] | roi_y | : Y coord value. |
uint8_t lightranger8_get_roi_center | ( | lightranger8_t * | ctx | ) |
LightRanger 8 get roi center function.
This function returns the roi center value of the VL53Lx ranging sensor.
[in] | ctx | : Click context object. See lightranger8_t object definition for detailed explanation. |
uint16_t lightranger8_get_signal_rate | ( | lightranger8_t * | ctx | ) |
LightRanger 8 get signal rate function.
This function returns the corrected signal rate MCPS from the VL53Lx ranging sensor.
[in] | ctx | : Click context object. See lightranger8_t object definition for detailed explanation. |
uint32_t lightranger8_get_timing_budget | ( | lightranger8_t * | ctx | ) |
LightRanger 8 get timing budget function.
This function returns the timing budget in microseconds currently set in the VL53Lx ranging sensor.
[in] | ctx | : Click context object. See lightranger8_t object definition for detailed explanation. |
err_t lightranger8_init | ( | lightranger8_t * | ctx, |
lightranger8_cfg_t * | cfg ) |
LightRanger 8 initialization function.
This function initializes all necessary pins and peripherals used for this click board.
[out] | ctx | : Click context object. See lightranger8_t object definition for detailed explanation. |
[in] | cfg | : Click configuration structure. See lightranger8_cfg_t object definition for detailed explanation. |
0
- Success, -1
- Error.uint8_t lightranger8_new_data_ready | ( | lightranger8_t * | ctx | ) |
LightRanger 8 data ready function.
This function returns the information if new data is ready for acquiring the distance measured.
[in] | ctx | : Click context object. See lightranger8_t object definition for detailed explanation. |
0
- New data ready, 1
- Still measuring.void lightranger8_power_on | ( | lightranger8_t * | ctx | ) |
LightRanger 8 power on function.
This function powers on the VL53Lx ranging sensor.
[in] | ctx | : Click context object. See lightranger8_t object definition for detailed explanation. |
uint8_t lightranger8_set_distance_mode | ( | lightranger8_t * | ctx, |
uint8_t | mode ) |
LightRanger 8 set distance mode function.
This function sets the distance mode of the VL53Lx ranging sensor with three possible modes.
[in] | ctx | : Click context object. See lightranger8_t object definition for detailed explanation. |
[in] | mode | : Distance mode.
|
0x00
( LIGHTRANGER8_RESP_MODE_SUCCESSFULLY_SET )- Distance mode successfully set, 0x01
( LIGHTRANGER8_RESP_WRONG_MODE )- Wrong distance mode.err_t lightranger8_set_measurement_timing_budget | ( | lightranger8_t * | ctx, |
uint32_t | budget_us ) |
LightRanger 8 set measurement timing budget function.
This function sets the timing budget of the VL53Lx ranging sensor. This is the time allocated by the user to perform one range measurement.
[in] | ctx | : Click context object. See lightranger8_t object definition for detailed explanation. |
[in] | budget_us | : Timing budget in microseconds. |
0x02
( LIGHTRANGER8_RESP_INSUFFICIENT_BUDGET ) - Low budget error, 0x01
( LIGHTRANGER8_RESP_TOO_HIGH_BUDGET ) - High budget error, 0x00
( LIGHTRANGER8_RESP_BUDGET_IS_SUCCESSFULLY_SET ) - Success.void lightranger8_set_offset | ( | lightranger8_t * | ctx, |
int16_t | offset_value ) |
LightRanger 8 set offset function.
This function sets the offset of the final corrected measurement from the VL53Lx ranging sensor. The offset value is in milimeters.
[in] | ctx | : Click context object. See lightranger8_t object definition for detailed explanation. |
[in] | offset_value | : Offset value in milimeters. |
void lightranger8_set_roi | ( | lightranger8_t * | ctx, |
uint16_t | x, | ||
uint16_t | y ) |
LightRanger 8 set roi function.
This function sets the roi x and y coords of the VL53Lx ranging sensor.
[in] | ctx | : Click context object. See lightranger8_t object definition for detailed explanation. |
[in] | x | : Desired x coord value. |
[in] | y | : Desired y coord value. |
void lightranger8_set_roi_center | ( | lightranger8_t * | ctx, |
uint8_t | roi_center ) |
LightRanger 8 set roi center function.
This function sets the roi center value of the VL53Lx ranging sensor.
[in] | ctx | : Click context object. See lightranger8_t object definition for detailed explanation. |
[in] | roi_center | : Desired roi center value. |
void lightranger8_set_xshut_pin | ( | lightranger8_t * | ctx, |
uint8_t | state ) |
LightRanger 8 set xshut pin function.
This function sets the state of EN pin.
[in] | ctx | : Click context object. See lightranger8_t object definition for detailed explanation. |
[in] | state | :
|
void lightranger8_software_reset | ( | lightranger8_t * | ctx | ) |
LightRanger 8 software reset function.
This function performs a software reset of the VL53Lx ranging sensor.
[in] | ctx | : Click context object. See lightranger8_t object definition for detailed explanation. |
void lightranger8_start_measurement | ( | lightranger8_t * | ctx, |
uint32_t | period_ms ) |
LightRanger 8 start measurement function.
This function enables the range measuring with the adjusted intermeasurement period.
[in] | ctx | : Click context object. See lightranger8_t object definition for detailed explanation. |
[in] | period_ms | : Intermeasurement period in miliseconds. |
void lightranger8_start_ranging_cmd | ( | lightranger8_t * | ctx, |
uint8_t | ranging_mode ) |
LightRanger 8 start ranging function.
This function sends either ranging enable or ranging disable depending on the ranging mode parameter.
[in] | ctx | : Click context object. See lightranger8_t object definition for detailed explanation. |
[in] | ranging_mode | : Ranging mode setting option.
|
void lightranger8_stop_measurement | ( | lightranger8_t * | ctx | ) |
LightRanger 8 stop measurement function.
This function stops the measurement of the VL53Lx ranging sensor.
[in] | ctx | : Click context object. See lightranger8_t object definition for detailed explanation. |
void lightranger8_system_interrupt_clear | ( | lightranger8_t * | ctx | ) |
LightRanger 8 system interrupt clear function.
This function clears the system interrupt bit of the VL53Lx ranging sensor.
[in] | ctx | : Click context object. See lightranger8_t object definition for detailed explanation. |