Fork of X-NUCLEO-53L0A1 Library and deleted the board related files. Just use a VL53L0X chip as a ToF sensor.

Dependents:   Check_VL53L0X_simple_with_three_ToF Check_VL53L0X_simple_ToF_Sensor lidarproj Check_VL53L0X_simple_with_three_ToF ... more

Fork of VL53L0X by ST

Please refer below page.
/users/kenjiArai/notebook/vl53l0x-tof-sensor/

Files at this revision

API Documentation at this revision

Comitter:
kenjiArai
Date:
Wed Feb 26 09:34:31 2020 +0000
Parent:
9:b9907dc1e9f9
Commit message:
bug fix for XSHUT=NC

Changed in this revision

VL53L0X.h Show annotated file Show diff for this revision Revisions of this file
--- a/VL53L0X.h	Mon Feb 24 11:21:39 2020 +0000
+++ b/VL53L0X.h	Wed Feb 26 09:34:31 2020 +0000
@@ -30,7 +30,7 @@
 #define __VL53L0X_CLASS_H
 
 //------- Feburary 6th, 2018 by JH1PJL / K.Arai --------------------------------
-//------- Updated on Feburary 24th, 2020 ---------------------------------------
+//------- Updated on Feburary 26th, 2020 ---------------------------------------
 //ORIGINAL=1 does NOT mean anything but just keep original source code as it is!
 //You can NOT compile with ORIGINAL=1 !!
 #define		ORIGINAL		0	// Just keep = 0
@@ -167,11 +167,7 @@
     VL53L0X(I2C& i2c, PinName xshut, PinName pin_gpio1) : _i2c(i2c),
         _gpio0(xshut)
     {
-        if (pin_gpio1 != NC) {
-            _gpio1Int = new InterruptIn(pin_gpio1);
-        } else {
-            _gpio1Int = NULL;
-        }
+        _gpio1Int = NULL;
 		preparation();
     }
 
@@ -242,9 +238,11 @@
         }
         wait_ms(10);
 #else
-		_gpio0.output();
-		_gpio0 = 1;
-		_gpio0.input();
+		if (_gpio0.is_connected()){
+			_gpio0.output();
+			_gpio0 = 1;
+			_gpio0.input();
+		}
         WAIT_MS(1);
 #endif
     }
@@ -266,8 +264,10 @@
         }
         wait_ms(10);
 #else
-		_gpio0 = 0;
-		_gpio0.output();
+		if (_gpio0.is_connected()){
+			_gpio0 = 0;
+			_gpio0.output();
+		}
         WAIT_MS(10);
 #endif
     }
@@ -412,4 +412,4 @@
     VL53L0X_DEV _device;
 };
 
-#endif /* _VL53L0X_CLASS_H_ */
+#endif /* _VL53L0X_CLASS_H_ */
\ No newline at end of file