This is a library for the Adafruit LED Backpacks. This library works with the Adafruit Mini 8x8 and the Adafruit 16x8 LED Matrix backpacks.
Fork of Adafruit_LEDBackpack by
Diff: Adafruit_LEDBackpack.cpp
- Revision:
- 2:caaae61819a4
- Parent:
- 1:f066d5347c60
--- 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) { }