JM9 XRCU Board 0.1.2
Libraries API Reference
Loading...
Searching...
No Matches
Vl53l0x Class Reference

VL53L0X LiDAR Driver for XRCU. More...

#include <Vl53l0x.h>

Inheritance diagram for Vl53l0x:
Uts_togglable Uts_general Supported_sensor Supported_module

Public Member Functions

 Vl53l0x (const uint32_t init_port)
 Creates a Vl53l0x object.
 
 ~Vl53l0x ()
 Destroys this object and releases the occupied resources.
 
void re_address_device (const uint8_t new_i2c_address)
 Changes the I2C address of this VL53L0X sensor.
 
bool begin ()
 Activates this VL53L0X sensor.
 
bool begin (const uint8_t new_i2c_address)
 Activates this VL53L0X sensor with another I2C address.
 
void disable ()
 Teporarily disables this VL53L0X sensor.
 
void enable ()
 Re-enables this VL53L0X sensor.
 
uint16_t read_dist_mm ()
 Reads the distance between this VL53L0X sensor and the obstacle in front of it.
 
- Public Member Functions inherited from Uts_togglable
virtual void end ()
 Deactivates this ultrasonic sensor.
 
- Public Member Functions inherited from Uts_general
uint16_t read_dist_cm ()
 Reads the distance between this ultrasonic sensor and the obstacle in front of it.
 

Additional Inherited Members

- Protected Member Functions inherited from Uts_togglable
void set_beginned (bool is_beginned)
 Sets whether this ultrasonic sensor is activated.
 
void set_enabled (bool is_enabled)
 Sets whether this ultrasonic sensor is enabled or not.
 
bool is_enabled ()
 Checks if this ultrasonic sensor is enabled or not.
 
 Uts_togglable ()
 Constructor for a togglable ultrasonic sensor driver.
 
- Protected Member Functions inherited from Uts_general
bool is_beginned ()
 Checks if this ultrasonic sensor is already activated.
 
void store_prev_dist_mm (uint16_t dist_mm)
 Stores the previous measured distance.
 
uint16_t get_prev_dist_mm ()
 Gets the previous measured distance.
 
 Uts_general ()
 Constructor for a generic ultrasonic sensor driver.
 
- Protected Member Functions inherited from Supported_sensor
 Supported_sensor ()
 Creates an object of a supported sensor.
 
- Protected Member Functions inherited from Supported_module
 Supported_module ()
 Creates an object of a supported module.
 
- Static Protected Attributes inherited from Uts_general
static const uint16_t ERROR_DIST_MM = 8888
 The distance representing a measurement error (in millimeters).
 

Detailed Description

VL53L0X LiDAR Driver for XRCU.

Author
YH Choi @ JM9
Note
The maximu possible distance measured in normal range is 120cm, given that sensor and obstacle is stable.
Therefore, this library uses long range mode to ensure soccer robot can see the goal walls when at the center of field.
Soccer field internal length == 243cm == 121.5cm * 2

Constructor & Destructor Documentation

◆ Vl53l0x()

Vl53l0x::Vl53l0x ( const uint32_t init_port)

Creates a Vl53l0x object.

Parameters
init_portthe I2C port connected to the VL53L0X sensor

Member Function Documentation

◆ begin() [1/2]

bool Vl53l0x::begin ( )
virtual

Activates this VL53L0X sensor.

YOU MUST CALL ME IN void setup () FUNCTION TO USE THIS OBJECT PROPERLY.
Configures the settings of the pin modes, I2C bus and this sensor.

Returns
true if activation is successful, false if activation failed
See also
begin(uint8_t)

Reimplemented from Uts_togglable.

◆ begin() [2/2]

bool Vl53l0x::begin ( const uint8_t new_i2c_address)

Activates this VL53L0X sensor with another I2C address.

The sensor alawys start with I2C_address == 0x29, since the modified I2C address is not preserved after power off the sensor.
For sharing multiple VL53L0X sensors on the same bus, you may call this function when the selected VL53L0X sensor is enabled by its XSHUT pin.
This function would first perform re-addressing, then activates and configures the selected sensor.

YOU MUST CALL ME IN void setup () FUNCTION TO USE THIS OBJECT PROPERLY.
Configures the settings of the pin modes, I2C bus and this sensor.

Parameters
new_i2c_addressthe new I2C address of this VL53L0X sensor
Returns
true if activation is successful, false if activation failed
See also
re_address_device(uint8_t)
begin()

◆ disable()

void Vl53l0x::disable ( )
virtual

Teporarily disables this VL53L0X sensor.

See also
enable()

Reimplemented from Uts_togglable.

◆ enable()

void Vl53l0x::enable ( )
virtual

Re-enables this VL53L0X sensor.

See also
disable()

Reimplemented from Uts_togglable.

◆ re_address_device()

void Vl53l0x::re_address_device ( const uint8_t new_i2c_address)

Changes the I2C address of this VL53L0X sensor.

Parameters
new_i2c_addressthe new I2C address to be given to this VL53L0X sensor

◆ read_dist_mm()

uint16_t Vl53l0x::read_dist_mm ( )
virtual

Reads the distance between this VL53L0X sensor and the obstacle in front of it.

Returns
the distance between this VL53L0X sensor and the obstacle in front of it (in millimeters)
See also
read_dist_cm()

Reimplemented from Uts_general.


The documentation for this class was generated from the following files: