This is a library for the Adafruit LED Backpacks. This library works with the Adafruit Mini 8x8 and 16x8.

Dependents:   Adafruit_LEDBackpack_16x8_App Adafruit_32x8matrix

Fork of Adafruit_LEDBackpack by Luiz Hespanha

Files at this revision

API Documentation at this revision

Comitter:
maclobdell
Date:
Thu Dec 15 17:31:22 2016 +0000
Parent:
1:f066d5347c60
Child:
3:b0ac557b5f0c
Commit message:
add support for 16x8 display (dual 8x8 LED backpack)

Changed in this revision

Adafruit_LEDBackpack.cpp Show annotated file Show diff for this revision Revisions of this file
Adafruit_LEDBackpack.h 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	Thu Dec 15 17:31:22 2016 +0000
@@ -111,4 +111,40 @@
   } else {
     displaybuffer[y] &= ~(1 << x);
   }
+}
+
+
+Adafruit_16x8matrix::Adafruit_16x8matrix(I2C *i2c) : Adafruit_LEDBackpack(i2c), Adafruit_GFX(16, 8) {
+}
+
+void Adafruit_16x8matrix::drawPixel(int16_t x, int16_t y, uint16_t color) {
+  if ((y < 0) || (y >= 8)) return;
+  if ((x < 0) || (x >= 16)) return;
+
+ // check rotation, move pixel around if necessary
+  switch (getRotation()) {
+  case 1:
+    swap(x, y);
+    x = 16 - x - 1;
+    break;
+  case 2:
+    x = 16 - x - 1;
+    y = 8 - y - 1;
+    break;
+  case 3:
+    swap(x, y);
+    y = 8 - y - 1;
+    break;
+  }
+
+  // wrap around the x
+  x += 15;
+  x %= 16;
+
+
+  if (color) {
+    displaybuffer[y] |= 1 << x;
+  } else {
+    displaybuffer[y] &= ~(1 << x);
+  }
 }
\ No newline at end of file
--- a/Adafruit_LEDBackpack.h	Fri Aug 16 15:44:44 2013 +0000
+++ b/Adafruit_LEDBackpack.h	Thu Dec 15 17:31:22 2016 +0000
@@ -71,4 +71,13 @@
   void drawPixel(int16_t x, int16_t y, uint16_t color);
 
  private:
+};
+
+class Adafruit_16x8matrix : public Adafruit_LEDBackpack, public Adafruit_GFX {
+ public:
+  Adafruit_16x8matrix(I2C *i2c);
+
+  void drawPixel(int16_t x, int16_t y, uint16_t color);
+
+ private:
 };
\ No newline at end of file