Adafruit-RGB_matrix_Panel(32*32)
Dependencies: Adafruit-GFX
Diff: RGBmatrixPanel.h
- Revision:
- 2:6136465ffd3a
- Parent:
- 0:06d9443a018f
- Child:
- 3:aa3762e0dfee
--- a/RGBmatrixPanel.h Sat May 24 08:38:23 2014 +0000 +++ b/RGBmatrixPanel.h Sat May 24 11:43:34 2014 +0000 @@ -1,15 +1,27 @@ #include "mbed.h" #include "Adafruit_GFX.h" +#ifndef _BV +#define _BV(bit) (1<<(bit)) +#endif + + +#ifdef DEBUG +#define log_debug(format, ...) std::printf(format, ## __VA_ARGS__) +#else +#define log_debug(...) +#endif + + 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); + RGBmatrixPanel(PinName a, PinName b, PinName c, PinName sclk, PinName latch, PinName 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); + RGBmatrixPanel(PinName a, PinName b, PinName c, PinName d, PinName sclk, PinName latch, PinName oe, bool dbuf); void begin(void); virtual void drawPixel(int16_t x, int16_t y, uint16_t c); @@ -33,12 +45,9 @@ 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); + void init(uint8_t rows, 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; + DigitalOut _sclk, _latch, _oe, _a, _b, _c, _d; // Counters/pointers for interrupt handler: volatile uint8_t row, plane;