diff options
Diffstat (limited to 'keyboard/preonic')
-rw-r--r-- | keyboard/preonic/Makefile | 2 | ||||
-rw-r--r-- | keyboard/preonic/keymaps/default/keymap.c | 78 |
2 files changed, 25 insertions, 55 deletions
diff --git a/keyboard/preonic/Makefile b/keyboard/preonic/Makefile index 3504e27201..c2648d2294 100644 --- a/keyboard/preonic/Makefile +++ b/keyboard/preonic/Makefile @@ -133,7 +133,7 @@ OPT_DEFS += -DBOOTLOADER_SIZE=4096 BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) MOUSEKEY_ENABLE = yes # Mouse keys(+4700) EXTRAKEY_ENABLE = yes # Audio control and System control(+450) -CONSOLE_ENABLE = no # Console for debug(+400) +CONSOLE_ENABLE = on # Console for debug(+400) COMMAND_ENABLE = yes # Commands for debug and configuration NKRO_ENABLE = no # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality diff --git a/keyboard/preonic/keymaps/default/keymap.c b/keyboard/preonic/keymaps/default/keymap.c index 144e9c3086..9ee803b063 100644 --- a/keyboard/preonic/keymaps/default/keymap.c +++ b/keyboard/preonic/keymaps/default/keymap.c @@ -3,6 +3,7 @@ #include "eeconfig.h" #ifdef AUDIO_ENABLE #include "audio.h" + #include "song_list.h" #endif // Each layer gets a name for readability, which is then used in the keymap matrix below. @@ -15,7 +16,7 @@ #define _LOWER 3 #define _RAISE 4 #define _MUSIC 5 -#define _ADJUST 6 +#define _ADJUST 16 // Macro name shortcuts #define QWERTY M(_QWERTY) @@ -142,6 +143,17 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { {_______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY} }, +/* Music (reserved for process_action_user) + * + */ +[_MUSIC] = { + {XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX}, + {XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX}, + {XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX}, + {XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX}, + {XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, LOWER, XXXXXXX, XXXXXXX, RAISE, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX} +}, + /* Adjust (Lower + Raise) * ,-----------------------------------------------------------------------------------. * | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | @@ -161,19 +173,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { {_______, _______, _______, AUD_ON, AUD_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, _______, _______}, {_______, _______, _______, MUS_ON, MUS_OFF, _______, _______, _______, _______, _______, _______, _______}, {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______} -}, - -/* Music (reserved for process_action_user) - * - */ -[_MUSIC] = { - {XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX}, - {XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX}, - {XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX}, - {XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX}, - {XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, LOWER, XXXXXXX, XXXXXXX, RAISE, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX} } + }; const uint16_t PROGMEM fn_actions[] = { @@ -188,43 +190,10 @@ float start_up[][2] = { {440.0*pow(2.0,(26)/12.0), 8} }; -float tone_qwerty[][2] = { - {440.0*pow(2.0,(23)/12.0), 8}, - {440.0*pow(2.0,(24)/12.0), 8}, - {0, 4}, - {440.0*pow(2.0,(31)/12.0), 16} -}; - -float tone_colemak[][2] = { - {440.0*pow(2.0,(23)/12.0), 8}, - {440.0*pow(2.0,(24)/12.0), 8}, - {0, 4}, - {440.0*pow(2.0,(31)/12.0), 12}, - {0, 4}, - {440.0*pow(2.0,(35)/12.0), 12} -}; - -float tone_dvorak[][2] = { - {440.0*pow(2.0,(23)/12.0), 8}, - {440.0*pow(2.0,(24)/12.0), 8}, - {0, 4}, - {440.0*pow(2.0,(31)/12.0), 8}, - {0, 4}, - {440.0*pow(2.0,(33)/12.0), 8}, - {0, 4}, - {440.0*pow(2.0,(31)/12.0), 8} -}; +float tone_qwerty[][2] = SONG(QWERTY_SOUND); +float tone_dvorak[][2] = SONG(DVORAK_SOUND); +float tone_colemak[][2] = SONG(COLEMAK_SOUND); -float tone_music[][2] = { - {440.0*pow(2.0,(12)/12.0), 8}, - {440.0*pow(2.0,(14)/12.0), 8}, - {440.0*pow(2.0,(16)/12.0), 8}, - {440.0*pow(2.0,(17)/12.0), 8}, - {440.0*pow(2.0,(19)/12.0), 8}, - {440.0*pow(2.0,(21)/12.0), 8}, - {440.0*pow(2.0,(23)/12.0), 8}, - {440.0*pow(2.0,(24)/12.0), 8} -}; float music_scale[][2] = SONG(MUSIC_SCALE_SOUND); float goodbye[][2] = SONG(GOODBYE_SOUND); #endif @@ -315,7 +284,6 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) case 9: if (record->event.pressed) { #ifdef AUDIO_ENABLE - init_notes(); PLAY_NOTE_ARRAY(music_scale, false, 0); layer_on(_MUSIC); #endif @@ -341,11 +309,13 @@ void process_action_user(keyrecord_t *record) { } void matrix_init_user(void) { - #ifdef AUDIO_ENABLE - init_notes(); - _delay_ms(10); - PLAY_NOTE_ARRAY(start_up, false, 0); - #endif + // audio_init(); + play_startup_tone(); +} + +void play_startup_tone() +{ + PLAY_NOTE_ARRAY(music_scale, false, 0); } void play_goodbye_tone() |