-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMAX7219_Dot_Matrix.h
48 lines (40 loc) · 1.31 KB
/
MAX7219_Dot_Matrix.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
#include <Arduino.h>
class MAX7219_Dot_Matrix
{
// pins
const byte chips_;
const byte load_;
const byte din_;
const byte clock_;
// const bool bitBanged_;
// bitBangedSPI * bbSPI_;
void sendByte (const byte reg, const byte data);
void sendToAll (const byte reg, const byte data);
// registers
enum {
MAX7219_REG_NOOP = 0x0,
// codes 1 to 8 are digit positions 1 to 8
MAX7219_REG_DECODEMODE = 0x9,
MAX7219_REG_INTENSITY = 0xA,
MAX7219_REG_SCANLIMIT = 0xB,
MAX7219_REG_SHUTDOWN = 0xC,
MAX7219_REG_DISPLAYTEST = 0xF,
}; // end of enum
public:
// constructor
MAX7219_Dot_Matrix (const byte chips,
const byte load,
const byte din = 0,
const byte clock = 0)
: chips_ (chips), load_ (load), din_ (din), clock_ (clock){ }
~MAX7219_Dot_Matrix (); // destructor
void begin ();
void end ();
void writeReg (const byte reg, const byte data);
void sendChar (const byte pos, const byte data);
void send64pixels (const byte pos, const byte data [8]);
void sendString (const char * s);
void sendSmooth (const char * s, const int pixel);
void setIntensity (const byte amount); // 0 to 15
static const byte HYPHEN = 0b0000001;
}; // end of class MAX7219_Dot_Matrix