X_Nucleo_53L1A1 Expansion Board Class for VL53L1X Sensor.

Dependencies:   VL53L1X_mbed

Dependents:   HelloWorld_53L1A1_Interrupts 53L1A1_Satellites_MbedOS 53L1A1_Interrupts_MbedOS 53L1A1_Polling_All_MbedOS ... more

X-NUCLEO-53L1A1 Proximity Sensor Expansion Board Firmware Package

Introduction

This firmware package includes Component Device Drivers and the Board Support Package for STMicroelectronics' X-NUCLEO-53L1A1 Proximity sensor expansion board based on VL53L1X.

Firmware Library

Class XNucleo53L1A1 is intended to represent the Proximity sensor expansion board with the same name.

The expansion board provides support for the following components:

  1. on-board VL53L1X proximity sensor,
  2. up to two additional VL53L1X Satellites.

It is intentionally implemented as a singleton because only one X-NUCLEO-VL53L1A1 may be deployed at a time in a HW component stack. In order to get the singleton instance you have to call class method `Instance()`, e.g.:

// Sensors expansion board singleton instance
static XNucleo53L1A1 *board = XNucleo53L1A1::instance(device_i2c, A2, D9, D2);

Example Applications

Revision:
27:afcf740eb7b8
Parent:
24:77b414df8b6e
--- 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;
 };