aboutsummaryrefslogtreecommitdiff
path: root/quantum
diff options
context:
space:
mode:
authorDrashna Jaelre <drashna@live.com>2021-03-01 08:57:02 -0800
committerGitHub <noreply@github.com>2021-03-01 08:57:02 -0800
commit0e984b6e7e216a62df0b5d53f6a8f0d4bc13dca3 (patch)
tree1e85b1d15a9ea6ad86fcb6ae8d084f926dd11ab8 /quantum
parent86f6f682744b81bba1003e555f902af78dcdaad4 (diff)
downloadqmk_firmware-0e984b6e7e216a62df0b5d53f6a8f0d4bc13dca3.tar.gz
qmk_firmware-0e984b6e7e216a62df0b5d53f6a8f0d4bc13dca3.zip
Add ability to toggle One Shot functionality (#4198)
Co-authored-by: Nick Brassel <nick@tzarc.org> Co-authored-by: Ryan <fauxpark@gmail.com>
Diffstat (limited to 'quantum')
-rw-r--r--quantum/keycode_config.h1
-rw-r--r--quantum/quantum.c11
-rw-r--r--quantum/quantum_keycodes.h9
3 files changed, 21 insertions, 0 deletions
diff --git a/quantum/keycode_config.h b/quantum/keycode_config.h
index f878168c5..d7e334fdc 100644
--- a/quantum/keycode_config.h
+++ b/quantum/keycode_config.h
@@ -37,6 +37,7 @@ typedef union {
37 bool nkro : 1; 37 bool nkro : 1;
38 bool swap_lctl_lgui : 1; 38 bool swap_lctl_lgui : 1;
39 bool swap_rctl_rgui : 1; 39 bool swap_rctl_rgui : 1;
40 bool oneshot_disable : 1;
40 }; 41 };
41} keymap_config_t; 42} keymap_config_t;
42 43
diff --git a/quantum/quantum.c b/quantum/quantum.c
index ef751a233..78601ce6b 100644
--- a/quantum/quantum.c
+++ b/quantum/quantum.c
@@ -319,6 +319,17 @@ bool process_record_quantum(keyrecord_t *record) {
319 set_output(OUTPUT_BLUETOOTH); 319 set_output(OUTPUT_BLUETOOTH);
320 return false; 320 return false;
321#endif 321#endif
322#ifndef NO_ACTION_ONESHOT
323 case ONESHOT_TOGGLE:
324 oneshot_toggle();
325 break;
326 case ONESHOT_ENABLE:
327 oneshot_enable();
328 break;
329 case ONESHOT_DISABLE:
330 oneshot_disable();
331 break;
332#endif
322 } 333 }
323 } 334 }
324 335
diff --git a/quantum/quantum_keycodes.h b/quantum/quantum_keycodes.h
index e0f5dbc61..63945a17c 100644
--- a/quantum/quantum_keycodes.h
+++ b/quantum/quantum_keycodes.h
@@ -578,6 +578,10 @@ enum quantum_keycodes {
578 578
579#endif 579#endif
580 580
581 ONESHOT_ENABLE,
582 ONESHOT_DISABLE,
583 ONESHOT_TOGGLE,
584
581 // always leave at the end 585 // always leave at the end
582 SAFE_RANGE 586 SAFE_RANGE
583}; 587};
@@ -885,3 +889,8 @@ enum quantum_keycodes {
885#define DM_RSTP DYN_REC_STOP 889#define DM_RSTP DYN_REC_STOP
886#define DM_PLY1 DYN_MACRO_PLAY1 890#define DM_PLY1 DYN_MACRO_PLAY1
887#define DM_PLY2 DYN_MACRO_PLAY2 891#define DM_PLY2 DYN_MACRO_PLAY2
892
893// One Shot toggle
894#define OS_TOGG ONESHOT_TOGGLE
895#define OS_ON ONESHOT_ENABLE
896#define OS_OFF ONESHOT_DISABLE