16-channel I2C constant current LED sink driver

Fork of TLC59116 by Sille Van Landschoot

Files at this revision

API Documentation at this revision

Comitter:
pilotak
Date:
Tue Aug 22 10:56:36 2017 +0000
Parent:
1:c285b2c57b2e
Commit message:
fix the mbed::NonCopyable thing

Changed in this revision

TLC59116.cpp Show annotated file Show diff for this revision Revisions of this file
TLC59116.h Show annotated file Show diff for this revision Revisions of this file
diff -r c285b2c57b2e -r daabe2fe9b1d TLC59116.cpp
--- a/TLC59116.cpp	Sat Dec 19 10:41:07 2015 +0000
+++ b/TLC59116.cpp	Tue Aug 22 10:56:36 2017 +0000
@@ -1,11 +1,19 @@
 #include "TLC59116.h"
 
-TLC59116::TLC59116(I2C &_i2c, int _address): i2c(_i2c), address(_address)
+TLC59116::TLC59116(I2C &i2c_obj, int _address)
+    :
+    i2c_p(NULL), 
+    i2c(i2c_obj),
+    address(_address)
 {
     initialize();
 }
 
-TLC59116::TLC59116(PinName sda, PinName scl, int _address): i2c(sda, scl), address(_address)
+TLC59116::TLC59116(PinName sda, PinName scl, int _address)
+    :
+    i2c_p(new I2C(sda, scl)), 
+    i2c(*i2c_p),
+    address(_address)
 {
     initialize();
 }
diff -r c285b2c57b2e -r daabe2fe9b1d TLC59116.h
--- a/TLC59116.h	Sat Dec 19 10:41:07 2015 +0000
+++ b/TLC59116.h	Tue Aug 22 10:56:36 2017 +0000
@@ -3,9 +3,9 @@
 #include "mbed.h"
 
 class TLC59116{
-    public:
+public:
     
-    TLC59116(I2C &i2c, int address);
+    TLC59116(I2C &i2c_obj, int address);
     TLC59116(PinName sda, PinName scl, int address);
     
     void setBrightness(float brightness);
@@ -15,13 +15,15 @@
     
     protected:
     int address;
-    I2C i2c;
+
     
     void initialize();
     
     void setOutputState(int ledout0, int ledout1, int ledout2, int ledout3);
     
-    private:
+private:
+    I2C *i2c_p;
+    I2C &i2c;
     void setRegister(int reg, int value);
     void setRegisters(int reg, char* value, int length, int mode = AUTO_INCREMENT_ALL_REGISTERS);