laser library

Files at this revision

API Documentation at this revision

Comitter:
mwilkens241
Date:
Fri Mar 31 15:49:47 2017 +0000
Parent:
1:af4be6eecff0
Commit message:
stole some things out of here, not much changed

Changed in this revision

vl6180x_class.h Show annotated file Show diff for this revision Revisions of this file
vl6180x_platform.h Show annotated file Show diff for this revision Revisions of this file
--- 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
--- a/vl6180x_platform.h	Wed Mar 22 20:55:05 2017 +0000
+++ b/vl6180x_platform.h	Fri Mar 31 15:49:47 2017 +0000
@@ -51,8 +51,7 @@
 #define trace_printf(...) (void)0
 #define LOG_GET_TIME() (int)0 /* add your code here expect to be an integer native (%d) type  value  */
 #endif
- 
- 
+
  
 #define LOG_FUNCTION_START(fmt, ... ) \
     trace_printf("beg %s start @%d\t" fmt "\n", __func__, LOG_GET_TIME(), ##__VA_ARGS__)
@@ -90,6 +89,7 @@
 struct MyVL6180Dev_t {
     struct VL6180xDevData_t Data;
     uint8_t I2cAddr;
+    uint8_t muxCh;
     //uint8_t DevID;
     
     //misc flags for application