-
Notifications
You must be signed in to change notification settings - Fork 0
/
led.h
160 lines (127 loc) · 4.29 KB
/
led.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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
/*
* The software for the x0xb0x is available for use in accordance with the
* following open source license (MIT License). For more information about
* OS licensing, please visit -> http://www.opensource.org/
*
* For more information about the x0xb0x project, please visit
* -> http://www.ladyada.net/make/x0xb0x
*
* *****
* Copyright (c) 2005 Limor Fried
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
* *****
*
*/
#define LED_LATCH_PORT PORTA
#define LED_LATCH_PIN 7
#define MAX_LED 40
// Byte 0
#define LED_DONE 0
#define LED_ACCENT 1
#define LED_SLIDE 2
#define LED_UP 3
#define LED_DOWN 4
#define LED_BANK14 5
#define LED_BANK15 6
#define LED_BANK16 7
// Byte 1
#define LED_REST 8
#define LED_C2 9
#define LED_B 10
#define LED_A 11
#define LED_G 12
#define LED_AS 13
#define LED_GS 14
#define LED_FS 15
// Byte 2
#define LED_BANK6 16
#define LED_BANK8 17
#define LED_BANK7 18
#define LED_BANK9 19
#define LED_BANK10 20
#define LED_BANK11 21
#define LED_BANK12 22
#define LED_BANK13 23
// Byte 3
#define LED_F 24
#define LED_D 25
#define LED_E 26
#define LED_CS 27
#define LED_DS 28
#define LED_BANK3 29
#define LED_BANK4 30
#define LED_BANK5 31
// Byte 4
#define LED_C 32
#define LED_RS 33
#define LED_CHAIN 34
#define LED_PREV 35
#define LED_NEXT 36
#define LED_TEMPO 37
#define LED_BANK1 38
#define LED_BANK2 39
#define BITBYTE(a) (1<<(a&7)) //no you don't want to know.. nasty bit banging for saving very few code bytes
void clear_led(uint8_t ledno);
void set_led(uint8_t ledno);
void set_led_blink(uint8_t ledno);
void clear_led_blink(uint8_t ledno);
void set_led_dim(uint8_t ledno);
void clear_led_dim(uint8_t ledno);
//void set_led_dark(uint8_t ledno);
//void clear_led_dark(uint8_t ledno);
//void show_quarter_note_leds(uint8_t triplets);
int is_led_set(uint8_t ledno);
uint8_t is_led_blink(uint8_t num);
void set_bank_led(uint8_t num);
void set_bank_led_blink(uint8_t num);
void set_bank_leds(uint8_t num);
void set_2bank_leds(uint8_t num, uint8_t dim);
#define clear_bank_leds() set_bank_leds(255);
uint8_t is_bank_led_blink(uint8_t num);
uint8_t is_bank_led_set(uint8_t num);
void set_key_led(uint8_t num);
void set_keypressed_led(uint8_t key);
void set_key_led_blink(uint8_t num);
void clear_key_leds(void);
void clear_key_led(uint8_t num);
void set_numkey_led(uint8_t num);
void set_single_numkey_led(uint8_t num);
void set_numkey_led_blink(uint8_t num);
void clear_numkey_led(uint8_t num);
uint8_t is_numkey_led_blink(uint8_t num);
uint8_t is_numkey_led_set(uint8_t num);
void set_notekey_led(uint8_t note);
void set_notekey_leds(uint8_t note);
void set_notekey_led_blink(uint8_t num);
void clear_notekey_led(uint8_t num);
uint8_t is_notekey_led_blink(uint8_t num);
void set_note_led(uint8_t note);
void clear_note_leds(void); // All note indicating LEDs, including RAS and UP/DOWN
void clear_notekey_leds(void); // the black & white keys, also used for clearing all NUM-Keys
#define blink_leds_on() (blink_led_on=1)
#define blink_leds_off() (blink_led_on=0)
void clear_all_leds(void);
void clear_blinking_leds(void);
void clear_dark_leds(void);
void display_octave_shift(int8_t shift);
void clock_leds(void);
extern uint8_t blink_led_on;
extern uint8_t dimblink_led_on;
extern uint8_t dimblink_led_ctr;