-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSMDLEDShield.h
48 lines (38 loc) · 963 Bytes
/
SMDLEDShield.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
#ifndef SMDLEDSHIELD_H
#define SMDLEDSHIELD_H
#include <Arduino.h>
#include <WString.h>
#include <avr/pgmspace.h>
#include <avr/eeprom.h>
#include <inttypes.h>
#define SMDLatchPin 8
#define SMDDataPin 11
#define SMDClockPin 12
enum direction {left=-1, right=1};
class SMDLEDShield {
/* class members */
public:
private:
PROGMEM static const prog_int8_t columns[];
//Each character is actually a half-byte per row
PROGMEM static const prog_int8_t charset[26][8];
/* interface */
public:
SMDLEDShield(const int step);
SMDLEDShield(const int step, const char *_text);
void message(const char *_text, bool store=true);
void scroll(const direction d);
void draw();
private:
void renderWindow();
void shiftWindow(const direction d);
/* instance members */
public:
uint8_t buffer[8][128];
uint8_t window[8];
unsigned int left_bit;
unsigned int buffer_width;
unsigned int step;
char text[256];
};
#endif