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.
Dependencies: Adafruit-GFX
Diff: RGBmatrixPanel.h
- Revision:
- 0:06d9443a018f
- Child:
- 2:6136465ffd3a
diff -r 000000000000 -r 06d9443a018f RGBmatrixPanel.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/RGBmatrixPanel.h Fri May 23 15:08:14 2014 +0000
@@ -0,0 +1,46 @@
+#include "mbed.h"
+#include "Adafruit_GFX.h"
+
+class RGBmatrixPanel : public Adafruit_GFX
+{
+
+public:
+ // Constructor for 16x32 panel:
+ RGBmatrixPanel(uint8_t a, uint8_t b, uint8_t c, uint8_t sclk, uint8_t latch, uint8_t oe, bool dbuf);
+
+ // Constructor for 32x32 panel (adds 'd' pin):
+ RGBmatrixPanel(uint8_t a, uint8_t b, uint8_t c, uint8_t d, uint8_t sclk, uint8_t latch, uint8_t oe, bool dbuf);
+
+ void begin(void);
+ virtual void drawPixel(int16_t x, int16_t y, uint16_t c);
+ virtual void fillScreen(uint16_t c);
+ void updateDisplay(void);
+ void swapBuffers(bool);
+ void dumpMatrix(void);
+
+ uint8_t *backBuffer(void);
+
+ uint16_t Color333(uint8_t r, uint8_t g, uint8_t b);
+ uint16_t Color444(uint8_t r, uint8_t g, uint8_t b);
+ uint16_t Color888(uint8_t r, uint8_t g, uint8_t b);
+ uint16_t Color888(uint8_t r, uint8_t g, uint8_t b, bool gflag);
+ uint16_t ColorHSV(long hue, uint8_t sat, uint8_t val, bool gflag);
+
+private:
+ uint8_t *matrixbuff[2];
+ uint8_t nRows;
+ volatile uint8_t backindex;
+ volatile bool swapflag;
+
+ // Init/alloc code common to both constructors:
+ 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);
+
+ // PORT register pointers, pin bitmasks, pin numbers:
+ volatile uint8_t *latport, *oeport, *addraport, *addrbport, *addrcport, *addrdport;
+ uint8_t sclkpin, latpin, oepin, addrapin, addrbpin, addrcpin, addrdpin;
+ uint8_t _sclk, _latch, _oe, _a, _b, _c, _d;
+
+ // Counters/pointers for interrupt handler:
+ volatile uint8_t row, plane;
+ volatile uint8_t *buffptr;
+};
\ No newline at end of file