moving by word
This commit is contained in:
parent
620e6bdb49
commit
df9d926770
1 changed files with 13 additions and 6 deletions
|
@ -6,6 +6,7 @@
|
||||||
// using my own masks here since the inbuilt ones conflict with arrow keys etc.
|
// using my own masks here since the inbuilt ones conflict with arrow keys etc.
|
||||||
#define MASK_SHIFT 0x100
|
#define MASK_SHIFT 0x100
|
||||||
#define MASK_ALTGR 0x200
|
#define MASK_ALTGR 0x200
|
||||||
|
#define MASK_CTRL 0x400
|
||||||
|
|
||||||
const byte PIN_A = 33;
|
const byte PIN_A = 33;
|
||||||
const byte PIN_B = 32;
|
const byte PIN_B = 32;
|
||||||
|
@ -63,8 +64,8 @@ const byte chord_buttons[24] = {
|
||||||
// keypresses for chords in sets of 4
|
// keypresses for chords in sets of 4
|
||||||
// index 0 is the chord on its own, 1-3 correspond to chord_buttons
|
// index 0 is the chord on its own, 1-3 correspond to chord_buttons
|
||||||
const int chord_targets[32] = {
|
const int chord_targets[32] = {
|
||||||
KEY_BACKSPACE, KEY_LEFT, KEY_LEFT, KEY_HOME,
|
KEY_BACKSPACE, KEY_LEFT + MASK_CTRL, KEY_LEFT, KEY_HOME,
|
||||||
KEY_SPACE, KEY_RIGHT, KEY_RIGHT, KEY_END,
|
KEY_SPACE, KEY_RIGHT + MASK_CTRL, KEY_RIGHT, KEY_END,
|
||||||
KEY_G, KEY_H, KEY_I, KEY_J,
|
KEY_G, KEY_H, KEY_I, KEY_J,
|
||||||
KEY_K, KEY_L, KEY_M, KEY_N,
|
KEY_K, KEY_L, KEY_M, KEY_N,
|
||||||
KEY_O, KEY_P, KEY_Q, KEY_R,
|
KEY_O, KEY_P, KEY_Q, KEY_R,
|
||||||
|
@ -73,8 +74,8 @@ const int chord_targets[32] = {
|
||||||
0, 0, 0, 0
|
0, 0, 0, 0
|
||||||
};
|
};
|
||||||
const int chord_targets_symbol[32] = {
|
const int chord_targets_symbol[32] = {
|
||||||
KEY_BACKSPACE, KEY_LEFT, KEY_LEFT, KEY_HOME,
|
0, 0, 0, 0,
|
||||||
KEY_SPACE, KEY_RIGHT, KEY_RIGHT, KEY_END,
|
0, 0, 0, 0,
|
||||||
KEY_0, KEY_7, KEY_8, KEY_9,
|
KEY_0, KEY_7, KEY_8, KEY_9,
|
||||||
// # @ ½ &
|
// # @ ½ &
|
||||||
KEY_BACKSLASH, KEY_QUOTE + MASK_SHIFT, KEY_5 + MASK_ALTGR, KEY_7 + MASK_SHIFT,
|
KEY_BACKSLASH, KEY_QUOTE + MASK_SHIFT, KEY_5 + MASK_ALTGR, KEY_7 + MASK_SHIFT,
|
||||||
|
@ -383,7 +384,8 @@ void key_released(byte key) {
|
||||||
key_pressed_total == chords[chord]) {
|
key_pressed_total == chords[chord]) {
|
||||||
target = chord_targets[chord * 4];
|
target = chord_targets[chord * 4];
|
||||||
if (mod_symbol || mod_symbol_lock)
|
if (mod_symbol || mod_symbol_lock)
|
||||||
target = chord_targets_symbol[chord * 4];
|
if (chord_targets_symbol[chord * 4] != 0)
|
||||||
|
target = chord_targets_symbol[chord * 4];
|
||||||
|
|
||||||
press_key(target);
|
press_key(target);
|
||||||
return;
|
return;
|
||||||
|
@ -393,7 +395,8 @@ void key_released(byte key) {
|
||||||
if (key == chord_buttons[chord * 3 + b]) {
|
if (key == chord_buttons[chord * 3 + b]) {
|
||||||
target = chord_targets[chord * 4 + 1 + b];
|
target = chord_targets[chord * 4 + 1 + b];
|
||||||
if (mod_symbol || mod_symbol_lock)
|
if (mod_symbol || mod_symbol_lock)
|
||||||
target = chord_targets_symbol[chord * 4 + 1 + b];
|
if (chord_targets_symbol[chord * 4 + 1 + b] != 0)
|
||||||
|
target = chord_targets_symbol[chord * 4 + 1 + b];
|
||||||
|
|
||||||
// erase key from total so you can hold the chord down for
|
// erase key from total so you can hold the chord down for
|
||||||
// multiple chorded keypresses
|
// multiple chorded keypresses
|
||||||
|
@ -427,6 +430,10 @@ void press_key(int key) {
|
||||||
mod_altgr = true;
|
mod_altgr = true;
|
||||||
key &= ~(MASK_ALTGR);
|
key &= ~(MASK_ALTGR);
|
||||||
}
|
}
|
||||||
|
if (key & MASK_CTRL) {
|
||||||
|
mod_control = true;
|
||||||
|
key &= ~(MASK_CTRL);
|
||||||
|
}
|
||||||
|
|
||||||
// modifiers
|
// modifiers
|
||||||
if (mod_shift || mod_shift_lock)
|
if (mod_shift || mod_shift_lock)
|
||||||
|
|
Loading…
Reference in a new issue