Adafruit Led Matrix 64x32 Lib
Dependents: Adafruit-64x32-PWM-Demo
LedMatrix.h@0:cdc5e3a73147, 2017-10-11 (annotated)
- Committer:
- davidr99
- Date:
- Wed Oct 11 00:36:17 2017 +0000
- Revision:
- 0:cdc5e3a73147
- Child:
- 1:99abd7449a45
Changed over to use Adafruit GFX
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
davidr99 | 0:cdc5e3a73147 | 1 | #include "mbed.h" |
davidr99 | 0:cdc5e3a73147 | 2 | #include "Adafruit_GFX.h" |
davidr99 | 0:cdc5e3a73147 | 3 | #include "gamma.h" |
davidr99 | 0:cdc5e3a73147 | 4 | |
davidr99 | 0:cdc5e3a73147 | 5 | #ifndef _LED_MATRIX_H |
davidr99 | 0:cdc5e3a73147 | 6 | #define _LED_MATRIX_H |
davidr99 | 0:cdc5e3a73147 | 7 | |
davidr99 | 0:cdc5e3a73147 | 8 | #define LOW 0 |
davidr99 | 0:cdc5e3a73147 | 9 | #define HIGH 1 |
davidr99 | 0:cdc5e3a73147 | 10 | #define PLANES 4 |
davidr99 | 0:cdc5e3a73147 | 11 | #define WIDTH 64 |
davidr99 | 0:cdc5e3a73147 | 12 | #define HEIGHT 32 |
davidr99 | 0:cdc5e3a73147 | 13 | #define HEIGHT_DEV_2 (HEIGHT / 2) |
davidr99 | 0:cdc5e3a73147 | 14 | |
davidr99 | 0:cdc5e3a73147 | 15 | class LedMatrix : public Adafruit_GFX { |
davidr99 | 0:cdc5e3a73147 | 16 | |
davidr99 | 0:cdc5e3a73147 | 17 | private: |
davidr99 | 0:cdc5e3a73147 | 18 | void Pset(int16_t x, int16_t y, uint16_t c); |
davidr99 | 0:cdc5e3a73147 | 19 | void WrRow(unsigned char Row); |
davidr99 | 0:cdc5e3a73147 | 20 | |
davidr99 | 0:cdc5e3a73147 | 21 | unsigned char gm[WIDTH][HEIGHT_DEV_2][PLANES]; |
davidr99 | 0:cdc5e3a73147 | 22 | unsigned int plane; |
davidr99 | 0:cdc5e3a73147 | 23 | |
davidr99 | 0:cdc5e3a73147 | 24 | public: |
davidr99 | 0:cdc5e3a73147 | 25 | LedMatrix(); |
davidr99 | 0:cdc5e3a73147 | 26 | void Init(); |
davidr99 | 0:cdc5e3a73147 | 27 | uint16_t Color333(uint8_t r, uint8_t g, uint8_t b); |
davidr99 | 0:cdc5e3a73147 | 28 | uint16_t Color444(uint8_t r, uint8_t g, uint8_t b); |
davidr99 | 0:cdc5e3a73147 | 29 | uint16_t Color888(uint8_t r, uint8_t g, uint8_t b); |
davidr99 | 0:cdc5e3a73147 | 30 | uint16_t Color888(uint8_t r, uint8_t g, uint8_t b, bool gflag); |
davidr99 | 0:cdc5e3a73147 | 31 | uint16_t ColorHSV(long hue, uint8_t sat, uint8_t val, bool gflag); |
davidr99 | 0:cdc5e3a73147 | 32 | void drawPixel(int16_t x, int16_t y, uint16_t color); |
davidr99 | 0:cdc5e3a73147 | 33 | void Paint(); |
davidr99 | 0:cdc5e3a73147 | 34 | }; |
davidr99 | 0:cdc5e3a73147 | 35 | |
davidr99 | 0:cdc5e3a73147 | 36 | #endif |