Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Steno combinedkeys #12538

Merged
merged 2 commits into from
Aug 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions docs/feature_stenography.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,3 +128,18 @@ As defined in `keymap_steno.h`.
|`STN_RES1`||(GeminiPR only)|
|`STN_RES2`||(GeminiPR only)|
|`STN_PWR`||(GeminiPR only)|

If you do not want to hit two keys with one finger combined keycodes can be used. These are also defined in `keymap_steno.h`, and causes both keys to be reported as pressed or released. To use these keycodes define `STENO_COMBINEDMAP` in your `config.h` file
|Combined key | Key1 | Key 2 |
|---------------|--------|----------|
|STN_S3 | STN_S1 | STN_S2 |
|STN_TKL | STN_TL | STN_KL |
|STN_PWL | STN_PL | STN_WL |
|STN_HRL | STN_HL | STN_RL |
|STN_FRR | STN_FR | STN_RR |
|STN_PBR | STN_PR | STN_BR |
|STN_LGR | STN_LR | STN_GR |
|STN_TSR | STN_TR | STN_SR |
|STN_DZR | STN_DR | STN_ZR |
|STN_AO | STN_A | STN_O |
|STN_EU | STN_E | STN_U |
18 changes: 18 additions & 0 deletions quantum/keymap_extras/keymap_steno.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,21 @@ enum steno_keycodes {
STN_ZR,
STN__MAX = STN_ZR, // must be less than QK_STENO_BOLT
};

#ifdef STENO_COMBINEDMAP
enum steno_combined_keycodes
{
STN_S3 = QK_STENO_COMB,
STN_TKL,
STN_PWL,
STN_HRL,
STN_FRR,
STN_PBR,
STN_LGR,
STN_TSR,
STN_DZR,
STN_AO,
STN_EU,
STN_COMB_MAX = STN_EU,
};
#endif
15 changes: 15 additions & 0 deletions quantum/process_keycode/process_steno.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@ static steno_mode_t mode;

static const uint8_t boltmap[64] PROGMEM = {TXB_NUL, TXB_NUM, TXB_NUM, TXB_NUM, TXB_NUM, TXB_NUM, TXB_NUM, TXB_S_L, TXB_S_L, TXB_T_L, TXB_K_L, TXB_P_L, TXB_W_L, TXB_H_L, TXB_R_L, TXB_A_L, TXB_O_L, TXB_STR, TXB_STR, TXB_NUL, TXB_NUL, TXB_NUL, TXB_STR, TXB_STR, TXB_E_R, TXB_U_R, TXB_F_R, TXB_R_R, TXB_P_R, TXB_B_R, TXB_L_R, TXB_G_R, TXB_T_R, TXB_S_R, TXB_D_R, TXB_NUM, TXB_NUM, TXB_NUM, TXB_NUM, TXB_NUM, TXB_NUM, TXB_Z_R};

#ifdef STENO_COMBINEDMAP
/* Used to look up when pressing the middle row key to combine two consonant or vowel keys */
static const uint16_t combinedmap_first[] PROGMEM = {STN_S1, STN_TL, STN_PL, STN_HL, STN_FR, STN_PR, STN_LR, STN_TR, STN_DR, STN_A, STN_E};
static const uint16_t combinedmap_second[] PROGMEM = {STN_S2, STN_KL, STN_WL, STN_RL, STN_RR, STN_BR, STN_GR, STN_SR, STN_ZR, STN_O, STN_U};
#endif

static void steno_clear_state(void) {
memset(state, 0, sizeof(state));
memset(chord, 0, sizeof(chord));
Expand Down Expand Up @@ -167,6 +173,15 @@ bool process_steno(uint16_t keycode, keyrecord_t *record) {
}
return false;

#ifdef STENO_COMBINEDMAP
case QK_STENO_COMB ... QK_STENO_COMB_MAX:
{
uint8_t result;
result = process_steno(combinedmap_first[keycode-QK_STENO_COMB], record);
result &= process_steno(combinedmap_second[keycode-QK_STENO_COMB], record);
return result;
}
#endif
case STN__MIN ... STN__MAX:
if (!process_steno_user(keycode, record)) {
return false;
Expand Down
2 changes: 2 additions & 0 deletions quantum/quantum_keycodes.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ enum quantum_keycodes {
QK_STENO = 0x5A00,
QK_STENO_BOLT = 0x5A30,
QK_STENO_GEMINI = 0x5A31,
QK_STENO_COMB = 0x5A32,
QK_STENO_COMB_MAX = 0x5A3C,
QK_STENO_MAX = 0x5A3F,
// 0x5C00 - 0x5FFF are reserved, see below
QK_MOD_TAP = 0x6000,
Expand Down