aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--keyboard/atomic/keymaps/pvc/keymap.c373
-rw-r--r--keyboard/atomic/keymaps/pvc/makefile.mk2
-rw-r--r--quantum/audio.c55
-rw-r--r--quantum/audio.h6
-rw-r--r--quantum/keymap_common.c1
-rw-r--r--quantum/musical_notes.h49
-rw-r--r--quantum/song_list.h18
-rw-r--r--tmk_core/common/action.c8
-rw-r--r--tmk_core/common/action_layer.c12
-rw-r--r--tmk_core/common/action_macro.c8
-rw-r--r--tmk_core/common/action_tapping.c11
-rw-r--r--tmk_core/common/command.c25
-rw-r--r--tmk_core/common/print.h12
-rw-r--r--tmk_core/protocol/lufa/lufa.c18
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
89float start_up[][2] = SONG(ODE_TO_JOY);
81 90
91float tone_lw[][2] = {
82 92
93 Q__NOTE(_C4 ) ,
94 Q__NOTE(_CS4 ) ,
95 Q__NO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OTE(_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
201float tone_rs[][2] = { 193float tone_rs[][2] = SONG(ROCK_A_BYE_BABY);
202Q_NOTE(_A4 ) , 194
203Q_NOTE(_A4 ) , 195void matrix_init_user(void) {
204Q_NOTE(_A4 ) , 196 init_notes();
205Q_NOTE(_A4 ) , 197 PLAY_NOTE_ARRAY(start_up, false, STACCATO);
206Q_NOTE(_AS8 ) , 198 println("Matrix Init");
207Q_NOTE(_B8 ) , 199}
208};
209 200
210#endif 201#endif
211 202
203
212void update_quad_layer(uint8_t layer1, uint8_t layer2, uint8_t layer3, uint8_t layer4, bool order) 204void 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
241const uint16_t PROGMEM fn_actions[] = { 233const 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
246const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) 237const 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:
284float start_up[][2] = { 269 if (record->event.pressed) {
285Q_NOTE(_E4 ) , 270 layer_on(_FN);
286Q_NOTE(_E4 ) , 271 } else {
287Q_NOTE(_F4 ) , 272 layer_off(_FN);
288Q_NOTE(_G4 ) , 273 }
289Q_NOTE(_G4 ) , 274 break;
290Q_NOTE(_F4 ) ,
291Q_NOTE(_E4 ) ,
292Q_NOTE(_D4 ) ,
293Q_NOTE(_C4 ) ,
294Q_NOTE(_C4 ) ,
295Q_NOTE(_D4 ) ,
296Q_NOTE(_E4 ) ,
297H_NOTE(_E4 ) ,
298Q_NOTE(_D4 ) ,
299H_NOTE(_D4 ) ,
300};
301#endif
302 275
303void 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 @@
1BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000) 1BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000)
2MOUSEKEY_ENABLE = yes # Mouse keys(+4700) 2MOUSEKEY_ENABLE = yes # Mouse keys(+4700)
3EXTRAKEY_ENABLE = yes # Audio control and System control(+450) 3EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
4CONSOLE_ENABLE = yes # Console for debug(+400) 4CONSOLE_ENABLE = no # Console for debug(+400)
5COMMAND_ENABLE = yes # Commands for debug and configuration 5COMMAND_ENABLE = yes # Commands for debug and configuration
6NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work 6NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
7BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality 7BACKLIGHT_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;
57bool note = false; 57bool note = false;
58float note_frequency = 0; 58float note_frequency = 0;
59float note_length = 0; 59float note_length = 0;
60float note_tempo = TEMPO_DEFAULT;
61float note_timbre = TIMBRE_DEFAULT;
60uint16_t note_position = 0; 62uint16_t note_position = 0;
61float (* notes_pointer)[][2]; 63float (* notes_pointer)[][2];
62uint8_t notes_length; 64uint8_t notes_count;
63bool notes_repeat; 65bool notes_repeat;
64float notes_rest; 66float notes_rest;
65bool note_resting = false; 67bool 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
347void play_notes(float (*np)[][2], uint8_t n_length, bool n_repeat, float n_rest) { 350void play_notes(float (*np)[][2], uint8_t n_count, bool n_repeat, float n_rest) {
348 351
349if (audio_config.enable) { 352if (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
447void set_timbre(float timbre)
448{
449 note_timbre = timbre;
450}
451
452void set_tempo(float tempo)
453{
454 note_tempo = tempo;
455}
456
457void decrease_tempo(uint8_t tempo_change)
458{
459 note_tempo += (float) tempo_change;
460}
461
462void 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);
24void stop_note(double freq); 24void stop_note(double freq);
25void stop_all_notes(void); 25void stop_all_notes(void);
26void init_notes(void); 26void init_notes(void);
27void play_notes(float (*np)[][2], uint8_t n_length, bool n_repeat, float n_rest); 27void play_notes(float (*np)[][2], uint8_t n_count, bool n_repeat, float n_rest);
28 28
29void set_timbre(float timbre);
30void set_tempo(float tempo);
31void increase_tempo(uint8_t tempo_change);
32void 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
30extern keymap_config_t keymap_config; 31extern 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
37void action_exec(keyevent_t event) 37void 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 */
17uint32_t default_layer_state = 0; 17uint32_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 */
58uint32_t layer_state = 0; 58uint32_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))
327bool waiting_buffer_has_anykey_pressed(void) 328bool 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
252static void print_eeconfig(void) 252static 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
286static bool command_common(uint8_t code) 290static 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
552static void mousekey_param_print(void) 556static 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
187static 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 ******************************************************************************/
444static uint8_t keyboard_leds(void) 440static 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);