Modified driver for the Adafruit bicolor 8x8 Led Matrix, it now supports colours.

Fork of Adafruit_LEDBackpack by Luiz Hespanha

Files at this revision

API Documentation at this revision

Comitter:
GuitarCraftMiner
Date:
Tue Mar 01 19:55:49 2016 +0000
Parent:
1:f066d5347c60
Commit message:
Added code to make the library display colours with Adafruit 8x8 Bicolor Led Matrix

Changed in this revision

Adafruit_LEDBackpack.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/Adafruit_LEDBackpack.cpp	Fri Aug 16 15:44:44 2013 +0000
+++ b/Adafruit_LEDBackpack.cpp	Tue Mar 01 19:55:49 2016 +0000
@@ -106,9 +106,21 @@
   x %= 8;
 
 
-  if (color) {
+  if (color == LED_GREEN) {
+    // Turn on green LED.
     displaybuffer[y] |= 1 << x;
-  } else {
+    // Turn off red LED.
+    displaybuffer[y] &= ~(1 << (x+8));
+  } else if (color == LED_RED) {
+    // Turn on red LED.
+    displaybuffer[y] |= 1 << (x+8);
+    // Turn off green LED.
     displaybuffer[y] &= ~(1 << x);
+  } else if (color == LED_YELLOW) {
+    // Turn on green and red LED.
+    displaybuffer[y] |= (1 << (x+8)) | (1 << x);
+  } else if (color == LED_OFF) {
+    // Turn off green and red LED.
+    displaybuffer[y] &= ~(1 << x) & ~(1 << (x+8));
   }
 }
\ No newline at end of file