initial release

Dependencies:   VL53L1X_mbed

Files at this revision

API Documentation at this revision

Comitter:
johnAlexander
Date:
Wed Jul 24 10:38:21 2019 +0000
Parent:
26:24a73ef7469f
Child:
28:0e99f593daa9
Commit message:
Updated for mbed coding style guidelines.

Changed in this revision

Components/VL53L1X.lib Show annotated file Show diff for this revision Revisions of this file
XNucleo53L1A1.cpp Show annotated file Show diff for this revision Revisions of this file
XNucleo53L1A1.h Show annotated file Show diff for this revision Revisions of this file
--- a/Components/VL53L1X.lib	Fri May 17 09:47:11 2019 +0000
+++ b/Components/VL53L1X.lib	Wed Jul 24 10:38:21 2019 +0000
@@ -1,1 +1,1 @@
-https://os.mbed.com/teams/ST-Expansion-SW-Team/code/VL53L1X_mbed/#aa13392d16bb
+https://os.mbed.com/teams/ST-Expansion-SW-Team/code/VL53L1X_mbed/#6d3ab15363a2
--- a/XNucleo53L1A1.cpp	Fri May 17 09:47:11 2019 +0000
+++ b/XNucleo53L1A1.cpp	Wed Jul 24 10:38:21 2019 +0000
@@ -3,7 +3,7 @@
 XNucleo53L1A1 *XNucleo53L1A1::_instance = NULL;
 
 
