-
Notifications
You must be signed in to change notification settings - Fork 35
/
TM16xxMatrixGFX.h
55 lines (42 loc) · 1.55 KB
/
TM16xxMatrixGFX.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/*
TM16xxMatrixGFX.h - Adafruit GFX LED Matrix class for TM16xx.
The TM16xxMatrixGFX class supports LED matrices of various sizes to be connected
to a TM16xx chip, such as TM1640 or TM1638.
These are the resolutions supported by the most popular TM16xx chips:
TM1637 8x6 (common anode)
TM1638 10x8 (common cathode)
TM1640 8x16 (common cathode)
TM1668 10x7 (common cathode)
The library supports modules with either 8x8 or 8x16 pixels
Made by Maxint R&D. See https://github.com/maxint-rd/
*/
#ifndef _TM16XX_MATRIXGFX_H
#define _TM16XX_MATRIXGFX_H
#include "TM16xx.h"
#define TM16XX_MATRIXGFX_MAXCOLUMNS 16
class TM16xxMatrixGFX : public Adafruit_GFX
{
public:
TM16xxMatrixGFX(TM16xx *pModule, byte nColumns, byte nRows);
TM16xxMatrixGFX(TM16xx *aModules[], byte nColumns, byte nRows, byte nModulesCol, byte nModulesRow); // module layout left-top to right-bottom
void setIntensity(byte intensity); // intensity 0-7, 0=off, 7=bright
void setMirror(bool fMirrorX=false, bool fMirrorY=false);
void fillScreen(uint16_t color);
void drawPixel(int16_t x, int16_t y, uint16_t color);
uint16_t getPixel(int16_t x, int16_t y); // required for scroll support as implemented by Adafruit GFX pull request #60
void write();
protected:
byte _nModules;
byte _nModulesCol;
byte _nModulesRow;
TM16xx **_aModules;
byte _nColumns;
byte _nRows;
bool _fMirrorX;
bool _fMirrorY;
byte *bitmap;
byte bitmapSize;
private:
bool convertToMemPos(int16_t &x, int16_t &y);
};
#endif