PCA9635 16-bit I2C-bus LED driver

Dependents:   digitalThermometer Counter SimpleClock printNumber ... more

Files at this revision

API Documentation at this revision

Comitter:
d_worrall
Date:
Wed Jun 29 13:42:04 2011 +0000
Parent:
9:48985b738e5a
Child:
11:50d396bf0207
Commit message:
version9

Changed in this revision

PCA9635.cpp Show annotated file Show diff for this revision Revisions of this file
PCA9635.h Show annotated file Show diff for this revision Revisions of this file
--- a/PCA9635.cpp	Wed Jun 29 13:39:28 2011 +0000
+++ b/PCA9635.cpp	Wed Jun 29 13:42:04 2011 +0000
@@ -117,6 +117,27 @@
         m_i2c.write(m_addr, cmd, 2);
     }
 }
+//Brightness control for single or all LEDs
+void PCA9635::brightness(char led, char value, int address)
+{
+    setAddress(address);
+    
+    if(led == ALL)
+    {
+        for(char allLeds=0x02; allLeds<0x12; allLeds++)
+        {
+            cmd[0] = allLeds;           
+            cmd[1] = value; 
+            m_i2c.write(m_addr, cmd, 2);
+        }
+    }
+    else
+    {
+        cmd[0] = led + 2;           
+        cmd[1] = value; 
+        m_i2c.write(m_addr, cmd, 2);
+    }
+}
 
 
 
--- a/PCA9635.h	Wed Jun 29 13:39:28 2011 +0000
+++ b/PCA9635.h	Wed Jun 29 13:42:04 2011 +0000
@@ -94,6 +94,13 @@
         * @param value Brightness of LED, 0x00 < value < 0xFF
         */
         void brightness(char led, char value);
+        /** Define LED brightness
+        *
+        * @param led LED pin coordinates
+        * @param value Brightness of LED, 0x00 < value < 0xFF
+        * @param address Display address
+        */
+        void brightness(char led, char value, int address);
         /** Reset chip 
         *
         */