Simple ranging example, using polling, with only the X-Nucleo_53L1A1 expansion board.

Dependencies:   X_NUCLEO_53L1A1

Files at this revision

API Documentation at this revision

Comitter:
johnAlexander
Date:
Mon Nov 02 17:20:42 2020 +0000
Parent:
4:3585824f6926
Child:
6:edbf45e8969f
Commit message:
Update to use ST board class, with mbed sensor class.

Changed in this revision

X_NUCLEO_53L1A1_mbed.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/X_NUCLEO_53L1A1_mbed.lib	Thu Oct 29 16:34:46 2020 +0000
+++ b/X_NUCLEO_53L1A1_mbed.lib	Mon Nov 02 17:20:42 2020 +0000
@@ -1,1 +1,1 @@
-https://os.mbed.com/teams/ST/code/X_NUCLEO_53L1A1_mbed/#74b34293d419
+https://os.mbed.com/teams/ST/code/X_NUCLEO_53L1A1_mbed/#b3aa04ca507c
--- a/main.cpp	Thu Oct 29 16:34:46 2020 +0000
+++ b/main.cpp	Mon Nov 02 17:20:42 2020 +0000
@@ -27,7 +27,7 @@
 
 #include "mbed.h"
 #include "XNucleo53L1A1.h"
-#include "vl53L1x_I2c.h"
+#include "VL53L1X_I2C.h"
 
 #define VL53L1_I2C_SDA   D14
 #define VL53L1_I2C_SCL   D15
@@ -51,7 +51,7 @@
 
     printf("Hello world!\r\n");
 
-    vl53L1X_DevI2C *dev_I2C = new vl53L1X_DevI2C(VL53L1_I2C_SDA, VL53L1_I2C_SCL);
+    VL53L1X_DevI2C *dev_I2C = new VL53L1X_DevI2C(VL53L1_I2C_SDA, VL53L1_I2C_SCL);
 
     printf("I2C device created!\r\n");
 
@@ -70,7 +70,7 @@
 
     /* Start ranging on the centre sensor */
     if (board->sensor_centre != NULL) {
-        status = board->sensor_centre->VL53L1X_StartRanging();
+        status = board->sensor_centre->vl53l1x_start_ranging();
         if (status != 0) {
             printf("Centre sensor failed to start ranging!\r\n");
             return status;
@@ -88,11 +88,11 @@
             break;
         }
         if (board->sensor_centre != NULL) {
-            board->sensor_centre->VL53L1X_CheckForDataReady(&ready_centre);
+            board->sensor_centre->vl53l1x_check_for_data_ready(&ready_centre);
         }
         if (ready_centre) {
-            board->sensor_centre->VL53L1X_GetRangeStatus(&ready_centre);
-            board->sensor_centre->VL53L1X_GetDistance(&distance_centre);
+            board->sensor_centre->vl53l1x_get_range_status(&ready_centre);
+            board->sensor_centre->vl53l1x_get_distance(&distance_centre);
         }
 
         if (board->sensor_centre != NULL) {