diff options
-rw-r--r-- | keyboard/atomic/keymaps/pvc/keymap.c | 373 | ||||
-rw-r--r-- | keyboard/atomic/keymaps/pvc/makefile.mk | 2 | ||||
-rw-r--r-- | quantum/audio.c | 55 | ||||
-rw-r--r-- | quantum/audio.h | 6 | ||||
-rw-r--r-- | quantum/keymap_common.c | 1 | ||||
-rw-r--r-- | quantum/musical_notes.h | 49 | ||||
-rw-r--r-- | quantum/song_list.h | 18 | ||||
-rw-r--r-- | tmk_core/common/action.c | 8 | ||||
-rw-r--r-- | tmk_core/common/action_layer.c | 12 | ||||
-rw-r--r-- | tmk_core/common/action_macro.c | 8 | ||||
-rw-r--r-- | tmk_core/common/action_tapping.c | 11 | ||||
-rw-r--r-- | tmk_core/common/command.c | 25 | ||||
-rw-r--r-- | tmk_core/common/print.h | 12 | ||||
-rw-r--r-- | tmk_core/protocol/lufa/lufa.c | 18 |
14 files changed, 343 insertions, 255 deletions
diff --git a/keyboard/atomic/keymaps/pvc/keymap.c b/keyboard/atomic/keymaps/pvc/keymap.c index c2081f525..aaef6b041 100644 --- a/keyboard/atomic/keymaps/pvc/keymap.c +++ b/keyboard/atomic/keymaps/pvc/keymap.c | |||
@@ -3,7 +3,7 @@ | |||
3 | 3 | ||
4 | #ifdef AUDIO_ENABLE | 4 | #ifdef AUDIO_ENABLE |
5 | #include "audio.h" | 5 | #include "audio.h" |
6 | #include "musical_notes.h" | 6 | #include "song_list.h" |
7 | #endif | 7 | #endif |
8 | 8 | ||
9 | 9 | ||
@@ -17,6 +17,13 @@ | |||
17 | #define M_LW 1 | 17 | #define M_LW 1 |
18 | #define M_RS 2 | 18 | #define M_RS 2 |
19 | #define M_FN 3 | 19 | #define M_FN 3 |
20 | #define M_T1 4 | ||
21 | #define M_T2 5 | ||
22 | #define M_T3 6 | ||
23 | #define M_T4 7 | ||
24 | #define M_TU 8 | ||
25 | #define M_TD 9 | ||
26 | #define M_DF 10 | ||
20 | 27 | ||
21 | 28 | ||
22 | #define _______ KC_TRNS | 29 | #define _______ KC_TRNS |
@@ -63,7 +70,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
63 | { KC_NLCK, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, ___T___, ___T___ }, | 70 | { KC_NLCK, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, ___T___, ___T___ }, |
64 | { KC_SLCK, KC_F13, KC_F14, KC_F15, KC_F16, KC_F17, KC_F18, KC_F19, KC_F20, KC_F21, KC_F22, KC_F23, KC_F24, KC_PAUS, KC_PSCR }, | 71 | { KC_SLCK, KC_F13, KC_F14, KC_F15, KC_F16, KC_F17, KC_F18, KC_F19, KC_F20, KC_F21, KC_F22, KC_F23, KC_F24, KC_PAUS, KC_PSCR }, |
65 | { KC_CAPS, KC_BTN5, KC_BTN4, KC_BTN3, KC_BTN2, KC_ACL0, KC_ACL2, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY, _______, ___T___, ___T___, KC_WH_U }, | 72 | { KC_CAPS, KC_BTN5, KC_BTN4, KC_BTN3, KC_BTN2, KC_ACL0, KC_ACL2, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY, _______, ___T___, ___T___, KC_WH_U }, |
66 | { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, ___T___, ___T___, KC_MS_U, KC_WH_D }, | 73 | { _______, M(M_T1), M(M_T2), M(M_T3), M(M_T4), M(M_TU), M(M_TD), M(M_DF), _______, _______, _______, ___T___, ___T___, KC_MS_U, KC_WH_D }, |
67 | { _______, _______, _______, _______, _______, KC_BTN1, KC_BTN1, _______, _______, _______, _______, _______, KC_MS_L, KC_MS_D, KC_MS_R }, | 74 | { _______, _______, _______, _______, _______, KC_BTN1, KC_BTN1, _______, _______, _______, _______, _______, KC_MS_L, KC_MS_D, KC_MS_R }, |
68 | }, | 75 | }, |
69 | [_AD] = { /* ADJUST */ | 76 | [_AD] = { /* ADJUST */ |
@@ -76,139 +83,124 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
76 | }; | 83 | }; |
77 | 84 | ||
78 | 85 | ||
86 | |||
79 | #ifdef AUDIO_ENABLE | 87 | #ifdef AUDIO_ENABLE |
80 | 88 | ||
89 | float start_up[][2] = SONG(ODE_TO_JOY); | ||
81 | 90 | ||
91 | float tone_lw[][2] = { | ||
82 | 92 | ||
93 | Q__NOTE(_C4 ) , | ||
94 | Q__NOTE(_CS4 ) , | ||
95 | Q__NOTE(_D4 ) , | ||
96 | Q__NOTE(_DS4 ) , | ||
97 | Q__NOTE(_E4 ) , | ||
98 | Q__NOTE(_F4 ) , | ||
99 | Q__NOTE(_FS4 ) , | ||
100 | Q__NOTE(_G4 ) , | ||
101 | Q__NOTE(_GS4 ) , | ||
102 | Q__NOTE(_A4 ) , | ||
103 | Q__NOTE(_AS4 ) , | ||
83 | 104 | ||
84 | float tone_lw[][2] = { | 105 | Q__NOTE(_B1 ) , |
85 | /* | ||
86 | Q_NOTE(_C1 ) , | ||
87 | Q_NOTE(_CS1 ) , | ||
88 | Q_NOTE(_D1 ) , | ||
89 | Q_NOTE(_DS1 ) , | ||
90 | Q_NOTE(_E1 ) , | ||
91 | Q_NOTE(_F1 ) , | ||
92 | Q_NOTE(_FS1 ) , | ||
93 | Q_NOTE(_G1 ) , | ||
94 | Q_NOTE(_GS1 ) , | ||
95 | Q_NOTE(_A1 ) , | ||
96 | Q_NOTE(_AS1 ) , | ||
97 | Q_NOTE(_B1 ) , | ||
98 | */ | ||
99 | |||
100 | Q_NOTE(_C4 ) , | ||
101 | Q_NOTE(_CS4 ) , | ||
102 | Q_NOTE(_D4 ) , | ||
103 | Q_NOTE(_DS4 ) , | ||
104 | Q_NOTE(_E4 ) , | ||
105 | Q_NOTE(_F4 ) , | ||
106 | Q_NOTE(_FS4 ) , | ||
107 | Q_NOTE(_G4 ) , | ||
108 | Q_NOTE(_GS4 ) , | ||
109 | Q_NOTE(_A4 ) , | ||
110 | Q_NOTE(_AS4 ) , | ||
111 | Q_NOTE(_B1 ) , | ||
112 | |||
113 | |||
114 | Q_NOTE(_C2 ) , | ||
115 | Q_NOTE(_CS2 ) , | ||
116 | Q_NOTE(_D2 ) , | ||
117 | Q_NOTE(_DS2 ) , | ||
118 | Q_NOTE(_E2 ) , | ||
119 | Q_NOTE(_F2 ) , | ||
120 | Q_NOTE(_FS2 ) , | ||
121 | Q_NOTE(_G2 ) , | ||
122 | Q_NOTE(_GS2 ) , | ||
123 | Q_NOTE(_A2 ) , | ||
124 | Q_NOTE(_AS2 ) , | ||
125 | Q_NOTE(_B2 ) , | ||
126 | Q_NOTE(_C3 ) , | ||
127 | Q_NOTE(_CS3 ) , | ||
128 | Q_NOTE(_D3 ) , | ||
129 | Q_NOTE(_DS3 ) , | ||
130 | Q_NOTE(_E3 ) , | ||
131 | Q_NOTE(_F3 ) , | ||
132 | Q_NOTE(_FS3 ) , | ||
133 | Q_NOTE(_G3 ) , | ||
134 | Q_NOTE(_GS3 ) , | ||
135 | Q_NOTE(_A3 ) , | ||
136 | Q_NOTE(_AS3 ) , | ||
137 | Q_NOTE(_B3 ) , | ||
138 | Q_NOTE(_C4 ) , | ||
139 | Q_NOTE(_CS4 ) , | ||
140 | Q_NOTE(_D4 ) , | ||
141 | Q_NOTE(_DS4 ) , | ||
142 | Q_NOTE(_E4 ) , | ||
143 | Q_NOTE(_F4 ) , | ||
144 | Q_NOTE(_FS4 ) , | ||
145 | Q_NOTE(_G4 ) , | ||
146 | Q_NOTE(_GS4 ) , | ||
147 | Q_NOTE(_A4 ) , | ||
148 | Q_NOTE(_AS4 ) , | ||
149 | Q_NOTE(_B4 ) , | ||
150 | Q_NOTE(_C5 ) , | ||
151 | Q_NOTE(_CS5 ) , | ||
152 | Q_NOTE(_D5 ) , | ||
153 | Q_NOTE(_DS5 ) , | ||
154 | Q_NOTE(_E5 ) , | ||
155 | Q_NOTE(_F5 ) , | ||
156 | Q_NOTE(_FS5 ) , | ||
157 | Q_NOTE(_G5 ) , | ||
158 | Q_NOTE(_GS5 ) , | ||
159 | Q_NOTE(_A5 ) , | ||
160 | Q_NOTE(_AS5 ) , | ||
161 | Q_NOTE(_B5 ) , | ||
162 | Q_NOTE(_C6 ) , | ||
163 | Q_NOTE(_CS6 ) , | ||
164 | Q_NOTE(_D6 ) , | ||
165 | Q_NOTE(_DS6 ) , | ||
166 | Q_NOTE(_E6 ) , | ||
167 | Q_NOTE(_F6 ) , | ||
168 | Q_NOTE(_FS6 ) , | ||
169 | Q_NOTE(_G6 ) , | ||
170 | Q_NOTE(_GS6 ) , | ||
171 | Q_NOTE(_A6 ) , | ||
172 | Q_NOTE(_AS6 ) , | ||
173 | Q_NOTE(_B6 ) , | ||
174 | Q_NOTE(_C7 ) , | ||
175 | Q_NOTE(_CS7 ) , | ||
176 | Q_NOTE(_D7 ) , | ||
177 | Q_NOTE(_DS7 ) , | ||
178 | Q_NOTE(_E7 ) , | ||
179 | Q_NOTE(_F7 ) , | ||
180 | Q_NOTE(_FS7 ) , | ||
181 | Q_NOTE(_G7 ) , | ||
182 | Q_NOTE(_GS7 ) , | ||
183 | Q_NOTE(_A7 ) , | ||
184 | Q_NOTE(_AS7 ) , | ||
185 | Q_NOTE(_B7 ) , | ||
186 | Q_NOTE(_C8 ) , | ||
187 | Q_NOTE(_CS8 ) , | ||
188 | Q_NOTE(_D8 ) , | ||
189 | Q_NOTE(_DS8 ) , | ||
190 | Q_NOTE(_E8 ) , | ||
191 | Q_NOTE(_F8 ) , | ||
192 | Q_NOTE(_FS8 ) , | ||
193 | Q_NOTE(_G8 ) , | ||
194 | Q_NOTE(_GS8 ) , | ||
195 | Q_NOTE(_A8 ) , | ||
196 | Q_NOTE(_AS8 ) , | ||
197 | Q_NOTE(_B8 ) , | ||
198 | 106 | ||
107 | Q__NOTE(_C2 ) , | ||
108 | Q__NOTE(_CS2 ) , | ||
109 | Q__NOTE(_D2 ) , | ||
110 | Q__NOTE(_DS2 ) , | ||
111 | Q__NOTE(_E2 ) , | ||
112 | Q__NOTE(_F2 ) , | ||
113 | Q__NOTE(_FS2 ) , | ||
114 | Q__NOTE(_G2 ) , | ||
115 | Q__NOTE(_GS2 ) , | ||
116 | Q__NOTE(_A2 ) , | ||
117 | Q__NOTE(_AS2 ) , | ||
118 | Q__NOTE(_B2 ) , | ||
119 | Q__NOTE(_C3 ) , | ||
120 | Q__NOTE(_CS3 ) , | ||
121 | Q__NOTE(_D3 ) , | ||
122 | Q__NOTE(_DS3 ) , | ||
123 | Q__NOTE(_E3 ) , | ||
124 | Q__NOTE(_F3 ) , | ||
125 | Q__NOTE(_FS3 ) , | ||
126 | Q__NOTE(_G3 ) , | ||
127 | Q__NOTE(_GS3 ) , | ||
128 | Q__NOTE(_A3 ) , | ||
129 | Q__NOTE(_AS3 ) , | ||
130 | Q__NOTE(_B3 ) , | ||
131 | Q__NOTE(_C4 ) , | ||
132 | Q__NOTE(_CS4 ) , | ||
133 | Q__NOTE(_D4 ) , | ||
134 | Q__NOTE(_DS4 ) , | ||
135 | Q__NOTE(_E4 ) , | ||
136 | Q__NOTE(_F4 ) , | ||
137 | Q__NOTE(_FS4 ) , | ||
138 | Q__NOTE(_G4 ) , | ||
139 | Q__NOTE(_GS4 ) , | ||
140 | Q__NOTE(_A4 ) , | ||
141 | Q__NOTE(_AS4 ) , | ||
142 | Q__NOTE(_B4 ) , | ||
143 | Q__NOTE(_C5 ) , | ||
144 | Q__NOTE(_CS5 ) , | ||
145 | Q__NOTE(_D5 ) , | ||
146 | Q__NOTE(_DS5 ) , | ||
147 | Q__NOTE(_E5 ) , | ||
148 | Q__NOTE(_F5 ) , | ||
149 | Q__NOTE(_FS5 ) , | ||
150 | Q__NOTE(_G5 ) , | ||
151 | Q__NOTE(_GS5 ) , | ||
152 | Q__NOTE(_A5 ) , | ||
153 | Q__NOTE(_AS5 ) , | ||
154 | Q__NOTE(_B5 ) , | ||
155 | Q__NOTE(_C6 ) , | ||
156 | Q__NOTE(_CS6 ) , | ||
157 | Q__NOTE(_D6 ) , | ||
158 | Q__NOTE(_DS6 ) , | ||
159 | Q__NOTE(_E6 ) , | ||
160 | Q__NOTE(_F6 ) , | ||
161 | Q__NOTE(_FS6 ) , | ||
162 | Q__NOTE(_G6 ) , | ||
163 | Q__NOTE(_GS6 ) , | ||
164 | Q__NOTE(_A6 ) , | ||
165 | Q__NOTE(_AS6 ) , | ||
166 | Q__NOTE(_B6 ) , | ||
167 | Q__NOTE(_C7 ) , | ||
168 | Q__NOTE(_CS7 ) , | ||
169 | Q__NOTE(_D7 ) , | ||
170 | Q__NOTE(_DS7 ) , | ||
171 | Q__NOTE(_E7 ) , | ||
172 | Q__NOTE(_F7 ) , | ||
173 | Q__NOTE(_FS7 ) , | ||
174 | Q__NOTE(_G7 ) , | ||
175 | Q__NOTE(_GS7 ) , | ||
176 | Q__NOTE(_A7 ) , | ||
177 | Q__NOTE(_AS7 ) , | ||
178 | Q__NOTE(_B7 ) , | ||
179 | Q__NOTE(_C8 ) , | ||
180 | Q__NOTE(_CS8 ) , | ||
181 | Q__NOTE(_D8 ) , | ||
182 | Q__NOTE(_DS8 ) , | ||
183 | Q__NOTE(_E8 ) , | ||
184 | Q__NOTE(_F8 ) , | ||
185 | Q__NOTE(_FS8 ) , | ||
186 | Q__NOTE(_G8 ) , | ||
187 | Q__NOTE(_GS8 ) , | ||
188 | Q__NOTE(_A8 ) , | ||
189 | Q__NOTE(_AS8 ) , | ||
190 | Q__NOTE(_B8 ) , | ||
199 | }; | 191 | }; |
200 | 192 | ||
201 | float tone_rs[][2] = { | 193 | float tone_rs[][2] = SONG(ROCK_A_BYE_BABY); |
202 | Q_NOTE(_A4 ) , | 194 | |
203 | Q_NOTE(_A4 ) , | 195 | void matrix_init_user(void) { |
204 | Q_NOTE(_A4 ) , | 196 | init_notes(); |
205 | Q_NOTE(_A4 ) , | 197 | PLAY_NOTE_ARRAY(start_up, false, STACCATO); |
206 | Q_NOTE(_AS8 ) , | 198 | println("Matrix Init"); |
207 | Q_NOTE(_B8 ) , | 199 | } |
208 | }; | ||
209 | 200 | ||
210 | #endif | 201 | #endif |
211 | 202 | ||
203 | |||
212 | void update_quad_layer(uint8_t layer1, uint8_t layer2, uint8_t layer3, uint8_t layer4, bool order) | 204 | void update_quad_layer(uint8_t layer1, uint8_t layer2, uint8_t layer3, uint8_t layer4, bool order) |
213 | { | 205 | { |
214 | if (order) | 206 | if (order) |
@@ -241,69 +233,82 @@ void update_quad_layer(uint8_t layer1, uint8_t layer2, uint8_t layer3, uint8_t l | |||
241 | const uint16_t PROGMEM fn_actions[] = { | 233 | const uint16_t PROGMEM fn_actions[] = { |
242 | }; | 234 | }; |
243 | 235 | ||
244 | //#define MUSIC_ARRAY_SIZE(x) (((int)(sizeof(x) / (sizeof(x[0][0])))) / 2) | ||
245 | 236 | ||
246 | const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) | 237 | const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) |
247 | { | 238 | { |
248 | 239 | ||
249 | // MACRODOWN only works in this function | 240 | // MACRODOWN only works in this function |
250 | switch(id) { | 241 | switch(id) |
251 | case M_LW: | 242 | { |
252 | if (record->event.pressed) { | 243 | case M_LW: |
253 | #ifdef AUDIO_ENABLE | 244 | if (record->event.pressed) { |
254 | println("PlayNotes LW"); | 245 | #ifdef AUDIO_ENABLE |
255 | PLAY_NOTE_ARRAY(tone_lw, false, STACCATO); | 246 | PLAY_NOTE_ARRAY(tone_lw, false, STACCATO); |
256 | #endif | 247 | #endif |
257 | layer_on(_LW); | 248 | layer_on(_LW); |
258 | update_tri_layer(_LW, _RS, _FN); | 249 | update_tri_layer(_LW, _RS, _AD); |
259 | } else { | 250 | } else { |
260 | layer_off(_LW); | 251 | layer_off(_LW); |
261 | update_tri_layer(_LW, _RS, _FN); | 252 | update_tri_layer(_LW, _RS, _AD); |
262 | } | 253 | } |
263 | break; | 254 | break; |
264 | case M_RS: | 255 | case M_RS: |
265 | if (record->event.pressed) { | 256 | if (record->event.pressed) { |
266 | #ifdef AUDIO_ENABLE | 257 | #ifdef AUDIO_ENABLE |
267 | println("PlayNotes RS"); | 258 | PLAY_NOTE_ARRAY(tone_rs, false, LEGATO); |
268 | PLAY_NOTE_ARRAY(tone_rs, false, LEGATO); | 259 | #endif |
269 | #endif | 260 | layer_on(_RS); |
270 | layer_on(_RS); | 261 | update_tri_layer(_LW, _RS, _AD); |
271 | update_tri_layer(_LW, _RS, _FN); | 262 | } else { |
272 | } else { | 263 | layer_off(_RS); |
273 | layer_off(_RS); | 264 | update_tri_layer(_LW, _RS, _AD); |
274 | update_tri_layer(_LW, _RS, _FN); | 265 | } |
275 | } | 266 | break; |
276 | break; | ||
277 | default: | ||
278 | break; | ||
279 | } | ||
280 | return MACRO_NONE; | ||
281 | }; | ||
282 | 267 | ||
283 | #ifdef AUDIO_ENABLE | 268 | case M_FN: |
284 | float start_up[][2] = { | 269 | if (record->event.pressed) { |
285 | Q_NOTE(_E4 ) , | 270 | layer_on(_FN); |
286 | Q_NOTE(_E4 ) , | 271 | } else { |
287 | Q_NOTE(_F4 ) , | 272 | layer_off(_FN); |
288 | Q_NOTE(_G4 ) , | 273 | } |
289 | Q_NOTE(_G4 ) , | 274 | break; |
290 | Q_NOTE(_F4 ) , | ||
291 | Q_NOTE(_E4 ) , | ||
292 | Q_NOTE(_D4 ) , | ||
293 | Q_NOTE(_C4 ) , | ||
294 | Q_NOTE(_C4 ) , | ||
295 | Q_NOTE(_D4 ) , | ||
296 | Q_NOTE(_E4 ) , | ||
297 | H_NOTE(_E4 ) , | ||
298 | Q_NOTE(_D4 ) , | ||
299 | H_NOTE(_D4 ) , | ||
300 | }; | ||
301 | #endif | ||
302 | 275 | ||
303 | void matrix_init_user(void) { | 276 | case M_T1: |
304 | #ifdef AUDIO_ENABLE | 277 | if (record->event.pressed) set_timbre(TIMBRE_12); |
305 | init_notes(); | 278 | break; |
306 | PLAY_NOTE_ARRAY(start_up, false, STACCATO); | 279 | |
307 | println("Matrix Init"); | 280 | case M_T2: |
308 | #endif | 281 | if (record->event.pressed) set_timbre(TIMBRE_25); |
309 | } | 282 | break; |
283 | |||
284 | case M_T3: | ||
285 | if (record->event.pressed) set_timbre(TIMBRE_50); | ||
286 | break; | ||
287 | |||
288 | case M_T4: | ||
289 | if (record->event.pressed) set_timbre(TIMBRE_75); | ||
290 | break; | ||
291 | |||
292 | |||
293 | case M_TU: | ||
294 | if (record->event.pressed) increase_tempo(10); | ||
295 | break; | ||
296 | |||
297 | case M_TD: | ||
298 | if (record->event.pressed) decrease_tempo(10); | ||
299 | break; | ||
300 | |||
301 | case M_DF: | ||
302 | if (record->event.pressed) | ||
303 | { | ||
304 | set_timbre(TIMBRE_DEFAULT); | ||
305 | set_tempo(TEMPO_DEFAULT); | ||
306 | } | ||
307 | break; | ||
308 | |||
309 | default: | ||
310 | break; | ||
311 | |||
312 | } | ||
313 | return MACRO_NONE; | ||
314 | }; \ No newline at end of file | ||
diff --git a/keyboard/atomic/keymaps/pvc/makefile.mk b/keyboard/atomic/keymaps/pvc/makefile.mk index d46996650..eefa42855 100644 --- a/keyboard/atomic/keymaps/pvc/makefile.mk +++ b/keyboard/atomic/keymaps/pvc/makefile.mk | |||
@@ -1,7 +1,7 @@ | |||
1 | BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000) | 1 | BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000) |
2 | MOUSEKEY_ENABLE = yes # Mouse keys(+4700) | 2 | MOUSEKEY_ENABLE = yes # Mouse keys(+4700) |
3 | EXTRAKEY_ENABLE = yes # Audio control and System control(+450) | 3 | EXTRAKEY_ENABLE = yes # Audio control and System control(+450) |
4 | CONSOLE_ENABLE = yes # Console for debug(+400) | 4 | CONSOLE_ENABLE = no # Console for debug(+400) |
5 | COMMAND_ENABLE = yes # Commands for debug and configuration | 5 | COMMAND_ENABLE = yes # Commands for debug and configuration |
6 | NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work | 6 | NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work |
7 | BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality | 7 | BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality |
diff --git a/quantum/audio.c b/quantum/audio.c index 6bd6532a3..3ccd5ab9b 100644 --- a/quantum/audio.c +++ b/quantum/audio.c | |||
@@ -4,7 +4,7 @@ | |||
4 | #include <avr/pgmspace.h> | 4 | #include <avr/pgmspace.h> |
5 | #include <avr/interrupt.h> | 5 | #include <avr/interrupt.h> |
6 | #include <avr/io.h> | 6 | #include <avr/io.h> |
7 | 7 | #include "print.h" | |
8 | #include "audio.h" | 8 | #include "audio.h" |
9 | #include "keymap_common.h" | 9 | #include "keymap_common.h" |
10 | 10 | ||
@@ -57,9 +57,11 @@ bool notes = false; | |||
57 | bool note = false; | 57 | bool note = false; |
58 | float note_frequency = 0; | 58 | float note_frequency = 0; |
59 | float note_length = 0; | 59 | float note_length = 0; |
60 | float note_tempo = TEMPO_DEFAULT; | ||
61 | float note_timbre = TIMBRE_DEFAULT; | ||
60 | uint16_t note_position = 0; | 62 | uint16_t note_position = 0; |
61 | float (* notes_pointer)[][2]; | 63 | float (* notes_pointer)[][2]; |
62 | uint8_t notes_length; | 64 | uint8_t notes_count; |
63 | bool notes_repeat; | 65 | bool notes_repeat; |
64 | float notes_rest; | 66 | float notes_rest; |
65 | bool note_resting = false; | 67 | bool note_resting = false; |
@@ -255,7 +257,8 @@ ISR(TIMER3_COMPA_vect) { | |||
255 | place = 0.0; | 257 | place = 0.0; |
256 | } | 258 | } |
257 | ICR3 = (int)(((double)F_CPU) / (frequencies[voice_place] * CPU_PRESCALER)); // Set max to the period | 259 | ICR3 = (int)(((double)F_CPU) / (frequencies[voice_place] * CPU_PRESCALER)); // Set max to the period |
258 | OCR3A = (int)(((double)F_CPU) / (frequencies[voice_place] * CPU_PRESCALER)) >> 1 * duty_place; // Set compare to half the period | 260 | OCR3A = (int)((((double)F_CPU) /(frequencies[voice_place] * CPU_PRESCALER)) * note_timbre); // Set compare to half the period |
261 | //OCR3A = (int)(((double)F_CPU) / (frequencies[voice_place] * CPU_PRESCALER)) >> 1 * duty_place; // Set compare to half the period | ||
259 | place++; | 262 | place++; |
260 | // if (duty_counter > (frequencies[voice_place] / 500)) { | 263 | // if (duty_counter > (frequencies[voice_place] / 500)) { |
261 | // duty_place = (duty_place % 3) + 1; | 264 | // duty_place = (duty_place % 3) + 1; |
@@ -288,7 +291,7 @@ ISR(TIMER3_COMPA_vect) { | |||
288 | #else | 291 | #else |
289 | if (note_frequency > 0) { | 292 | if (note_frequency > 0) { |
290 | ICR3 = (int)(((double)F_CPU) / (note_frequency * CPU_PRESCALER)); // Set max to the period | 293 | ICR3 = (int)(((double)F_CPU) / (note_frequency * CPU_PRESCALER)); // Set max to the period |
291 | OCR3A = (int)(((double)F_CPU) / (note_frequency * CPU_PRESCALER)) >> 1; // Set compare to half the period | 294 | OCR3A = (int)((((double)F_CPU) / (note_frequency * CPU_PRESCALER)) * note_timbre); // Set compare to half the period |
292 | } else { | 295 | } else { |
293 | ICR3 = 0; | 296 | ICR3 = 0; |
294 | OCR3A = 0; | 297 | OCR3A = 0; |
@@ -304,7 +307,7 @@ ISR(TIMER3_COMPA_vect) { | |||
304 | end_of_note = (note_position >= (note_length * 0x7FF)); | 307 | end_of_note = (note_position >= (note_length * 0x7FF)); |
305 | if (end_of_note) { | 308 | if (end_of_note) { |
306 | current_note++; | 309 | current_note++; |
307 | if (current_note >= notes_length) { | 310 | if (current_note >= notes_count) { |
308 | if (notes_repeat) { | 311 | if (notes_repeat) { |
309 | current_note = 0; | 312 | current_note = 0; |
310 | } else { | 313 | } else { |
@@ -327,10 +330,10 @@ ISR(TIMER3_COMPA_vect) { | |||
327 | note_resting = false; | 330 | note_resting = false; |
328 | #ifdef PWM_AUDIO | 331 | #ifdef PWM_AUDIO |
329 | note_frequency = (*notes_pointer)[current_note][0] / SAMPLE_RATE; | 332 | note_frequency = (*notes_pointer)[current_note][0] / SAMPLE_RATE; |
330 | note_length = (*notes_pointer)[current_note][1]; | 333 | note_length = (*notes_pointer)[current_note][1] * (note_tempo / 100); |
331 | #else | 334 | #else |
332 | note_frequency = (*notes_pointer)[current_note][0]; | 335 | note_frequency = (*notes_pointer)[current_note][0]; |
333 | note_length = (*notes_pointer)[current_note][1] / 4; | 336 | note_length = ((*notes_pointer)[current_note][1] / 4) * (note_tempo / 100); |
334 | #endif | 337 | #endif |
335 | } | 338 | } |
336 | note_position = 0; | 339 | note_position = 0; |
@@ -344,7 +347,7 @@ ISR(TIMER3_COMPA_vect) { | |||
344 | } | 347 | } |
345 | } | 348 | } |
346 | 349 | ||
347 | void play_notes(float (*np)[][2], uint8_t n_length, bool n_repeat, float n_rest) { | 350 | void play_notes(float (*np)[][2], uint8_t n_count, bool n_repeat, float n_rest) { |
348 | 351 | ||
349 | if (audio_config.enable) { | 352 | if (audio_config.enable) { |
350 | 353 | ||
@@ -352,7 +355,7 @@ if (audio_config.enable) { | |||
352 | stop_all_notes(); | 355 | stop_all_notes(); |
353 | 356 | ||
354 | notes_pointer = np; | 357 | notes_pointer = np; |
355 | notes_length = n_length; | 358 | notes_count = n_count; |
356 | notes_repeat = n_repeat; | 359 | notes_repeat = n_repeat; |
357 | notes_rest = n_rest; | 360 | notes_rest = n_rest; |
358 | 361 | ||
@@ -360,10 +363,10 @@ if (audio_config.enable) { | |||
360 | current_note = 0; | 363 | current_note = 0; |
361 | #ifdef PWM_AUDIO | 364 | #ifdef PWM_AUDIO |
362 | note_frequency = (*notes_pointer)[current_note][0] / SAMPLE_RATE; | 365 | note_frequency = (*notes_pointer)[current_note][0] / SAMPLE_RATE; |
363 | note_length = (*notes_pointer)[current_note][1]; | 366 | note_length = (*notes_pointer)[current_note][1] * (note_tempo / 100); |
364 | #else | 367 | #else |
365 | note_frequency = (*notes_pointer)[current_note][0]; | 368 | note_frequency = (*notes_pointer)[current_note][0]; |
366 | note_length = (*notes_pointer)[current_note][1] / 4; | 369 | note_length = ((*notes_pointer)[current_note][1] / 4) * (note_tempo / 100); |
367 | #endif | 370 | #endif |
368 | note_position = 0; | 371 | note_position = 0; |
369 | 372 | ||
@@ -439,4 +442,32 @@ if (audio_config.enable && voices < 8) { | |||
439 | note = true; | 442 | note = true; |
440 | } | 443 | } |
441 | 444 | ||
442 | } \ No newline at end of file | 445 | } |
446 | |||
447 | void set_timbre(float timbre) | ||
448 | { | ||
449 | note_timbre = timbre; | ||
450 | } | ||
451 | |||
452 | void set_tempo(float tempo) | ||
453 | { | ||
454 | note_tempo = tempo; | ||
455 | } | ||
456 | |||
457 | void decrease_tempo(uint8_t tempo_change) | ||
458 | { | ||
459 | note_tempo += (float) tempo_change; | ||
460 | } | ||
461 | |||
462 | void increase_tempo(uint8_t tempo_change) | ||
463 | { | ||
464 | if (note_tempo - (float) tempo_change < 10) | ||
465 | { | ||
466 | note_tempo = 10; | ||
467 | } | ||
468 | else | ||
469 | { | ||
470 | note_tempo -= (float) tempo_change; | ||
471 | } | ||
472 | } | ||
473 | |||
diff --git a/quantum/audio.h b/quantum/audio.h index e1bc23ffe..3aba8370a 100644 --- a/quantum/audio.h +++ b/quantum/audio.h | |||
@@ -24,8 +24,12 @@ void play_note(double freq, int vol); | |||
24 | void stop_note(double freq); | 24 | void stop_note(double freq); |
25 | void stop_all_notes(void); | 25 | void stop_all_notes(void); |
26 | void init_notes(void); | 26 | void init_notes(void); |
27 | void play_notes(float (*np)[][2], uint8_t n_length, bool n_repeat, float n_rest); | 27 | void play_notes(float (*np)[][2], uint8_t n_count, bool n_repeat, float n_rest); |
28 | 28 | ||
29 | void set_timbre(float timbre); | ||
30 | void set_tempo(float tempo); | ||
31 | void increase_tempo(uint8_t tempo_change); | ||
32 | void decrease_tempo(uint8_t tempo_change); | ||
29 | 33 | ||
30 | #define SCALE (int []){ 0 + (12*0), 2 + (12*0), 4 + (12*0), 5 + (12*0), 7 + (12*0), 9 + (12*0), 11 + (12*0), \ | 34 | #define SCALE (int []){ 0 + (12*0), 2 + (12*0), 4 + (12*0), 5 + (12*0), 7 + (12*0), 9 + (12*0), 11 + (12*0), \ |
31 | 0 + (12*1), 2 + (12*1), 4 + (12*1), 5 + (12*1), 7 + (12*1), 9 + (12*1), 11 + (12*1), \ | 35 | 0 + (12*1), 2 + (12*1), 4 + (12*1), 5 + (12*1), 7 + (12*1), 9 + (12*1), 11 + (12*1), \ |
diff --git a/quantum/keymap_common.c b/quantum/keymap_common.c index d38e6fdb2..c705b7a73 100644 --- a/quantum/keymap_common.c +++ b/quantum/keymap_common.c | |||
@@ -26,6 +26,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
26 | #include "backlight.h" | 26 | #include "backlight.h" |
27 | #include "keymap_midi.h" | 27 | #include "keymap_midi.h" |
28 | #include "bootloader.h" | 28 | #include "bootloader.h" |
29 | #include "eeconfig.h" | ||
29 | 30 | ||
30 | extern keymap_config_t keymap_config; | 31 | extern keymap_config_t keymap_config; |
31 | 32 | ||
diff --git a/quantum/musical_notes.h b/quantum/musical_notes.h index 837f6a069..2170f3f18 100644 --- a/quantum/musical_notes.h +++ b/quantum/musical_notes.h | |||
@@ -2,22 +2,38 @@ | |||
2 | #define MUSICAL_NOTES_H | 2 | #define MUSICAL_NOTES_H |
3 | 3 | ||
4 | // Tempo Placeholder | 4 | // Tempo Placeholder |
5 | #define TEMPO 120 | 5 | #define TEMPO_DEFAULT 100 |
6 | |||
7 | |||
8 | #define SONG(notes...) { notes } | ||
6 | 9 | ||
7 | 10 | ||
8 | // Note Types | 11 | // Note Types |
9 | #define WHOLE_NOTE(note) {(NOTE##note), 64} | 12 | #define MUSICAL_NOTE(note, duration) {(NOTE##note), duration} |
10 | #define HALF_NOTE(note) {(NOTE##note), 32} | 13 | #define WHOLE_NOTE(note) MUSICAL_NOTE(note, 64) |
11 | #define QUARTER_NOTE(note) {(NOTE##note), 16} | 14 | #define HALF_NOTE(note) MUSICAL_NOTE(note, 32) |
12 | #define EIGHTH_NOTE(note) {(NOTE##note), 8} | 15 | #define QUARTER_NOTE(note) MUSICAL_NOTE(note, 16) |
13 | #define SIXTEENTH_NOTE(note) {(NOTE##note), 4} | 16 | #define EIGHTH_NOTE(note) MUSICAL_NOTE(note, 8) |
17 | #define SIXTEENTH_NOTE(note) MUSICAL_NOTE(note, 4) | ||
18 | |||
19 | #define WHOLE_DOT_NOTE(note) MUSICAL_NOTE(note, 64+32) | ||
20 | #define HALF_DOT_NOTE(note) MUSICAL_NOTE(note, 32+16) | ||
21 | #define QUARTER_DOT_NOTE(note) MUSICAL_NOTE(note, 16+8) | ||
22 | #define EIGHTH_DOT_NOTE(note) MUSICAL_NOTE(note, 8+4) | ||
23 | #define SIXTEENTH_DOT_NOTE(note) MUSICAL_NOTE(note, 4+2) | ||
14 | 24 | ||
15 | // Note Types Short | 25 | // Note Type Shortcuts |
16 | #define W_NOTE(n) WHOLE_NOTE(n) | 26 | #define M__NOTE(note, duration) MUSICAL_NOTE(note, duration) |
17 | #define H_NOTE(n) HALF_NOTE(n) | 27 | #define W__NOTE(n) WHOLE_NOTE(n) |
18 | #define Q_NOTE(n) QUARTER_NOTE(n) | 28 | #define H__NOTE(n) HALF_NOTE(n) |
19 | #define E_NOTE(n) EIGTH_NOTE(n) | 29 | #define Q__NOTE(n) QUARTER_NOTE(n) |
20 | #define S_NOTE(n) SIXTEENTH_NOTE(n) | 30 | #define E__NOTE(n) EIGHTH_NOTE(n) |
31 | #define S__NOTE(n) SIXTEENTH_NOTE(n) | ||
32 | #define WD_NOTE(n) WHOLE_DOT_NOTE(n) | ||
33 | #define HD_NOTE(n) HALF_DOT_NOTE(n) | ||
34 | #define QD_NOTE(n) QUARTER_DOT_NOTE(n) | ||
35 | #define ED_NOTE(n) EIGTH_DOT_NOTE(n) | ||
36 | #define SD_NOTE(n) SIXTEENTH_DOT_NOTE(n) | ||
21 | 37 | ||
22 | // Note Styles | 38 | // Note Styles |
23 | // Staccato makes sure there is a rest between each note. Think: TA TA TA | 39 | // Staccato makes sure there is a rest between each note. Think: TA TA TA |
@@ -25,6 +41,15 @@ | |||
25 | #define STACCATO 0.01 | 41 | #define STACCATO 0.01 |
26 | #define LEGATO 0 | 42 | #define LEGATO 0 |
27 | 43 | ||
44 | // Note Timbre | ||
45 | // Changes how the notes sound | ||
46 | #define TIMBRE_12 0.125 | ||
47 | #define TIMBRE_25 0.250 | ||
48 | #define TIMBRE_50 0.500 | ||
49 | #define TIMBRE_75 0.750 | ||
50 | #define TIMBRE_DEFAULT TIMBRE_50 | ||
51 | |||
52 | |||
28 | // Notes - # = Octave | 53 | // Notes - # = Octave |
29 | #define NOTE_REST 0.00 | 54 | #define NOTE_REST 0.00 |
30 | #define NOTE_C0 16.35 | 55 | #define NOTE_C0 16.35 |
diff --git a/quantum/song_list.h b/quantum/song_list.h new file mode 100644 index 000000000..ef36a1cdd --- /dev/null +++ b/quantum/song_list.h | |||
@@ -0,0 +1,18 @@ | |||
1 | #include "musical_notes.h" | ||
2 | |||
3 | #ifndef SONG_LIST_H | ||
4 | #define SONG_LIST_H | ||
5 | |||
6 | #define ODE_TO_JOY \ | ||
7 | Q__NOTE(_E4), Q__NOTE(_E4), Q__NOTE(_F4), Q__NOTE(_G4), \ | ||
8 | Q__NOTE(_G4), Q__NOTE(_F4), Q__NOTE(_E4), Q__NOTE(_D4), \ | ||
9 | Q__NOTE(_C4), Q__NOTE(_C4), Q__NOTE(_D4), Q__NOTE(_E4), \ | ||
10 | QD_NOTE(_E4), E__NOTE(_D4), H__NOTE(_D4), | ||
11 | |||
12 | #define ROCK_A_BYE_BABY \ | ||
13 | QD_NOTE(_B4), E__NOTE(_D4), Q__NOTE(_B5), \ | ||
14 | H__NOTE(_A5), Q__NOTE(_G5), \ | ||
15 | QD_NOTE(_B4), E__NOTE(_D5), Q__NOTE(_G5), \ | ||
16 | H__NOTE(_FS5), | ||
17 | |||
18 | #endif \ No newline at end of file | ||
diff --git a/tmk_core/common/action.c b/tmk_core/common/action.c index f9e6c17dc..0162fbd63 100644 --- a/tmk_core/common/action.c +++ b/tmk_core/common/action.c | |||
@@ -27,11 +27,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
27 | #include "action_util.h" | 27 | #include "action_util.h" |
28 | #include "action.h" | 28 | #include "action.h" |
29 | 29 | ||
30 | #ifdef DEBUG_ACTION | 30 | //#ifdef DEBUG_ACTION |
31 | #include "debug.h" | 31 | #include "debug.h" |
32 | #else | 32 | //#else |
33 | #include "nodebug.h" | 33 | //#include "nodebug.h" |
34 | #endif | 34 | //#endif |
35 | 35 | ||
36 | 36 | ||
37 | void action_exec(keyevent_t event) | 37 | void action_exec(keyevent_t event) |
diff --git a/tmk_core/common/action_layer.c b/tmk_core/common/action_layer.c index e817c0d51..845fbbb21 100644 --- a/tmk_core/common/action_layer.c +++ b/tmk_core/common/action_layer.c | |||
@@ -4,14 +4,14 @@ | |||
4 | #include "util.h" | 4 | #include "util.h" |
5 | #include "action_layer.h" | 5 | #include "action_layer.h" |
6 | 6 | ||
7 | #ifdef DEBUG_ACTION | 7 | //#ifdef DEBUG_ACTION |
8 | #include "debug.h" | 8 | #include "debug.h" |
9 | #else | 9 | //#else |
10 | #include "nodebug.h" | 10 | //#include "nodebug.h" |
11 | #endif | 11 | //#endif |
12 | 12 | ||
13 | 13 | ||
14 | /* | 14 | /* |
15 | * Default Layer State | 15 | * Default Layer State |
16 | */ | 16 | */ |
17 | uint32_t default_layer_state = 0; | 17 | uint32_t default_layer_state = 0; |
@@ -52,7 +52,7 @@ void default_layer_xor(uint32_t state) | |||
52 | 52 | ||
53 | 53 | ||
54 | #ifndef NO_ACTION_LAYER | 54 | #ifndef NO_ACTION_LAYER |
55 | /* | 55 | /* |
56 | * Keymap Layer State | 56 | * Keymap Layer State |
57 | */ | 57 | */ |
58 | uint32_t layer_state = 0; | 58 | uint32_t layer_state = 0; |
diff --git a/tmk_core/common/action_macro.c b/tmk_core/common/action_macro.c index 7726b1190..cc78c8232 100644 --- a/tmk_core/common/action_macro.c +++ b/tmk_core/common/action_macro.c | |||
@@ -19,11 +19,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
19 | #include "action_macro.h" | 19 | #include "action_macro.h" |
20 | #include "wait.h" | 20 | #include "wait.h" |
21 | 21 | ||
22 | #ifdef DEBUG_ACTION | 22 | //#ifdef DEBUG_ACTION |
23 | #include "debug.h" | 23 | #include "debug.h" |
24 | #else | 24 | //#else |
25 | #include "nodebug.h" | 25 | //#include "nodebug.h" |
26 | #endif | 26 | //#endif |
27 | 27 | ||
28 | 28 | ||
29 | #ifndef NO_ACTION_MACRO | 29 | #ifndef NO_ACTION_MACRO |
diff --git a/tmk_core/common/action_tapping.c b/tmk_core/common/action_tapping.c index 826c23309..6b6fa1dfe 100644 --- a/tmk_core/common/action_tapping.c +++ b/tmk_core/common/action_tapping.c | |||
@@ -6,11 +6,11 @@ | |||
6 | #include "keycode.h" | 6 | #include "keycode.h" |
7 | #include "timer.h" | 7 | #include "timer.h" |
8 | 8 | ||
9 | #ifdef DEBUG_ACTION | 9 | //#ifdef DEBUG_ACTION |
10 | #include "debug.h" | 10 | #include "debug.h" |
11 | #else | 11 | //#else |
12 | #include "nodebug.h" | 12 | //#include "nodebug.h" |
13 | #endif | 13 | //#endif |
14 | 14 | ||
15 | #ifndef NO_ACTION_TAPPING | 15 | #ifndef NO_ACTION_TAPPING |
16 | 16 | ||
@@ -139,7 +139,7 @@ bool process_tapping(keyrecord_t *keyp) | |||
139 | if (event.pressed) { | 139 | if (event.pressed) { |
140 | tapping_key.tap.interrupted = true; | 140 | tapping_key.tap.interrupted = true; |
141 | } | 141 | } |
142 | // enqueue | 142 | // enqueue |
143 | return false; | 143 | return false; |
144 | } | 144 | } |
145 | } | 145 | } |
@@ -324,6 +324,7 @@ bool waiting_buffer_typed(keyevent_t event) | |||
324 | return false; | 324 | return false; |
325 | } | 325 | } |
326 | 326 | ||
327 | __attribute__((unused)) | ||
327 | bool waiting_buffer_has_anykey_pressed(void) | 328 | bool waiting_buffer_has_anykey_pressed(void) |
328 | { | 329 | { |
329 | for (uint8_t i = waiting_buffer_tail; i != waiting_buffer_head; i = (i + 1) % WAITING_BUFFER_SIZE) { | 330 | for (uint8_t i = waiting_buffer_tail; i != waiting_buffer_head; i = (i + 1) % WAITING_BUFFER_SIZE) { |
diff --git a/tmk_core/common/command.c b/tmk_core/common/command.c index b4cd3ca56..7572b9597 100644 --- a/tmk_core/common/command.c +++ b/tmk_core/common/command.c | |||
@@ -122,7 +122,7 @@ static void command_common_help(void) | |||
122 | STR(MAGIC_KEY_VERSION ) ": Version\n" | 122 | STR(MAGIC_KEY_VERSION ) ": Version\n" |
123 | STR(MAGIC_KEY_STATUS ) ": Status\n" | 123 | STR(MAGIC_KEY_STATUS ) ": Status\n" |
124 | STR(MAGIC_KEY_CONSOLE ) ": Activate Console Mode\n" | 124 | STR(MAGIC_KEY_CONSOLE ) ": Activate Console Mode\n" |
125 | 125 | ||
126 | #if MAGIC_KEY_SWITCH_LAYER_WITH_CUSTOM | 126 | #if MAGIC_KEY_SWITCH_LAYER_WITH_CUSTOM |
127 | STR(MAGIC_KEY_LAYER0 ) ": Switch to Layer 0\n" | 127 | STR(MAGIC_KEY_LAYER0 ) ": Switch to Layer 0\n" |
128 | STR(MAGIC_KEY_LAYER1 ) ": Switch to Layer 1\n" | 128 | STR(MAGIC_KEY_LAYER1 ) ": Switch to Layer 1\n" |
@@ -136,11 +136,11 @@ static void command_common_help(void) | |||
136 | STR(MAGIC_KEY_LAYER9 ) ": Switch to Layer 9\n" | 136 | STR(MAGIC_KEY_LAYER9 ) ": Switch to Layer 9\n" |
137 | #endif | 137 | #endif |
138 | 138 | ||
139 | #if MAGIC_KEY_SWITCH_LAYER_WITH_FKEYS | 139 | #if MAGIC_KEY_SWITCH_LAYER_WITH_FKEYS |
140 | "F1-F10: Switch to Layer 0-9 (F10 = L0)\n" | 140 | "F1-F10: Switch to Layer 0-9 (F10 = L0)\n" |
141 | #endif | 141 | #endif |
142 | 142 | ||
143 | #if MAGIC_KEY_SWITCH_LAYER_WITH_NKEYS | 143 | #if MAGIC_KEY_SWITCH_LAYER_WITH_NKEYS |
144 | "0-9: Switch to Layer 0-9\n" | 144 | "0-9: Switch to Layer 0-9\n" |
145 | #endif | 145 | #endif |
146 | 146 | ||
@@ -251,6 +251,7 @@ static void print_status(void) | |||
251 | #ifdef BOOTMAGIC_ENABLE | 251 | #ifdef BOOTMAGIC_ENABLE |
252 | static void print_eeconfig(void) | 252 | static void print_eeconfig(void) |
253 | { | 253 | { |
254 | #ifndef NO_PRINT | ||
254 | print("default_layer: "); print_dec(eeconfig_read_default_layer()); print("\n"); | 255 | print("default_layer: "); print_dec(eeconfig_read_default_layer()); print("\n"); |
255 | 256 | ||
256 | debug_config_t dc; | 257 | debug_config_t dc; |
@@ -279,9 +280,12 @@ static void print_eeconfig(void) | |||
279 | print("backlight_config.raw: "); print_hex8(bc.raw); print("\n"); | 280 | print("backlight_config.raw: "); print_hex8(bc.raw); print("\n"); |
280 | print(".enable: "); print_dec(bc.enable); print("\n"); | 281 | print(".enable: "); print_dec(bc.enable); print("\n"); |
281 | print(".level: "); print_dec(bc.level); print("\n"); | 282 | print(".level: "); print_dec(bc.level); print("\n"); |
282 | #endif | 283 | #endif /* BACKLIGHT_ENABLE */ |
284 | |||
285 | #endif /* !NO_PRINT */ | ||
286 | |||
283 | } | 287 | } |
284 | #endif | 288 | #endif /* BOOTMAGIC_ENABLE */ |
285 | 289 | ||
286 | static bool command_common(uint8_t code) | 290 | static bool command_common(uint8_t code) |
287 | { | 291 | { |
@@ -305,7 +309,7 @@ static bool command_common(uint8_t code) | |||
305 | #ifdef BOOTMAGIC_ENABLE | 309 | #ifdef BOOTMAGIC_ENABLE |
306 | 310 | ||
307 | // print stored eeprom config | 311 | // print stored eeprom config |
308 | case MAGIC_KC(MAGIC_KEY_EEPROM): | 312 | case MAGIC_KC(MAGIC_KEY_EEPROM): |
309 | print("eeconfig:\n"); | 313 | print("eeconfig:\n"); |
310 | print_eeconfig(); | 314 | print_eeconfig(); |
311 | break; | 315 | break; |
@@ -369,7 +373,7 @@ static bool command_common(uint8_t code) | |||
369 | break; | 373 | break; |
370 | 374 | ||
371 | // debug matrix toggle | 375 | // debug matrix toggle |
372 | case MAGIC_KC(MAGIC_KEY_DEBUG_MATRIX): | 376 | case MAGIC_KC(MAGIC_KEY_DEBUG_MATRIX): |
373 | debug_matrix = !debug_matrix; | 377 | debug_matrix = !debug_matrix; |
374 | if (debug_matrix) { | 378 | if (debug_matrix) { |
375 | print("\nmatrix: on\n"); | 379 | print("\nmatrix: on\n"); |
@@ -380,7 +384,7 @@ static bool command_common(uint8_t code) | |||
380 | break; | 384 | break; |
381 | 385 | ||
382 | // debug keyboard toggle | 386 | // debug keyboard toggle |
383 | case MAGIC_KC(MAGIC_KEY_DEBUG_KBD): | 387 | case MAGIC_KC(MAGIC_KEY_DEBUG_KBD): |
384 | debug_keyboard = !debug_keyboard; | 388 | debug_keyboard = !debug_keyboard; |
385 | if (debug_keyboard) { | 389 | if (debug_keyboard) { |
386 | print("\nkeyboard: on\n"); | 390 | print("\nkeyboard: on\n"); |
@@ -551,6 +555,7 @@ static uint8_t mousekey_param = 0; | |||
551 | 555 | ||
552 | static void mousekey_param_print(void) | 556 | static void mousekey_param_print(void) |
553 | { | 557 | { |
558 | #ifndef NO_PRINT | ||
554 | print("\n\t- Values -\n"); | 559 | print("\n\t- Values -\n"); |
555 | print("1: delay(*10ms): "); pdec(mk_delay); print("\n"); | 560 | print("1: delay(*10ms): "); pdec(mk_delay); print("\n"); |
556 | print("2: interval(ms): "); pdec(mk_interval); print("\n"); | 561 | print("2: interval(ms): "); pdec(mk_interval); print("\n"); |
@@ -558,6 +563,8 @@ static void mousekey_param_print(void) | |||
558 | print("4: time_to_max: "); pdec(mk_time_to_max); print("\n"); | 563 | print("4: time_to_max: "); pdec(mk_time_to_max); print("\n"); |
559 | print("5: wheel_max_speed: "); pdec(mk_wheel_max_speed); print("\n"); | 564 | print("5: wheel_max_speed: "); pdec(mk_wheel_max_speed); print("\n"); |
560 | print("6: wheel_time_to_max: "); pdec(mk_wheel_time_to_max); print("\n"); | 565 | print("6: wheel_time_to_max: "); pdec(mk_wheel_time_to_max); print("\n"); |
566 | #endif /* !NO_PRINT */ | ||
567 | |||
561 | } | 568 | } |
562 | 569 | ||
563 | //#define PRINT_SET_VAL(v) print(#v " = "); print_dec(v); print("\n"); | 570 | //#define PRINT_SET_VAL(v) print(#v " = "); print_dec(v); print("\n"); |
@@ -677,7 +684,7 @@ static void mousekey_console_help(void) | |||
677 | "pgdown: -10\n" | 684 | "pgdown: -10\n" |
678 | "\n" | 685 | "\n" |
679 | "speed = delta * max_speed * (repeat / time_to_max)\n"); | 686 | "speed = delta * max_speed * (repeat / time_to_max)\n"); |
680 | xprintf("where delta: cursor=%d, wheel=%d\n" | 687 | xprintf("where delta: cursor=%d, wheel=%d\n" |
681 | "See http://en.wikipedia.org/wiki/Mouse_keys\n", MOUSEKEY_MOVE_DELTA, MOUSEKEY_WHEEL_DELTA); | 688 | "See http://en.wikipedia.org/wiki/Mouse_keys\n", MOUSEKEY_MOVE_DELTA, MOUSEKEY_WHEEL_DELTA); |
682 | } | 689 | } |
683 | 690 | ||
diff --git a/tmk_core/common/print.h b/tmk_core/common/print.h index c0e9e1430..4f3dde65a 100644 --- a/tmk_core/common/print.h +++ b/tmk_core/common/print.h | |||
@@ -2,17 +2,17 @@ | |||
2 | /* Very basic print functions, intended to be used with usb_debug_only.c | 2 | /* Very basic print functions, intended to be used with usb_debug_only.c |
3 | * http://www.pjrc.com/teensy/ | 3 | * http://www.pjrc.com/teensy/ |
4 | * Copyright (c) 2008 PJRC.COM, LLC | 4 | * Copyright (c) 2008 PJRC.COM, LLC |
5 | * | 5 | * |
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy | 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
7 | * of this software and associated documentation files (the "Software"), to deal | 7 | * of this software and associated documentation files (the "Software"), to deal |
8 | * in the Software without restriction, including without limitation the rights | 8 | * in the Software without restriction, including without limitation the rights |
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
10 | * copies of the Software, and to permit persons to whom the Software is | 10 | * copies of the Software, and to permit persons to whom the Software is |
11 | * furnished to do so, subject to the following conditions: | 11 | * furnished to do so, subject to the following conditions: |
12 | * | 12 | * |
13 | * The above copyright notice and this permission notice shall be included in | 13 | * The above copyright notice and this permission notice shall be included in |
14 | * all copies or substantial portions of the Software. | 14 | * all copies or substantial portions of the Software. |
15 | * | 15 | * |
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
@@ -91,9 +91,9 @@ void print_set_sendchar(int8_t (*print_sendchar_func)(uint8_t)); | |||
91 | 91 | ||
92 | #else /* NO_PRINT */ | 92 | #else /* NO_PRINT */ |
93 | 93 | ||
94 | #define xprintf | 94 | #define xprintf(fmt, ...) |
95 | #define print | 95 | #define print(s) |
96 | #define println | 96 | #define println(s) |
97 | #define print_set_sendchar(func) | 97 | #define print_set_sendchar(func) |
98 | #define print_dec(data) | 98 | #define print_dec(data) |
99 | #define print_decs(data) | 99 | #define print_decs(data) |
diff --git a/tmk_core/protocol/lufa/lufa.c b/tmk_core/protocol/lufa/lufa.c index 5d40dcf7b..f03f9a9b9 100644 --- a/tmk_core/protocol/lufa/lufa.c +++ b/tmk_core/protocol/lufa/lufa.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright 2012 Jun Wako <wakojun@gmail.com> | 2 | * Copyright 2012 Jun Wako <wakojun@gmail.com> |
3 | * This file is based on: | 3 | * This file is based on: |
4 | * LUFA-120219/Demos/Device/Lowlevel/KeyboardMouse | 4 | * LUFA-120219/Demos/Device/Lowlevel/KeyboardMouse |
@@ -152,10 +152,10 @@ static void Console_Task(void) | |||
152 | { | 152 | { |
153 | /* Create a temporary buffer to hold the read in report from the host */ | 153 | /* Create a temporary buffer to hold the read in report from the host */ |
154 | uint8_t ConsoleData[CONSOLE_EPSIZE]; | 154 | uint8_t ConsoleData[CONSOLE_EPSIZE]; |
155 | 155 | ||
156 | /* Read Console Report Data */ | 156 | /* Read Console Report Data */ |
157 | Endpoint_Read_Stream_LE(&ConsoleData, sizeof(ConsoleData), NULL); | 157 | Endpoint_Read_Stream_LE(&ConsoleData, sizeof(ConsoleData), NULL); |
158 | 158 | ||
159 | /* Process Console Report Data */ | 159 | /* Process Console Report Data */ |
160 | //ProcessConsoleHIDReport(ConsoleData); | 160 | //ProcessConsoleHIDReport(ConsoleData); |
161 | } | 161 | } |
@@ -183,10 +183,6 @@ static void Console_Task(void) | |||
183 | 183 | ||
184 | Endpoint_SelectEndpoint(ep); | 184 | Endpoint_SelectEndpoint(ep); |
185 | } | 185 | } |
186 | #else | ||
187 | static void Console_Task(void) | ||
188 | { | ||
189 | } | ||
190 | #endif | 186 | #endif |
191 | 187 | ||
192 | 188 | ||
@@ -216,7 +212,7 @@ void EVENT_USB_Device_Disconnect(void) | |||
216 | print("[D]"); | 212 | print("[D]"); |
217 | /* For battery powered device */ | 213 | /* For battery powered device */ |
218 | USB_IsInitialized = false; | 214 | USB_IsInitialized = false; |
219 | /* TODO: This doesn't work. After several plug in/outs can not be enumerated. | 215 | /* TODO: This doesn't work. After several plug in/outs can not be enumerated. |
220 | if (USB_IsInitialized) { | 216 | if (USB_IsInitialized) { |
221 | USB_Disable(); // Disable all interrupts | 217 | USB_Disable(); // Disable all interrupts |
222 | USB_Controller_Enable(); | 218 | USB_Controller_Enable(); |
@@ -313,7 +309,7 @@ void EVENT_USB_Device_ConfigurationChanged(void) | |||
313 | 309 | ||
314 | #ifdef MIDI_ENABLE | 310 | #ifdef MIDI_ENABLE |
315 | ConfigSuccess &= Endpoint_ConfigureEndpoint(MIDI_STREAM_IN_EPADDR, EP_TYPE_BULK, MIDI_STREAM_EPSIZE, ENDPOINT_BANK_SINGLE); | 311 | ConfigSuccess &= Endpoint_ConfigureEndpoint(MIDI_STREAM_IN_EPADDR, EP_TYPE_BULK, MIDI_STREAM_EPSIZE, ENDPOINT_BANK_SINGLE); |
316 | ConfigSuccess &= Endpoint_ConfigureEndpoint(MIDI_STREAM_OUT_EPADDR, EP_TYPE_BULK, MIDI_STREAM_EPSIZE, ENDPOINT_BANK_SINGLE); | 312 | ConfigSuccess &= Endpoint_ConfigureEndpoint(MIDI_STREAM_OUT_EPADDR, EP_TYPE_BULK, MIDI_STREAM_EPSIZE, ENDPOINT_BANK_SINGLE); |
317 | #endif | 313 | #endif |
318 | } | 314 | } |
319 | 315 | ||
@@ -439,7 +435,7 @@ void EVENT_USB_Device_ControlRequest(void) | |||
439 | } | 435 | } |
440 | 436 | ||
441 | /******************************************************************************* | 437 | /******************************************************************************* |
442 | * Host driver | 438 | * Host driver |
443 | ******************************************************************************/ | 439 | ******************************************************************************/ |
444 | static uint8_t keyboard_leds(void) | 440 | static uint8_t keyboard_leds(void) |
445 | { | 441 | { |
@@ -563,7 +559,7 @@ static void send_consumer(uint16_t data) | |||
563 | bluefruit_serial_send(0x00); | 559 | bluefruit_serial_send(0x00); |
564 | bluefruit_serial_send(0x02); | 560 | bluefruit_serial_send(0x02); |
565 | bluefruit_serial_send((bitmap>>8)&0xFF); | 561 | bluefruit_serial_send((bitmap>>8)&0xFF); |
566 | bluefruit_serial_send(bitmap&0xFF); | 562 | bluefruit_serial_send(bitmap&0xFF); |
567 | bluefruit_serial_send(0x00); | 563 | bluefruit_serial_send(0x00); |
568 | bluefruit_serial_send(0x00); | 564 | bluefruit_serial_send(0x00); |
569 | bluefruit_serial_send(0x00); | 565 | bluefruit_serial_send(0x00); |