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.
Fork of Adafruit_LEDBackpack by
Revision 2:caaae61819a4, committed 2015-03-24
- Comitter:
 - sknn
 - Date:
 - Tue Mar 24 17:35:22 2015 +0000
 - Parent:
 - 1:f066d5347c60
 - Commit message:
 - Now this library works with the Adafruit 16x8 LED Matrix backpacks, too.
 
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	Tue Mar 24 17:35:22 2015 +0000
@@ -78,6 +78,36 @@
   }
 }
 
+Adafruit_8x16matrix::Adafruit_8x16matrix(I2C *i2c) : Adafruit_LEDBackpack(i2c), Adafruit_GFX(8, 16) {
+}
+
+void Adafruit_8x16matrix::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 2:
+    swap(x, y);
+    x = 16 - x - 1;
+    break;
+  case 3:
+    x = 16 - x - 1;
+    y = 8 - y - 1;
+    break;
+  case 0:
+    swap(x, y);
+    y = 8 - y - 1;
+    break;
+  }
+
+  if (color) {
+    displaybuffer[y] |= 1 << x;
+  } else {
+    displaybuffer[y] &= ~(1 << x);
+  }
+}
+
 Adafruit_8x8matrix::Adafruit_8x8matrix(I2C *i2c) : Adafruit_LEDBackpack(i2c), Adafruit_GFX(8, 8) {
 }
 
--- a/Adafruit_LEDBackpack.h	Fri Aug 16 15:44:44 2013 +0000
+++ b/Adafruit_LEDBackpack.h	Tue Mar 24 17:35:22 2015 +0000
@@ -64,11 +64,20 @@
   uint8_t i2c_addr;
 };
 
+class Adafruit_8x16matrix : public Adafruit_LEDBackpack, public Adafruit_GFX {
+ public:
+  Adafruit_8x16matrix(I2C *i2c);
+
+  virtual void drawPixel(int16_t x, int16_t y, uint16_t color);
+
+ private:
+};
+
 class Adafruit_8x8matrix : public Adafruit_LEDBackpack, public Adafruit_GFX {
  public:
   Adafruit_8x8matrix(I2C *i2c);
 
-  void drawPixel(int16_t x, int16_t y, uint16_t color);
+  virtual void drawPixel(int16_t x, int16_t y, uint16_t color);
 
  private:
 };
\ No newline at end of file
    