Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: digitalThermometer Counter SimpleClock printNumber ... more
Revision 10:b807470a8b09, committed 2011-06-29
- 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
*
*/
PCA9635 I2C IO Expander