Adafruit-RGB_matrix_Panel(32*16)

Dependencies:   Adafruit-GFX

Committer:
lelect
Date:
Fri May 23 15:08:14 2014 +0000
Revision:
0:06d9443a018f
Child:
2:6136465ffd3a
Initial commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
lelect 0:06d9443a018f 1 #include "mbed.h"
lelect 0:06d9443a018f 2 #include "Adafruit_GFX.h"
lelect 0:06d9443a018f 3
lelect 0:06d9443a018f 4 class RGBmatrixPanel : public Adafruit_GFX
lelect 0:06d9443a018f 5 {
lelect 0:06d9443a018f 6
lelect 0:06d9443a018f 7 public:
lelect 0:06d9443a018f 8 // Constructor for 16x32 panel:
lelect 0:06d9443a018f 9 RGBmatrixPanel(uint8_t a, uint8_t b, uint8_t c, uint8_t sclk, uint8_t latch, uint8_t oe, bool dbuf);
lelect 0:06d9443a018f 10
lelect 0:06d9443a018f 11 // Constructor for 32x32 panel (adds 'd' pin):
lelect 0:06d9443a018f 12 RGBmatrixPanel(uint8_t a, uint8_t b, uint8_t c, uint8_t d, uint8_t sclk, uint8_t latch, uint8_t oe, bool dbuf);
lelect 0:06d9443a018f 13
lelect 0:06d9443a018f 14 void begin(void);
lelect 0:06d9443a018f 15 virtual void drawPixel(int16_t x, int16_t y, uint16_t c);
lelect 0:06d9443a018f 16 virtual void fillScreen(uint16_t c);
lelect 0:06d9443a018f 17 void updateDisplay(void);
lelect 0:06d9443a018f 18 void swapBuffers(bool);
lelect 0:06d9443a018f 19 void dumpMatrix(void);
lelect 0:06d9443a018f 20
lelect 0:06d9443a018f 21 uint8_t *backBuffer(void);
lelect 0:06d9443a018f 22
lelect 0:06d9443a018f 23 uint16_t Color333(uint8_t r, uint8_t g, uint8_t b);
lelect 0:06d9443a018f 24 uint16_t Color444(uint8_t r, uint8_t g, uint8_t b);
lelect 0:06d9443a018f 25 uint16_t Color888(uint8_t r, uint8_t g, uint8_t b);
lelect 0:06d9443a018f 26 uint16_t Color888(uint8_t r, uint8_t g, uint8_t b, bool gflag);
lelect 0:06d9443a018f 27 uint16_t ColorHSV(long hue, uint8_t sat, uint8_t val, bool gflag);
lelect 0:06d9443a018f 28
lelect 0:06d9443a018f 29 private:
lelect 0:06d9443a018f 30 uint8_t *matrixbuff[2];
lelect 0:06d9443a018f 31 uint8_t nRows;
lelect 0:06d9443a018f 32 volatile uint8_t backindex;
lelect 0:06d9443a018f 33 volatile bool swapflag;
lelect 0:06d9443a018f 34
lelect 0:06d9443a018f 35 // Init/alloc code common to both constructors:
lelect 0:06d9443a018f 36 void init(uint8_t rows, uint8_t a, uint8_t b, uint8_t c, uint8_t sclk, uint8_t latch, uint8_t oe, bool dbuf);
lelect 0:06d9443a018f 37
lelect 0:06d9443a018f 38 // PORT register pointers, pin bitmasks, pin numbers:
lelect 0:06d9443a018f 39 volatile uint8_t *latport, *oeport, *addraport, *addrbport, *addrcport, *addrdport;
lelect 0:06d9443a018f 40 uint8_t sclkpin, latpin, oepin, addrapin, addrbpin, addrcpin, addrdpin;
lelect 0:06d9443a018f 41 uint8_t _sclk, _latch, _oe, _a, _b, _c, _d;
lelect 0:06d9443a018f 42
lelect 0:06d9443a018f 43 // Counters/pointers for interrupt handler:
lelect 0:06d9443a018f 44 volatile uint8_t row, plane;
lelect 0:06d9443a018f 45 volatile uint8_t *buffptr;
lelect 0:06d9443a018f 46 };