ds

Dependencies:   ST_INTERFACES X_NUCLEO_COMMON

Fork of VL53L0X by ST

Files at this revision

API Documentation at this revision

Comitter:
PeaceBearer
Date:
Wed Apr 11 14:36:06 2018 +0000
Parent:
4:d25c4fa216af
Child:
6:7bb5d564af90
Commit message:
a

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
main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/VL53L0X.cpp	Mon Dec 18 08:27:21 2017 +0000
+++ b/VL53L0X.cpp	Wed Apr 11 14:36:06 2018 +0000
@@ -37,6 +37,7 @@
 
 /* Includes */
 #include <stdlib.h>
+#include <iostream>
 
 #include "VL53L0X.h"
 
@@ -73,12 +74,27 @@
 #define REF_ARRAY_SPAD_5  5
 #define REF_ARRAY_SPAD_10 10
 
+using namespace std;
+
 uint32_t refArrayQuadrants[4] = {REF_ARRAY_SPAD_10, REF_ARRAY_SPAD_5,
                                  REF_ARRAY_SPAD_0, REF_ARRAY_SPAD_5
                                 };
 
-
-
+void VL53L0X::laser_portee() {   
+   
+    uint32_t distance;
+    int status;
+    
+    status = get_distance(&distance);
+    if (status == VL53L0X_ERROR_NONE) 
+        _distance = distance;
+    else 
+        cout << ("Portee (mm): Erreur\r") << endl;           
+}
+
+void VL53L0X::laser_afficher() const{   
+    cout << "Portee (mm):" << _distance << endl;
+}
 
 VL53L0X_Error VL53L0X::VL53L0X_device_read_strobe(VL53L0X_DEV dev)
 {
--- a/VL53L0X.h	Mon Dec 18 08:27:21 2017 +0000
+++ b/VL53L0X.h	Wed Apr 11 14:36:06 2018 +0000
@@ -289,15 +289,22 @@
 /* Classes -------------------------------------------------------------------*/
 /** Class representing a VL53L0 sensor component
  */
-class VL53L0X : public RangeSensor
-{
+class VL53L0X : public RangeSensor {
+	
 public:
-    /** Constructor
+void laser_portee();
+void laser_afficher () const;
+
+   /** Constructor
      * @param[in] &i2c device I2C to be used for communication
      * @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 = VL53L0X_DEFAULT_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;
@@ -1838,6 +1845,8 @@
      * @return  VL53L0X_ERROR_NOT_IMPLEMENTED Not implemented
      *
      */
+    int _distance;
+    
     VL53L0X_Error VL53L0X_wait_device_booted(VL53L0X_DEV dev);