Makes the VL53L0X library compatible with MAX32630FTHR definitions. Adjusts default sensor settings to fastest reading (20ms) vs. default (30ms).
Dependencies: ST_INTERFACES X_NUCLEO_COMMON
Fork of VL53L0X by
Revision 1:834986cdde0a, committed 2017-10-04
- Comitter:
- nikapov
- Date:
- Wed Oct 04 13:21:38 2017 +0000
- Parent:
- 0:a1a69d32f310
- Child:
- 2:d07edeaff6f1
- Commit message:
- First release.
Changed in this revision
| VL53L0X.cpp | Show annotated file Show diff for this revision Revisions of this file |
| VL53L0X.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/VL53L0X.cpp Fri Sep 29 15:38:50 2017 +0000
+++ b/VL53L0X.cpp Wed Oct 04 13:21:38 2017 +0000
@@ -5236,7 +5236,7 @@
return status;
}
- if (new_addr != DEFAULT_DEVICE_ADDRESS) {
+ if (new_addr != VL53L0X_DEFAULT_ADDRESS) {
status = set_device_address(new_addr);
if (status) {
printf("Failed to change I2C address!\n\r");
@@ -5406,12 +5406,12 @@
if (operating_mode == range_continuous_polling) {
if (Status == VL53L0X_ERROR_NONE) {
- printf("Call of VL53L0X_SetDeviceMode\n");
+ //printf("Call of VL53L0X_SetDeviceMode\n");
Status = VL53L0X_set_device_mode(_device, VL53L0X_DEVICEMODE_CONTINUOUS_RANGING); // Setup in continuous ranging mode
}
if (Status == VL53L0X_ERROR_NONE) {
- printf("Call of VL53L0X_StartMeasurement\n");
+ //printf("Call of VL53L0X_StartMeasurement\n");
Status = VL53L0X_start_measurement(_device);
}
}
@@ -5462,12 +5462,12 @@
if (operating_mode == range_continuous_interrupt || operating_mode == range_continuous_polling) {
// continuous mode
if (status == VL53L0X_ERROR_NONE) {
- printf("Call of VL53L0X_StopMeasurement\n");
+ //printf("Call of VL53L0X_StopMeasurement\n");
status = VL53L0X_stop_measurement(_device);
}
if (status == VL53L0X_ERROR_NONE) {
- printf("Wait Stop to be competed\n");
+ //printf("Wait Stop to be competed\n");
status = wait_stop_completed(_device);
}
--- a/VL53L0X.h Fri Sep 29 15:38:50 2017 +0000
+++ b/VL53L0X.h Wed Oct 04 13:21:38 2017 +0000
@@ -284,7 +284,7 @@
} OperatingMode;
/** default device address */
-#define DEFAULT_DEVICE_ADDRESS 0x52 /* (8-bit) */
+#define VL53L0X_DEFAULT_ADDRESS 0x52 /* (8-bit) */
/* Classes -------------------------------------------------------------------*/
/** Class representing a VL53L0 sensor component
@@ -297,7 +297,7 @@
* @param[in] &pin_gpio1 pin Mbed InterruptIn PinName to be used as component GPIO_1 INT
* @param[in] dev_addr device address, 0x29 by default
*/
- VL53L0X(DevI2C *i2c, DigitalOut *pin, PinName pin_gpio1, uint8_t dev_addr = DEFAULT_DEVICE_ADDRESS) : _dev_i2c(i2c),
+ VL53L0X(DevI2C *i2c, DigitalOut *pin, PinName pin_gpio1, uint8_t dev_addr = VL53L0X_DEFAULT_ADDRESS) : _dev_i2c(i2c),
_gpio0(pin)
{
_my_device.I2cDevAddr = dev_addr;
@@ -319,7 +319,7 @@
* @param[in] device address, 0x29 by default
*/
VL53L0X(DevI2C *i2c, Stmpe1600DigiOut *pin, PinName pin_gpio1,
- uint8_t dev_addr = DEFAULT_DEVICE_ADDRESS) : _dev_i2c(i2c), _expgpio0(pin)
+ uint8_t dev_addr = VL53L0X_DEFAULT_ADDRESS) : _dev_i2c(i2c), _expgpio0(pin)
{
_my_device.I2cDevAddr = dev_addr;
_my_device.comms_type = 1; // VL53L0X_COMMS_I2C
@@ -377,6 +377,7 @@
}
wait_ms(10);
}
+
/**
* @brief Initialize the sensor with default values
@@ -499,18 +500,18 @@
uint8_t phase_cal;
if (status == VL53L0X_ERROR_NONE) {
- printf("Call of VL53L0X_StaticInit\r\n");
+ //printf("Call of VL53L0X_StaticInit\r\n");
status = VL53L0X_static_init(_device); // Device Initialization
}
if (status == VL53L0X_ERROR_NONE) {
- printf("Call of VL53L0X_PerformRefCalibration\r\n");
+ //printf("Call of VL53L0X_PerformRefCalibration\r\n");
status = VL53L0X_perform_ref_calibration(_device,
&vhv_settings, &phase_cal); // Device Initialization
}
if (status == VL53L0X_ERROR_NONE) {
- printf("Call of VL53L0X_PerformRefSpadManagement\r\n");
+ //printf("Call of VL53L0X_PerformRefSpadManagement\r\n");
status = VL53L0X_perform_ref_spad_management(_device,
&ref_spad_count, &is_aperture_spads); // Device Initialization
// printf ("refSpadCount = %d, isApertureSpads = %d\r\n", refSpadCount, isApertureSpads);
@@ -531,7 +532,7 @@
status = VL53L0X_set_device_mode(_device, VL53L0X_DEVICEMODE_CONTINUOUS_RANGING);
if (status == VL53L0X_ERROR_NONE) {
- printf ("Call of VL53L0X_StartMeasurement\r\n");
+ //printf ("Call of VL53L0X_StartMeasurement\r\n");
status = VL53L0X_start_measurement(_device);
}
@@ -1940,8 +1941,8 @@
VL53L0X_Error VL53L0X_check_part_used(VL53L0X_DEV dev,
uint8_t *revision,
VL53L0X_DeviceInfo_t *p_VL53L0X_device_info);
-
- /* Read function of the ID device */
+
+ /* Read function of the ID device */
// virtual int read_id();
virtual int read_id(uint8_t *id);
