Paparazzi UAS  v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
vl53l5cx_platform.h File Reference
#include <stdint.h>
#include <string.h>
#include "mcu_periph/i2c.h"
+ Include dependency graph for vl53l5cx_platform.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  VL53L5CX_Platform
 Structure VL53L5CX_Platform needs to be filled by the customer, depending on his platform. More...
 

Macros

#define VL53L5CX_I2C_BUF_SIZE   512
 
#define VL53L5CX_NB_TARGET_PER_ZONE   1U
 

Enumerations

enum  VL53L5CX_ERRORS {
  VL53L5CX_NO_ERROR = 0 , VL53L5CX_NOT_DETECTED = 1 , VL53L5CX_ULD_LOADING_FAILED = 2 , VL53L5CX_SET_RESOLUTION_FAILED = 3 ,
  VL53L5CX_RUNTIME_FAILURE = 4
}
 

Functions

uint8_t RdByte (VL53L5CX_Platform *p_platform, uint16_t RegisterAdress, uint8_t *p_value)
 
uint8_t WrByte (VL53L5CX_Platform *p_platform, uint16_t RegisterAdress, uint8_t value)
 Mandatory function used to write one single byte. More...
 
uint8_t RdMulti (VL53L5CX_Platform *p_platform, uint16_t RegisterAdress, uint8_t *p_values, uint32_t size)
 Mandatory function used to read multiples bytes. More...
 
uint8_t WrMulti (VL53L5CX_Platform *p_platform, uint16_t RegisterAdress, uint8_t *p_values, uint32_t size)
 Mandatory function used to write multiples bytes. More...
 
void SwapBuffer (uint8_t *buffer, uint16_t size)
 Optional function, only used to perform an hardware reset of the sensor. More...
 
uint8_t WaitMs (VL53L5CX_Platform *p_platform, uint32_t TimeMs)
 Mandatory function, used to wait during an amount of time. More...
 

Data Structure Documentation

◆ VL53L5CX_Platform

struct VL53L5CX_Platform

Structure VL53L5CX_Platform needs to be filled by the customer, depending on his platform.

At least, it contains the VL53L5CX I2C address. Some additional fields can be added, as descriptors, or platform dependencies. Anything added into this structure is visible into the platform layer.

Definition at line 40 of file vl53l5cx_platform.h.

+ Collaboration diagram for VL53L5CX_Platform:
Data Fields
uint16_t address
uint8_t buf[VL53L5CX_I2C_BUF_SIZE+2]
bool data_available
int16_t distances_mm[64]
enum VL53L5CX_ERRORS error_code
struct i2c_periph * i2cdev
void * user_data

Macro Definition Documentation

◆ VL53L5CX_I2C_BUF_SIZE

#define VL53L5CX_I2C_BUF_SIZE   512

Definition at line 21 of file vl53l5cx_platform.h.

◆ VL53L5CX_NB_TARGET_PER_ZONE

#define VL53L5CX_NB_TARGET_PER_ZONE   1U

Definition at line 64 of file vl53l5cx_platform.h.

Enumeration Type Documentation

◆ VL53L5CX_ERRORS

Enumerator
VL53L5CX_NO_ERROR 
VL53L5CX_NOT_DETECTED 
VL53L5CX_ULD_LOADING_FAILED 
VL53L5CX_SET_RESOLUTION_FAILED 
VL53L5CX_RUNTIME_FAILURE 

Definition at line 24 of file vl53l5cx_platform.h.

Function Documentation

◆ RdByte()

uint8_t RdByte ( VL53L5CX_Platform p_platform,
uint16_t  RegisterAdress,
uint8_t p_value 
)
Parameters
(VL53L5CX_Platform*)p_platform : Pointer of VL53L5CX platform structure.
(uint16_t)Address : I2C location of value to read.
(uint8_t)*p_values : Pointer of value to read.
Returns
(uint8_t) status : 0 if OK

Definition at line 20 of file vl53l5cx_platform.c.

References dev, and RdMulti().

Referenced by _vl53l5cx_poll_for_mcu_boot(), vl53l5cx_get_power_mode(), vl53l5cx_init(), vl53l5cx_is_alive(), and vl53l5cx_stop_ranging().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ RdMulti()

uint8_t RdMulti ( VL53L5CX_Platform p_platform,
uint16_t  RegisterAdress,
uint8_t p_values,
uint32_t  size 
)

Mandatory function used to read multiples bytes.

Parameters
(VL53L5CX_Platform*)p_platform : Pointer of VL53L5CX platform structure.
(uint16_t)Address : I2C location of values to read.
(uint8_t)*p_values : Buffer of bytes to read.
(uint32_t)size : Size of *p_values buffer.
Returns
(uint8_t) status : 0 if OK

Definition at line 64 of file vl53l5cx_platform.c.

References dev, Min, offset, VL53L5_I2C_TIMEOUT, and VL53L5CX_I2C_BUF_SIZE.

Referenced by _vl53l5cx_poll_for_answer(), RdByte(), vl53l5cx_check_data_ready(), vl53l5cx_dci_read_data(), vl53l5cx_get_ranging_data(), vl53l5cx_init(), and vl53l5cx_stop_ranging().

+ Here is the caller graph for this function:

◆ SwapBuffer()

void SwapBuffer ( uint8_t buffer,
uint16_t  size 
)

Optional function, only used to perform an hardware reset of the sensor.

This function is not used in the API, but it can be used by the host. This function is not mandatory to fill if user don't want to reset the sensor.

Parameters
(VL53L5CX_Platform*)p_platform : Pointer of VL53L5CX platform structure.
Returns
(uint8_t) status : 0 if OK

Mandatory function, used to swap a buffer. The buffer size is always a multiple of 4 (4, 8, 12, 16, ...).

Parameters
(uint8_t*)buffer : Buffer to swap, generally uint32_t
(uint16_t)size : Buffer size to swap

Definition at line 92 of file vl53l5cx_platform.c.

Referenced by _vl53l5cx_send_offset_data(), _vl53l5cx_send_xtalk_data(), vl53l5cx_dci_read_data(), vl53l5cx_dci_write_data(), and vl53l5cx_get_ranging_data().

+ Here is the caller graph for this function:

◆ WaitMs()

uint8_t WaitMs ( VL53L5CX_Platform p_platform,
uint32_t  TimeMs 
)

Mandatory function, used to wait during an amount of time.

It must be filled as it's used into the API.

Parameters
(VL53L5CX_Platform*)p_platform : Pointer of VL53L5CX platform structure.
(uint32_t)TimeMs : Time to wait in ms.
Returns
(uint8_t) status : 0 if wait is finished.

Definition at line 111 of file vl53l5cx_platform.c.

Referenced by _vl53l5cx_poll_for_answer(), _vl53l5cx_poll_for_mcu_boot(), vl53l5cx_init(), and vl53l5cx_stop_ranging().

+ Here is the caller graph for this function:

◆ WrByte()

uint8_t WrByte ( VL53L5CX_Platform p_platform,
uint16_t  RegisterAdress,
uint8_t  value 
)

Mandatory function used to write one single byte.

Parameters
(VL53L5CX_Platform*)p_platform : Pointer of VL53L5CX platform structure.
(uint16_t)Address : I2C location of value to read.
(uint8_t)value : Pointer of value to write.
Returns
(uint8_t) status : 0 if OK

Definition at line 28 of file vl53l5cx_platform.c.

References dev, and WrMulti().

Referenced by vl53l5cx_get_power_mode(), vl53l5cx_init(), vl53l5cx_is_alive(), vl53l5cx_set_i2c_address(), vl53l5cx_set_power_mode(), vl53l5cx_start_ranging(), and vl53l5cx_stop_ranging().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ WrMulti()

uint8_t WrMulti ( VL53L5CX_Platform p_platform,
uint16_t  RegisterAdress,
uint8_t p_values,
uint32_t  size 
)

Mandatory function used to write multiples bytes.

Parameters
(VL53L5CX_Platform*)p_platform : Pointer of VL53L5CX platform structure.
(uint16_t)Address : I2C location of values to write.
(uint8_t)*p_values : Buffer of bytes to write.
(uint32_t)size : Size of *p_values buffer.
Returns
(uint8_t) status : 0 if OK

Definition at line 36 of file vl53l5cx_platform.c.

References dev, Min, offset, VL53L5_I2C_TIMEOUT, and VL53L5CX_I2C_BUF_SIZE.

Referenced by _vl53l5cx_send_offset_data(), _vl53l5cx_send_xtalk_data(), vl53l5cx_dci_read_data(), vl53l5cx_dci_write_data(), vl53l5cx_init(), vl53l5cx_start_ranging(), and WrByte().

+ Here is the caller graph for this function: