Skip to content

Commit

Permalink
Fix behaviour of shift for ginny plus keymap fixes
Browse files Browse the repository at this point in the history
Keymap fixes like:
- ?/, ([, )], !@
- Make space part of word chords

Shift can now be held between chifted chords, words have only first char
shifted. Shift and chord order no longer produce different results (i.e. they
will always end up shifted)

Code should be transferable to other mods allowing them to be held and apply to
chords *or* be used in a chord definition to override.

Hold behavior doesn't repeat presses, processes chord, doesn't clear keyboard
until release; this allows the OS to define repeat behaviour after hold is
initialised.
  • Loading branch information
obosob committed Feb 6, 2020
1 parent 6b67eb5 commit 28ddd6c
Show file tree
Hide file tree
Showing 9 changed files with 576 additions and 561 deletions.
591 changes: 301 additions & 290 deletions keyboards/gboards/engine/engine.c

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions keyboards/gboards/engine/engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,5 +96,4 @@ void CLICK_MOUSE(uint8_t);
// Shift to internal representation
// i.e) S(teno)R(ight)F
#define STN(n) ((C_SIZE)1<<n)
//#define ENGINE_HOOK(keycode, chord) case keycode: pr ? (cChord |= (chord)): (cChord &= ~(chord)); break;
#define ENGINE_HOOK(keycode, chord) case keycode: cChord |= (chord); break;
#define ENGINE_HOOK(keycode, chord) case keycode: pr ? (pressed |= (chord)): (pressed &= ~(chord)); break;
2 changes: 1 addition & 1 deletion keyboards/ginny/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// Space saving jazz
#define NO_ACTION_LAYER
#define NO_ACTION_TAPPING
#define NO_ACTION_ONESHOT
//#define NO_ACTION_ONESHOT

// General keyboard configs
#define BOOTMAGIC_LITE_ROW 9
Expand Down
56 changes: 29 additions & 27 deletions keyboards/ginny/config_engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,39 @@

// Configuration options for the engine

#define C_SIZE uint16_t // type for chord
#define COMBO_MAX 4 // Longest Combo
#define C_SIZE uint16_t // type for chord
#define COMBO_MAX 4 // Longest Combo

// Key Aliases, must fit within C_SIZE!
// These are for Ginni + Asetniop
#define AA STN(0)
#define AS STN(1)
#define AE STN(2)
#define AT STN(3)
#define AN STN(4)
#define AI STN(5)
#define AO STN(6)
#define AP STN(7)
#define AL STN(8) // Left/Right thumbs
#define AR STN(9)
#define NUM STN(10) // Sticky Layer 1
#define USR STN(11) // Sticky Layer 2
#define CMD STN(12) // Sticky Layer 3
#define AA STN(0)
#define AS STN(1)
#define AE STN(2)
#define AT STN(3)
#define AN STN(4)
#define AI STN(5)
#define AO STN(6)
#define AP STN(7)
#define AL STN(8) // Left/Right thumbs
#define AR STN(9)
#define NUM STN(10) // Sticky Layer 1
#define USR STN(11) // Sticky Layer 2
#define CMD STN(12) // Sticky Layer 3

// Chord to start buffering strokes
#define COMMAND_MODE (AI | AN | AT | AE)
#define COMMAND_MODE (AI | AN | AT | AE)

// Mapping of QMK Keycodes to chord positions
#define ENGINE_CONFIG \
ENGINE_HOOK(KC_A, AA) \
ENGINE_HOOK(KC_S, AS) \
ENGINE_HOOK(KC_E, AE) \
ENGINE_HOOK(KC_T, AT) \
ENGINE_HOOK(KC_N, AN) \
ENGINE_HOOK(KC_I, AI) \
ENGINE_HOOK(KC_O, AO) \
ENGINE_HOOK(KC_P, AP) \
ENGINE_HOOK(KC_L, AL) \
ENGINE_HOOK(KC_R, AR)
#define ENGINE_CONFIG \
ENGINE_HOOK(KC_A, AA) \
ENGINE_HOOK(KC_S, AS) \
ENGINE_HOOK(KC_E, AE) \
ENGINE_HOOK(KC_T, AT) \
ENGINE_HOOK(KC_N, AN) \
ENGINE_HOOK(KC_I, AI) \
ENGINE_HOOK(KC_O, AO) \
ENGINE_HOOK(KC_P, AP) \
ENGINE_HOOK(KC_L, AL) \
ENGINE_HOOK(KC_R, AR)

#define IN_CHORD_MASK (0xFFFF ^ AL)
2 changes: 1 addition & 1 deletion keyboards/ginny/keymaps/default/dicts.def
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@
#include "user.def"

// For Debugging
#include "dicts/testing/test.def"
//#include "dicts/testing/test.def"
417 changes: 211 additions & 206 deletions keyboards/ginny/keymaps/default/dicts/aset/en-keymap.def

Large diffs are not rendered by default.

28 changes: 14 additions & 14 deletions keyboards/ginny/keymaps/default/dicts/aset/layer-keymap.def
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
// Thumb Keys
PRES(AL, KC_LSFT)
PRES(AR, KC_SPC)
PRES(AL, KC_LSFT)
PRES(AR, KC_SPC)

