diff options
Diffstat (limited to 'quantum/quantum.c')
| -rw-r--r-- | quantum/quantum.c | 43 |
1 files changed, 27 insertions, 16 deletions
diff --git a/quantum/quantum.c b/quantum/quantum.c index 582f8920b..4f4cee4e9 100644 --- a/quantum/quantum.c +++ b/quantum/quantum.c | |||
| @@ -1,3 +1,19 @@ | |||
| 1 | /* Copyright 2016-2017 Jack Humbert | ||
| 2 | * | ||
| 3 | * This program is free software: you can redistribute it and/or modify | ||
| 4 | * it under the terms of the GNU General Public License as published by | ||
| 5 | * the Free Software Foundation, either version 2 of the License, or | ||
| 6 | * (at your option) any later version. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope that it will be useful, | ||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | * GNU General Public License for more details. | ||
| 12 | * | ||
| 13 | * You should have received a copy of the GNU General Public License | ||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 15 | */ | ||
| 16 | |||
| 1 | #include "quantum.h" | 17 | #include "quantum.h" |
| 2 | #ifdef PROTOCOL_LUFA | 18 | #ifdef PROTOCOL_LUFA |
| 3 | #include "outputselect.h" | 19 | #include "outputselect.h" |
| @@ -98,8 +114,8 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { | |||
| 98 | 114 | ||
| 99 | void reset_keyboard(void) { | 115 | void reset_keyboard(void) { |
| 100 | clear_keyboard(); | 116 | clear_keyboard(); |
| 101 | #ifdef AUDIO_ENABLE | 117 | #if defined(AUDIO_ENABLE) || (defined(MIDI_ENABLE) && defined(MIDI_ENABLE_BASIC)) |
| 102 | stop_all_notes(); | 118 | music_all_notes_off(); |
| 103 | shutdown_user(); | 119 | shutdown_user(); |
| 104 | #endif | 120 | #endif |
| 105 | wait_ms(250); | 121 | wait_ms(250); |
| @@ -119,7 +135,7 @@ void reset_keyboard(void) { | |||
| 119 | #endif | 135 | #endif |
| 120 | 136 | ||
| 121 | static bool shift_interrupted[2] = {0, 0}; | 137 | static bool shift_interrupted[2] = {0, 0}; |
| 122 | static uint16_t scs_timer = 0; | 138 | static uint16_t scs_timer[2] = {0, 0}; |
| 123 | 139 | ||
| 124 | bool process_record_quantum(keyrecord_t *record) { | 140 | bool process_record_quantum(keyrecord_t *record) { |
| 125 | 141 | ||
| @@ -153,10 +169,13 @@ bool process_record_quantum(keyrecord_t *record) { | |||
| 153 | 169 | ||
| 154 | if (!( | 170 | if (!( |
| 155 | process_record_kb(keycode, record) && | 171 | process_record_kb(keycode, record) && |
| 156 | #ifdef MIDI_ENABLE | 172 | #if defined(MIDI_ENABLE) && defined(MIDI_ADVANCED) |
| 157 | process_midi(keycode, record) && | 173 | process_midi(keycode, record) && |
| 158 | #endif | 174 | #endif |
| 159 | #ifdef AUDIO_ENABLE | 175 | #ifdef AUDIO_ENABLE |
| 176 | process_audio(keycode, record) && | ||
| 177 | #endif | ||
| 178 | #if defined(AUDIO_ENABLE) || (defined(MIDI_ENABLE) && defined(MIDI_BASIC)) | ||
| 160 | process_music(keycode, record) && | 179 | process_music(keycode, record) && |
| 161 | #endif | 180 | #endif |
| 162 | #ifdef TAP_DANCE_ENABLE | 181 | #ifdef TAP_DANCE_ENABLE |
| @@ -294,14 +313,6 @@ bool process_record_quantum(keyrecord_t *record) { | |||
| 294 | return false; | 313 | return false; |
| 295 | break; | 314 | break; |
| 296 | #endif | 315 | #endif |
| 297 | #ifdef ADAFRUIT_BLE_ENABLE | ||
| 298 | case OUT_BLE: | ||
| 299 | if (record->event.pressed) { | ||
| 300 | set_output(OUTPUT_ADAFRUIT_BLE); | ||
| 301 | } | ||
| 302 | return false; | ||
| 303 | break; | ||
| 304 | #endif | ||
| 305 | #endif | 316 | #endif |
| 306 | case MAGIC_SWAP_CONTROL_CAPSLOCK ... MAGIC_TOGGLE_NKRO: | 317 | case MAGIC_SWAP_CONTROL_CAPSLOCK ... MAGIC_TOGGLE_NKRO: |
| 307 | if (record->event.pressed) { | 318 | if (record->event.pressed) { |
| @@ -384,7 +395,7 @@ bool process_record_quantum(keyrecord_t *record) { | |||
| 384 | case KC_LSPO: { | 395 | case KC_LSPO: { |
| 385 | if (record->event.pressed) { | 396 | if (record->event.pressed) { |
| 386 | shift_interrupted[0] = false; | 397 | shift_interrupted[0] = false; |
| 387 | scs_timer = timer_read (); | 398 | scs_timer[0] = timer_read (); |
| 388 | register_mods(MOD_BIT(KC_LSFT)); | 399 | register_mods(MOD_BIT(KC_LSFT)); |
| 389 | } | 400 | } |
| 390 | else { | 401 | else { |
| @@ -394,7 +405,7 @@ bool process_record_quantum(keyrecord_t *record) { | |||
| 394 | shift_interrupted[1] = true; | 405 | shift_interrupted[1] = true; |
| 395 | } | 406 | } |
| 396 | #endif | 407 | #endif |
| 397 | if (!shift_interrupted[0] && timer_elapsed(scs_timer) < TAPPING_TERM) { | 408 | if (!shift_interrupted[0] && timer_elapsed(scs_timer[0]) < TAPPING_TERM) { |
| 398 | register_code(LSPO_KEY); | 409 | register_code(LSPO_KEY); |
| 399 | unregister_code(LSPO_KEY); | 410 | unregister_code(LSPO_KEY); |
| 400 | } | 411 | } |
| @@ -407,7 +418,7 @@ bool process_record_quantum(keyrecord_t *record) { | |||
| 407 | case KC_RSPC: { | 418 | case KC_RSPC: { |
| 408 | if (record->event.pressed) { | 419 | if (record->event.pressed) { |
| 409 | shift_interrupted[1] = false; | 420 | shift_interrupted[1] = false; |
| 410 | scs_timer = timer_read (); | 421 | scs_timer[1] = timer_read (); |
| 411 | register_mods(MOD_BIT(KC_RSFT)); | 422 | register_mods(MOD_BIT(KC_RSFT)); |
| 412 | } | 423 | } |
| 413 | else { | 424 | else { |
| @@ -417,7 +428,7 @@ bool process_record_quantum(keyrecord_t *record) { | |||
| 417 | shift_interrupted[1] = true; | 428 | shift_interrupted[1] = true; |
| 418 | } | 429 | } |
| 419 | #endif | 430 | #endif |
| 420 | if (!shift_interrupted[1] && timer_elapsed(scs_timer) < TAPPING_TERM) { | 431 | if (!shift_interrupted[1] && timer_elapsed(scs_timer[1]) < TAPPING_TERM) { |
| 421 | register_code(RSPC_KEY); | 432 | register_code(RSPC_KEY); |
| 422 | unregister_code(RSPC_KEY); | 433 | unregister_code(RSPC_KEY); |
| 423 | } | 434 | } |
