-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathledmatrix88.h
111 lines (102 loc) · 2.91 KB
/
ledmatrix88.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
/*
ledmatrix88 lib 0x01
copyright (c) Davide Gironi, 2013
Released under GPLv3.
Please refer to LICENSE file for licensing information.
*/
#ifndef LEDMATRIX88_H_
#define LEDMATRIX88_H_
//define led matrix columns and rows
#define LEDMATRIX88_COLS 8
#define LEDMATRIX88_ROWS 8
//setup led matrix columns port
#if LEDMATRIX88_COLS >= 1
#define LEDMATRIX88_COL1_DDR DDRC
#define LEDMATRIX88_COL1_PORT PORTC
#define LEDMATRIX88_COL1_PINOUT PC0
#endif
#if LEDMATRIX88_COLS >= 2
#define LEDMATRIX88_COL2_DDR DDRC
#define LEDMATRIX88_COL2_PORT PORTC
#define LEDMATRIX88_COL2_PINOUT PC1
#endif
#if LEDMATRIX88_COLS >= 3
#define LEDMATRIX88_COL3_DDR DDRC
#define LEDMATRIX88_COL3_PORT PORTC
#define LEDMATRIX88_COL3_PINOUT PC2
#endif
#if LEDMATRIX88_COLS >= 4
#define LEDMATRIX88_COL4_DDR DDRC
#define LEDMATRIX88_COL4_PORT PORTC
#define LEDMATRIX88_COL4_PINOUT PC3
#endif
#if LEDMATRIX88_COLS >= 5
#define LEDMATRIX88_COL5_DDR DDRC
#define LEDMATRIX88_COL5_PORT PORTC
#define LEDMATRIX88_COL5_PINOUT PC4
#endif
#if LEDMATRIX88_COLS >= 6
#define LEDMATRIX88_COL6_DDR DDRD
#define LEDMATRIX88_COL6_PORT PORTD
#define LEDMATRIX88_COL6_PINOUT PC5
#endif
#if LEDMATRIX88_COLS >= 7
#define LEDMATRIX88_COL7_DDR DDRB
#define LEDMATRIX88_COL7_PORT PORTB
#define LEDMATRIX88_COL7_PINOUT PB1
#endif
#if LEDMATRIX88_COLS >= 8
#define LEDMATRIX88_COL8_DDR DDRB
#define LEDMATRIX88_COL8_PORT PORTB
#define LEDMATRIX88_COL8_PINOUT PB2
#endif
//setup led matrix rows port
#if LEDMATRIX88_ROWS >= 1
#define LEDMATRIX88_ROW1_DDR DDRD
#define LEDMATRIX88_ROW1_PORT PORTD
#define LEDMATRIX88_ROW1_PINOUT PD0
#endif
#if LEDMATRIX88_ROWS >= 2
#define LEDMATRIX88_ROW2_DDR DDRD
#define LEDMATRIX88_ROW2_PORT PORTD
#define LEDMATRIX88_ROW2_PINOUT PD2
#endif
#if LEDMATRIX88_ROWS >= 3
#define LEDMATRIX88_ROW3_DDR DDRD
#define LEDMATRIX88_ROW3_PORT PORTD
#define LEDMATRIX88_ROW3_PINOUT PD3
#endif
#if LEDMATRIX88_ROWS >= 4
#define LEDMATRIX88_ROW4_DDR DDRD
#define LEDMATRIX88_ROW4_PORT PORTD
#define LEDMATRIX88_ROW4_PINOUT PD4
#endif
#if LEDMATRIX88_ROWS >= 5
#define LEDMATRIX88_ROW5_DDR DDRD
#define LEDMATRIX88_ROW5_PORT PORTD
#define LEDMATRIX88_ROW5_PINOUT PD5
#endif
#if LEDMATRIX88_ROWS >= 6
#define LEDMATRIX88_ROW6_DDR DDRD
#define LEDMATRIX88_ROW6_PORT PORTD
#define LEDMATRIX88_ROW6_PINOUT PD6
#endif
#if LEDMATRIX88_ROWS >= 7
#define LEDMATRIX88_ROW7_DDR DDRD
#define LEDMATRIX88_ROW7_PORT PORTD
#define LEDMATRIX88_ROW7_PINOUT PD7
#endif
#if LEDMATRIX88_ROWS >= 8
#define LEDMATRIX88_ROW8_DDR DDRB
#define LEDMATRIX88_ROW8_PORT PORTB
#define LEDMATRIX88_ROW8_PINOUT PB0
#endif
//functions
extern void ledmatrix88_init(void);
extern uint8_t ledmatrix88_getcol(void);
extern uint8_t ledmatrix88_getrow(void);
extern void ledmatrix88_setcol(uint8_t col);
extern void ledmatrix88_setrow(uint8_t row);
extern void ledmatrix88_zero(void);
extern void ledmatrix88_print(void);
#endif