// Layer Switches
// To Number
SPEC( AR | AA | AT | AN | AP, SPEC_STICKY, NUM)
SPEC(NUM | AR | AA | AT | AN | AP, SPEC_STICKY, NUM)
SPEC(CMD | AR | AA | AT | AN | AP, SPEC_STICKY, NUM)
SPEC(USR | AR | AA | AT | AN | AP, SPEC_STICKY, NUM)
SPEC( AA | AT | AN | AP, SPEC_STICKY, NUM)
SPEC(NUM | AA | AT | AN | AP, SPEC_STICKY, NUM)
SPEC(CMD | AA | AT | AN | AP, SPEC_STICKY, NUM)
SPEC(USR | AA | AT | AN | AP, SPEC_STICKY, NUM)

// To Command
SPEC( AR | AS | AE | AI | AO, SPEC_STICKY, CMD)
SPEC(NUM | AR | AS | AE | AI | AO, SPEC_STICKY, CMD)
SPEC(CMD | AR | AE | AI | AO, SPEC_STICKY, NUM)
SPEC(USR | AR | AE | AI | AO, SPEC_STICKY, CMD)
SPEC( AS | AE | AI | AO, SPEC_STICKY, CMD)
SPEC(NUM | AS | AE | AI | AO, SPEC_STICKY, CMD)
SPEC(CMD | AS | AE | AI | AO, SPEC_STICKY, CMD)
SPEC(USR | AS | AE | AI | AO, SPEC_STICKY, CMD)

// To User
SPEC( AA | AS | AE | AT | AN | AI | AO | AP | AL | AR, SPEC_STICKY, USR)
SPEC(NUM | AA | AS | AE | AT | AN | AI | AO | AP | AL | AR, SPEC_STICKY, USR)
SPEC(CMD | AA | AS | AE | AT | AN | AI | AO | AP | AL | AR, SPEC_STICKY, USR)
SPEC(USR | AA | AS | AE | AT | AN | AI | AO | AP | AL | AR, SPEC_STICKY, USR)
SPEC( AA | AS | AE | AT | AN | AI | AO | AP, SPEC_STICKY, USR)
SPEC(NUM | AA | AS | AE | AT | AN | AI | AO | AP, SPEC_STICKY, USR)
SPEC(CMD | AA | AS | AE | AT | AN | AI | AO | AP, SPEC_STICKY, USR)
SPEC(USR | AA | AS | AE | AT | AN | AI | AO | AP, SPEC_STICKY, USR)
6 changes: 2 additions & 4 deletions keyboards/ginny/keymaps/default/dicts/aset/num-keymap.def
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ PRES(NUM|AE|AT,
PRES(NUM|AS|AT, KC_NO)
PRES(NUM|AN|AO, KC_NO)
PRES(NUM|AS|AI, KC_EQL)
PRES(NUM|AA|AS, KC_SPC)
PRES(NUM|AS|AO, KC_DOT)
PRES(NUM|AI|AO, KC_EQL)
PRES(NUM|AS|AN, KC_END)
Expand All @@ -27,9 +26,8 @@ PRES(NUM|AE|AO,
PRES(NUM|AO|AP, KC_SCLN)
PRES(NUM|AE|AI, KC_COMM)
PRES(NUM|AE|AP, KC_QUOT)
PRES(NUM|AN|AI|AO|AP, KC_TAB)
PRES(NUM|AA|AT|AN|AP, KC_SPC)
PRES(NUM|AA|AS|AE|AT|AN|AI|AO|AP, KC_SPC)
PRES(NUM|AA|AS|AE|AT, KC_TAB)
PRES(NUM|AN|AI|AO|AP, KC_ENT)
KEYS(NUM|AS|AP, cmb_ea889bef063f6825, {KC_LSFT, KC_0, COMBO_END})
KEYS(NUM|AA|AI, cmb_e9bf29584cf72c14, {KC_LSFT, KC_1, COMBO_END})
KEYS(NUM|AA|AO, cmb_bff41f9e9cd6fd93, {KC_LSFT, KC_9, COMBO_END})
32 changes: 16 additions & 16 deletions keyboards/ginny/rules.mk
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
# MCU name
MCU = atmega32u4
BOOTLOADER = atmel-dfu
MCU = atmega32u4
BOOTLOADER = atmel-dfu

CUSTOM_MATRIX = yes
VIRTSER_ENABLE = no
NKRO_ENABLE = yes
DEBOUNCE_TYPE = eager_pr
CUSTOM_MATRIX = yes
VIRTSER_ENABLE = no
NKRO_ENABLE = no
DEBOUNCE_TYPE = eager_pr

# Lets try and save some space eh?
MOUSEKEY_ENABLE = no
EXTRAKEY_ENABLE = no
CONSOLE_ENABLE = yes
COMMAND_ENABLE = no
MOUSEKEY_ENABLE = no
EXTRAKEY_ENABLE = no
CONSOLE_ENABLE = no
COMMAND_ENABLE = no

VPATH += keyboards/gboards/engine
SRC += matrix.c engine.c
QUANTUM_LIB_SRC += i2c_master.c
OPT_DEFS += -DONLYQWERTY
#OPT_DEFS += -DONLYQWERTY -DDEBUG_MATRIX -save-temps -c
LTO_ENABLE = yes
VPATH += keyboards/gboards/engine
SRC += matrix.c engine.c
QUANTUM_LIB_SRC += i2c_master.c
OPT_DEFS += -DONLYQWERTY
#OPT_DEFS += -DONLYQWERTY -DDEBUG_MATRIX -save-temps -c
LTO_ENABLE = yes

0 comments on commit 28ddd6c

Please sign in to comment.