Line Health / VL6180
Revision:
2:40f590e28101
Parent:
1:af4be6eecff0
--- a/vl6180x_class.h	Wed Mar 22 20:55:05 2017 +0000
+++ b/vl6180x_class.h	Fri Mar 31 15:49:47 2017 +0000
@@ -46,7 +46,11 @@
 #include "vl6180x_types.h"
 #include "vl6180x_platform.h"
 
- 
+#ifndef VL6180x_MUX
+#define VL6180x_MUX
+#include "TCA9548.h"
+#endif
+
 /* data struct containing range measure, light measure and type of error provided to the user
    in case of invalid data range_mm=0xFFFFFFFF and lux=0xFFFFFFFF */    
 typedef struct MeasureData 
@@ -106,7 +110,8 @@
        MyDevice.I2cAddr=DevAddr;         
        MyDevice.Present=0;
        MyDevice.Ready=0;
-       Device=&MyDevice;;
+       MyDevice.muxCh = muxChannel;
+       Device=&MyDevice;
        if (pin_gpio1 != NC) { gpio1Int = new InterruptIn(pin_gpio1); }
         else { gpio1Int = NULL; }
     }  
@@ -121,6 +126,7 @@
        MyDevice.I2cAddr=DevAddr;         
        MyDevice.Present=0;
        MyDevice.Ready=0;
+       MyDevice.muxCh = muxChannel;
        Device=&MyDevice;
        gpio0=NULL;      
        if (pin_gpio1 != NC) { gpio1Int = new InterruptIn(pin_gpio1); }
@@ -236,6 +242,15 @@
     {
        return Device->Present;
     }
+    
+    /**
+     * @brief       Returns the channel associated with the object
+     * @return      Returns the mux channel for a TCA9548 mux
+     */
+    uint8_t getmuxCh()
+    {
+        return Device->muxCh;
+    }
         
     /** Wrapper functions */    
 /** @defgroup api_init Init functions