-XNucleo53L1A1 *XNucleo53L1A1::instance(vl53L1X_DevI2C *ext_i2c)
+XNucleo53L1A1 *XNucleo53L1A1::instance(VL53L1X_DevI2C *ext_i2c)
 {
     if (_instance == NULL) {
         _instance = new XNucleo53L1A1(ext_i2c);
@@ -13,7 +13,7 @@
     return _instance;
 }
 
-XNucleo53L1A1 *XNucleo53L1A1::instance(vl53L1X_DevI2C *ext_i2c,
+XNucleo53L1A1 *XNucleo53L1A1::instance(VL53L1X_DevI2C *ext_i2c,
                                        PinName gpio1_centre,
                                        PinName gpio1_left, PinName gpio1_right)
 {
@@ -30,10 +30,10 @@
 {
     int status, n_dev = 0;
 
-    sensor_centre->VL53L1_Off();
-    sensor_left->VL53L1_Off();
-    sensor_right->VL53L1_Off();
-    status = sensor_centre->InitSensor(NEW_SENSOR_CENTRE_ADDRESS);
+    sensor_centre->vl53l1_off();
+    sensor_left->vl53l1_off();
+    sensor_right->vl53l1_off();
+    status = sensor_centre->initialise_sensor(NEW_SENSOR_CENTRE_ADDRESS);
     if (status) {
         delete sensor_centre;
         delete xshutdown_centre;
@@ -45,7 +45,7 @@
         n_dev++;
     }
 
-    status = sensor_left->InitSensor(NEW_SENSOR_LEFT_ADDRESS);
+    status = sensor_left->initialise_sensor(NEW_SENSOR_LEFT_ADDRESS);
     if (status) {
         delete sensor_left;
         delete xshutdown_left;
@@ -57,7 +57,7 @@
         n_dev++;
     }
 
-    status = sensor_right->InitSensor(NEW_SENSOR_RIGHT_ADDRESS);
+    status = sensor_right->initialise_sensor(NEW_SENSOR_RIGHT_ADDRESS);
     if (status) {
         delete sensor_right;
         delete xshutdown_right;
@@ -75,3 +75,4 @@
         return 0;
     }
 }
+
--- a/XNucleo53L1A1.h	Fri May 17 09:47:11 2019 +0000
+++ b/XNucleo53L1A1.h	Wed Jul 24 10:38:21 2019 +0000
@@ -40,10 +40,10 @@
 
 
 /* Includes ------------------------------------------------------------------*/
-#include "vl53l1x_class.h"
+#include "VL53L1X_Class.h"
 #include "Stmpe1600.h"
 //#include "DevI2C.h"
-#include "vl53L1x_I2c.h"
+#include "VL53L1X_I2C.h"
 
 
 /** New device addresses */
@@ -64,22 +64,22 @@
     /** Constructor 1
     * @param[in] &i2c device I2C to be used for communication
     */
-    XNucleo53L1A1(vl53L1X_DevI2C *ext_i2c) : dev_i2c(ext_i2c)
+    XNucleo53L1A1(VL53L1X_DevI2C *ext_i2c) : dev_i2c(ext_i2c)
     {
-        stmpe1600_exp0 = new Stmpe1600((DevI2C*)ext_i2c, (0x43 * 2));     // U21
+        stmpe1600_exp0 = new Stmpe1600((DevI2C *)ext_i2c, (0x43 * 2));    // U21
 
-        stmpe1600_exp1 = new Stmpe1600((DevI2C*)ext_i2c, (0x42 * 2));     // U19
+        stmpe1600_exp1 = new Stmpe1600((DevI2C *)ext_i2c, (0x42 * 2));    // U19
 
-        xshutdown_centre = new Stmpe1600DigiOut((DevI2C*)dev_i2c, GPIO_15, (0x42 * 2));     // U19 on schematic
+        xshutdown_centre = new Stmpe1600DigiOut((DevI2C *)dev_i2c, GPIO_15, (0x42 * 2));    // U19 on schematic
         sensor_centre = new VL53L1X(dev_i2c, xshutdown_centre, A2);
 
-        xshutdown_left = new Stmpe1600DigiOut((DevI2C*)dev_i2c, GPIO_14, (0x43 * 2));     // U21 on schematic
+        xshutdown_left = new Stmpe1600DigiOut((DevI2C *)dev_i2c, GPIO_14, (0x43 * 2));    // U21 on schematic
         sensor_left = new VL53L1X(dev_i2c, xshutdown_left, D8);
 
-        xshutdown_right = new Stmpe1600DigiOut((DevI2C*)dev_i2c, GPIO_15, (0x43 * 2));     // U21 on schematic
+        xshutdown_right = new Stmpe1600DigiOut((DevI2C *)dev_i2c, GPIO_15, (0x43 * 2));    // U21 on schematic
         sensor_right = new VL53L1X(dev_i2c, xshutdown_right, D2);
-    }  
-    
+    }
+
     /** Constructor 2
      * @param[in] &i2c device I2C to be used for communication
      * @param[in] PinName gpio1_top Mbed DigitalOut pin name to be used as a top sensor GPIO_1 INT
@@ -87,24 +87,24 @@
      * @param[in] PinName gpio1_left Mbed DigitalOut pin name to be used as a left sensor GPIO_1 INT
      * @param[in] PinName gpio1_right Mbed DigitalOut pin name to be used as a right sensor GPIO_1 INT
      */
-    XNucleo53L1A1(vl53L1X_DevI2C *ext_i2c, PinName gpio1_centre,
+    XNucleo53L1A1(VL53L1X_DevI2C *ext_i2c, PinName gpio1_centre,
                   PinName gpio1_left, PinName gpio1_right) : dev_i2c(ext_i2c)
     {
-        stmpe1600_exp0 = new Stmpe1600((DevI2C*)ext_i2c, (0x43 * 2));     // U21
+        stmpe1600_exp0 = new Stmpe1600((DevI2C *)ext_i2c, (0x43 * 2));    // U21
 
-        stmpe1600_exp1 = new Stmpe1600((DevI2C*)ext_i2c, (0x42 * 2));     // U19
+        stmpe1600_exp1 = new Stmpe1600((DevI2C *)ext_i2c, (0x42 * 2));    // U19
 
-        xshutdown_centre = new Stmpe1600DigiOut((DevI2C*)dev_i2c, GPIO_15, (0x42 * 2));     // U19 on schematic
+        xshutdown_centre = new Stmpe1600DigiOut((DevI2C *)dev_i2c, GPIO_15, (0x42 * 2));    // U19 on schematic
         sensor_centre = new VL53L1X(dev_i2c, xshutdown_centre, gpio1_centre);
 
-        xshutdown_left = new Stmpe1600DigiOut((DevI2C*)dev_i2c, GPIO_14, (0x43 * 2));     // U21 on schematic
+        xshutdown_left = new Stmpe1600DigiOut((DevI2C *)dev_i2c, GPIO_14, (0x43 * 2));    // U21 on schematic
         sensor_left = new VL53L1X(dev_i2c, xshutdown_left, gpio1_left);
 
-        xshutdown_right = new Stmpe1600DigiOut((DevI2C*)dev_i2c, GPIO_15, (0x43 * 2));     // U21 on schematic
+        xshutdown_right = new Stmpe1600DigiOut((DevI2C *)dev_i2c, GPIO_15, (0x43 * 2));    // U21 on schematic
         sensor_right = new VL53L1X(dev_i2c, xshutdown_right, gpio1_right);
-    }    
-    
-    
+    }
+
+
     /** Destructor
      */
     ~XNucleo53L1A1()
@@ -147,7 +147,7 @@
      * @param[in]   &i2c device I2C to be used for communication
      * @return      Pointer to the object instance
      */
-    static XNucleo53L1A1 *instance(vl53L1X_DevI2C *ext_i2c);
+    static XNucleo53L1A1 *instance(VL53L1X_DevI2C *ext_i2c);
 
     /**
      * @brief       Creates a singleton object instance
@@ -157,7 +157,7 @@
      * @param[in]   PinName gpio1_right the pin connected to right sensor INT
      * @return      Pointer to the object instance
      */
-    static XNucleo53L1A1 *instance(vl53L1X_DevI2C *ext_i2c, PinName gpio1_centre,
+    static XNucleo53L1A1 *instance(VL53L1X_DevI2C *ext_i2c, PinName gpio1_centre,
                                    PinName gpio1_left, PinName gpio1_right);
 
     /**
@@ -165,8 +165,8 @@
      * @return      0 on success
      */
     int init_board();
-    
-    vl53L1X_DevI2C *dev_i2c;
+
+    VL53L1X_DevI2C *dev_i2c;
     VL53L1X *sensor_centre;
     VL53L1X *sensor_left;
     VL53L1X *sensor_right;
@@ -175,7 +175,7 @@
     Stmpe1600DigiOut *xshutdown_centre;
     Stmpe1600DigiOut *xshutdown_left;
     Stmpe1600DigiOut *xshutdown_right;
-    
+
 private:
     static XNucleo53L1A1 *_instance;
 };