Adafruit Led Matrix 64x32 Lib
Dependents: Adafruit-64x32-PWM-Demo
LedMatrix.h@1:99abd7449a45, 2017-10-24 (annotated)
- Committer:
- davidr99
- Date:
- Tue Oct 24 02:59:55 2017 +0000
- Revision:
- 1:99abd7449a45
- Parent:
- 0:cdc5e3a73147
Added FastIO for NUCLEO-F767ZI
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 | 1:99abd7449a45 | 10 | #define PLANES 5 |
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 WrRow(unsigned char Row); |
davidr99 | 0:cdc5e3a73147 | 19 | |
davidr99 | 1:99abd7449a45 | 20 | unsigned char gm[2][PLANES][HEIGHT_DEV_2][WIDTH]; |
davidr99 | 0:cdc5e3a73147 | 21 | unsigned int plane; |
davidr99 | 1:99abd7449a45 | 22 | unsigned int currRow; |
davidr99 | 1:99abd7449a45 | 23 | unsigned int tickCount; |
davidr99 | 1:99abd7449a45 | 24 | char shownBuffer; |
davidr99 | 1:99abd7449a45 | 25 | char drawBuffer; |
davidr99 | 1:99abd7449a45 | 26 | bool refreshed; |
davidr99 | 0:cdc5e3a73147 | 27 | |
davidr99 | 0:cdc5e3a73147 | 28 | public: |
davidr99 | 0:cdc5e3a73147 | 29 | LedMatrix(); |
davidr99 | 1:99abd7449a45 | 30 | void SetDoubleBuffer(bool setDoubleBuffer); |
davidr99 | 0:cdc5e3a73147 | 31 | void Init(); |
davidr99 | 1:99abd7449a45 | 32 | void Swap(bool copyBuffer = false); |
davidr99 | 1:99abd7449a45 | 33 | void CopyBuffer(char oldBuffer, char newBuffer); |
davidr99 | 0:cdc5e3a73147 | 34 | uint16_t Color333(uint8_t r, uint8_t g, uint8_t b); |
davidr99 | 0:cdc5e3a73147 | 35 | uint16_t Color444(uint8_t r, uint8_t g, uint8_t b); |
davidr99 | 0:cdc5e3a73147 | 36 | uint16_t Color888(uint8_t r, uint8_t g, uint8_t b); |
davidr99 | 0:cdc5e3a73147 | 37 | uint16_t Color888(uint8_t r, uint8_t g, uint8_t b, bool gflag); |
davidr99 | 1:99abd7449a45 | 38 | uint16_t ColorHSV(long hue, uint8_t sat, uint8_t val, bool gflag); |
davidr99 | 1:99abd7449a45 | 39 | void drawPixel(int16_t x, int16_t y, uint16_t c); |
davidr99 | 0:cdc5e3a73147 | 40 | void Paint(); |
davidr99 | 0:cdc5e3a73147 | 41 | }; |
davidr99 | 0:cdc5e3a73147 | 42 | |
davidr99 | 0:cdc5e3a73147 | 43 | #endif |