-
Notifications
You must be signed in to change notification settings - Fork 36
/
Copy pathTM16xxMatrix.h
41 lines (32 loc) · 1.03 KB
/
TM16xxMatrix.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
/*
TM16xxMatrix.h - LED Matrix class for TM16xx.
The TM16xxMatrix 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)
Made by Maxint R&D. See https://github.com/maxint-rd/
*/
#ifndef _TM16XX_MATRIX_H
#define _TM16XX_MATRIX_H
#include "TM16xx.h"
#define TM16XX_MATRIX_MAXCOLUMNS 16
class TM16xxMatrix
{
public:
TM16xxMatrix(TM16xx *pTM16xx, byte nColumns, byte nRows);
void setColumn(byte nCol, byte bPixels);
void setAll(bool fOn);
void setPixel(byte nCol, byte nRow, bool fOn);
bool getPixel(byte nCol, byte nRow);
inline byte getNumRows() { return(_nRows); }
inline byte getNumColumns() { return(_nColumns); }
protected:
TM16xx *_pTM16xx;
byte _nColumns;
byte _nRows;
byte _btColumns[TM16XX_MATRIX_MAXCOLUMNS]={0};
};
#endif