aboutsummaryrefslogtreecommitdiff
path: root/quantum/quantum.c
diff options
context:
space:
mode:
Diffstat (limited to 'quantum/quantum.c')
-rw-r--r--quantum/quantum.c123
1 files changed, 3 insertions, 120 deletions
diff --git a/quantum/quantum.c b/quantum/quantum.c
index 0fb798a74..fcedf0bc1 100644
--- a/quantum/quantum.c
+++ b/quantum/quantum.c
@@ -24,10 +24,6 @@
24#include "outputselect.h" 24#include "outputselect.h"
25#endif 25#endif
26 26
27#ifndef TAPPING_TERM
28#define TAPPING_TERM 200
29#endif
30
31#ifndef BREATHING_PERIOD 27#ifndef BREATHING_PERIOD
32#define BREATHING_PERIOD 6 28#define BREATHING_PERIOD 6
33#endif 29#endif
@@ -196,30 +192,6 @@ void reset_keyboard(void) {
196 bootloader_jump(); 192 bootloader_jump();
197} 193}
198 194
199// Shift / paren setup
200
201#ifndef LSPO_KEY
202 #define LSPO_KEY KC_9
203#endif
204#ifndef RSPC_KEY
205 #define RSPC_KEY KC_0
206#endif
207
208#ifndef LSPO_MOD
209 #define LSPO_MOD KC_LSFT
210#endif
211#ifndef RSPC_MOD
212 #define RSPC_MOD KC_RSFT
213#endif
214
215// Shift / Enter setup
216#ifndef SFTENT_KEY
217 #define SFTENT_KEY KC_ENT
218#endif
219
220static bool shift_interrupted[2] = {0, 0};
221static uint16_t scs_timer[2] = {0, 0};
222
223/* true if the last press of GRAVE_ESC was shifted (i.e. GUI or SHIFT were pressed), false otherwise. 195/* true if the last press of GRAVE_ESC was shifted (i.e. GUI or SHIFT were pressed), false otherwise.
224 * Used to ensure that the correct keycode is released if the key is released. 196 * Used to ensure that the correct keycode is released if the key is released.
225 */ 197 */
@@ -329,6 +301,9 @@ bool process_record_quantum(keyrecord_t *record) {
329 #ifdef TERMINAL_ENABLE 301 #ifdef TERMINAL_ENABLE
330 process_terminal(keycode, record) && 302 process_terminal(keycode, record) &&
331 #endif 303 #endif
304 #ifdef SPACE_CADET_ENABLE
305 process_space_cadet(keycode, record) &&
306 #endif
332 true)) { 307 true)) {
333 return false; 308 return false;
334 } 309 }
@@ -685,92 +660,6 @@ bool process_record_quantum(keyrecord_t *record) {
685 return false; 660 return false;
686 } 661 }
687 break; 662 break;
688 case KC_LSPO: {
689 if (record->event.pressed) {
690 shift_interrupted[0] = false;
691 scs_timer[0] = timer_read ();
692 register_mods(MOD_BIT(KC_LSFT));
693 }
694 else {
695 #ifdef DISABLE_SPACE_CADET_ROLLOVER
696 if (get_mods() & MOD_BIT(RSPC_MOD)) {
697 shift_interrupted[0] = true;
698 shift_interrupted[1] = true;
699 }
700 #endif
701 if (!shift_interrupted[0] && timer_elapsed(scs_timer[0]) < TAPPING_TERM) {
702 #ifdef DISABLE_SPACE_CADET_MODIFIER
703 unregister_mods(MOD_BIT(KC_LSFT));
704 #else
705 if( LSPO_MOD != KC_LSFT ){
706 unregister_mods(MOD_BIT(KC_LSFT));
707 register_mods(MOD_BIT(LSPO_MOD));
708 }
709 #endif
710 register_code(LSPO_KEY);
711 unregister_code(LSPO_KEY);
712 #ifndef DISABLE_SPACE_CADET_MODIFIER
713 if( LSPO_MOD != KC_LSFT ){
714 unregister_mods(MOD_BIT(LSPO_MOD));
715 }
716 #endif
717 }
718 unregister_mods(MOD_BIT(KC_LSFT));
719 }
720 return false;
721 }
722
723 case KC_RSPC: {
724 if (record->event.pressed) {
725 shift_interrupted[1] = false;
726 scs_timer[1] = timer_read ();
727 register_mods(MOD_BIT(KC_RSFT));
728 }
729 else {
730 #ifdef DISABLE_SPACE_CADET_ROLLOVER
731 if (get_mods() & MOD_BIT(LSPO_MOD)) {
732 shift_interrupted[0] = true;
733 shift_interrupted[1] = true;
734 }
735 #endif
736 if (!shift_interrupted[1] && timer_elapsed(scs_timer[1]) < TAPPING_TERM) {
737 #ifdef DISABLE_SPACE_CADET_MODIFIER
738 unregister_mods(MOD_BIT(KC_RSFT));
739 #else
740 if( RSPC_MOD != KC_RSFT ){
741 unregister_mods(MOD_BIT(KC_RSFT));
742 register_mods(MOD_BIT(RSPC_MOD));
743 }
744 #endif
745 register_code(RSPC_KEY);
746 unregister_code(RSPC_KEY);
747 #ifndef DISABLE_SPACE_CADET_MODIFIER
748 if ( RSPC_MOD != KC_RSFT ){
749 unregister_mods(MOD_BIT(RSPC_MOD));
750 }
751 #endif
752 }
753 unregister_mods(MOD_BIT(KC_RSFT));
754 }
755 return false;
756 }
757
758 case KC_SFTENT: {
759 if (record->event.pressed) {
760 shift_interrupted[1] = false;
761 scs_timer[1] = timer_read ();
762 register_mods(MOD_BIT(KC_RSFT));
763 }
764 else if (!shift_interrupted[1] && timer_elapsed(scs_timer[1]) < TAPPING_TERM) {
765 unregister_mods(MOD_BIT(KC_RSFT));
766 register_code(SFTENT_KEY);
767 unregister_code(SFTENT_KEY);
768 }
769 else {
770 unregister_mods(MOD_BIT(KC_RSFT));
771 }
772 return false;
773 }
774 663
775 case GRAVE_ESC: { 664 case GRAVE_ESC: {
776 uint8_t shifted = get_mods() & ((MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT) 665 uint8_t shifted = get_mods() & ((MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT)
@@ -825,12 +714,6 @@ bool process_record_quantum(keyrecord_t *record) {
825 return false; 714 return false;
826 } 715 }
827#endif 716#endif
828
829 default: {
830 shift_interrupted[0] = true;
831 shift_interrupted[1] = true;
832 break;
833 }
834 } 717 }
835 718
836 return process_action_kb(record); 719 return process_action_kb(record);