summaryrefslogtreecommitdiff
path: root/quantum
diff options
context:
space:
mode:
Diffstat (limited to 'quantum')
-rw-r--r--quantum/process_keycode/process_chording.c76
-rw-r--r--quantum/process_keycode/process_chording.h32
-rw-r--r--quantum/process_keycode/process_leader.c2
-rw-r--r--quantum/quantum.c7
-rw-r--r--quantum/quantum.h7
-rw-r--r--quantum/quantum_keycodes.h6
6 files changed, 5 insertions, 125 deletions
diff --git a/quantum/process_keycode/process_chording.c b/quantum/process_keycode/process_chording.c
deleted file mode 100644
index 6c6ebe300a..0000000000
--- a/quantum/process_keycode/process_chording.c
+++ /dev/null
@@ -1,76 +0,0 @@
-/* Copyright 2016 Jack Humbert
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "process_chording.h"
-
-bool keys_chord(uint8_t keys[]) {
- uint8_t keys_size = sizeof(keys)/sizeof(keys[0]);
- bool pass = true;
- uint8_t in = 0;
- for (uint8_t i = 0; i < chord_key_count; i++) {
- bool found = false;
- for (uint8_t j = 0; j < keys_size; j++) {
- if (chord_keys[i] == (keys[j] & 0xFF)) {
- in++; // detects key in chord
- found = true;
- break;
- }
- }
- if (found)
- continue;
- if (chord_keys[i] != 0) {
- pass = false; // makes sure rest are blank
- }
- }
- return (pass && (in == keys_size));
-}
-
-bool process_chording(uint16_t keycode, keyrecord_t *record) {
- if (keycode >= QK_CHORDING && keycode <= QK_CHORDING_MAX) {
- if (record->event.pressed) {
- if (!chording) {
- chording = true;
- for (uint8_t i = 0; i < CHORDING_MAX; i++)
- chord_keys[i] = 0;
- chord_key_count = 0;
- chord_key_down = 0;
- }
- chord_keys[chord_key_count] = (keycode & 0xFF);
- chord_key_count++;
- chord_key_down++;
- return false;
- } else {
- if (chording) {
- chord_key_down--;
- if (chord_key_down == 0) {
- chording = false;
- // Chord Dictionary
- if (keys_chord((uint8_t[]){KC_ENTER, KC_SPACE})) {
- register_code(KC_A);
- unregister_code(KC_A);
- return false;
- }
- for (uint8_t i = 0; i < chord_key_count; i++) {
- register_code(chord_keys[i]);
- unregister_code(chord_keys[i]);
- return false;
- }
- }
- }
- }
- }
- return true;
-}
diff --git a/quantum/process_keycode/process_chording.h b/quantum/process_keycode/process_chording.h
deleted file mode 100644
index 8c0f4862a8..0000000000
--- a/quantum/process_keycode/process_chording.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/* Copyright 2016 Jack Humbert
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef PROCESS_CHORDING_H
-#define PROCESS_CHORDING_H
-
-#include "quantum.h"
-
-// Chording stuff
-#define CHORDING_MAX 4
-bool chording = false;
-
-uint8_t chord_keys[CHORDING_MAX] = {0};
-uint8_t chord_key_count = 0;
-uint8_t chord_key_down = 0;
-
-bool process_chording(uint16_t keycode, keyrecord_t *record);
-
-#endif
diff --git a/quantum/process_keycode/process_leader.c b/quantum/process_keycode/process_leader.c
index c87ef115af..eddbf71f70 100644
--- a/quantum/process_keycode/process_leader.c
+++ b/quantum/process_keycode/process_leader.c
@@ -14,7 +14,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef DISABLE_LEADER
+#ifdef LEADER_ENABLE
#include "process_leader.h"
diff --git a/quantum/quantum.c b/quantum/quantum.c
index 9d352a94cf..9bf91eb865 100644
--- a/quantum/quantum.c
+++ b/quantum/quantum.c
@@ -196,7 +196,7 @@ bool process_record_quantum(keyrecord_t *record) {
keypos_t key = record->event.key;
uint16_t keycode;
- #if !defined(NO_ACTION_LAYER) && defined(PREVENT_STUCK_MODIFIERS)
+ #if !defined(NO_ACTION_LAYER) && !defined(STRICT_LAYER_RELEASE)
/* TODO: Use store_or_get_action() or a similar function. */
if (!disable_action_cache) {
uint8_t layer;
@@ -251,12 +251,9 @@ bool process_record_quantum(keyrecord_t *record) {
#ifdef TAP_DANCE_ENABLE
process_tap_dance(keycode, record) &&
#endif
- #ifndef DISABLE_LEADER
+ #ifdef LEADER_ENABLE
process_leader(keycode, record) &&
#endif
- #ifndef DISABLE_CHORDING
- process_chording(keycode, record) &&
- #endif
#ifdef COMBO_ENABLE
process_combo(keycode, record) &&
#endif
diff --git a/quantum/quantum.h b/quantum/quantum.h
index d1f761f17a..7cf16d81e6 100644
--- a/quantum/quantum.h
+++ b/quantum/quantum.h
@@ -89,15 +89,10 @@ extern uint32_t default_layer_state;
#include "process_music.h"
#endif
-#ifndef DISABLE_LEADER
+#ifdef LEADER_ENABLE
#include "process_leader.h"
#endif
-#define DISABLE_CHORDING
-#ifndef DISABLE_CHORDING
- #include "process_chording.h"
-#endif
-
#ifdef UNICODE_ENABLE
#include "process_unicode.h"
#endif
diff --git a/quantum/quantum_keycodes.h b/quantum/quantum_keycodes.h
index 0ecc293a82..3b87954960 100644
--- a/quantum/quantum_keycodes.h
+++ b/quantum/quantum_keycodes.h
@@ -63,10 +63,6 @@ enum quantum_keycodes {
QK_ONE_SHOT_LAYER_MAX = 0x54FF,
QK_ONE_SHOT_MOD = 0x5500,
QK_ONE_SHOT_MOD_MAX = 0x55FF,
-#ifndef DISABLE_CHORDING
- QK_CHORDING = 0x5600,
- QK_CHORDING_MAX = 0x56FF,
-#endif
QK_TAP_DANCE = 0x5700,
QK_TAP_DANCE_MAX = 0x57FF,
QK_LAYER_TAP_TOGGLE = 0x5800,
@@ -123,7 +119,7 @@ enum quantum_keycodes {
GRAVE_ESC,
// Leader key
-#ifndef DISABLE_LEADER
+#ifdef LEADER_ENABLE
KC_LEAD,
#endif