diff options
49 files changed, 360 insertions, 273 deletions
diff --git a/docs/feature_stenography.md b/docs/feature_stenography.md index 62d4dabf81..df4c9c6ad3 100644 --- a/docs/feature_stenography.md +++ b/docs/feature_stenography.md @@ -138,7 +138,7 @@ bool post_process_steno_user(uint16_t keycode, keyrecord_t *record, steno_mode_t This function is called after a key has been processed, but before any decision about whether or not to send a chord. This is where to put hooks for things like, say, live displays of steno chords or keys. -If `IS_PRESSED(record->event)` is false, and `n_pressed_keys` is 0 or 1, the chord will be sent shortly, but has not yet been sent. This relieves you of the need of keeping track of where a packet ends and another begins. +If `record->event.pressed` is false, and `n_pressed_keys` is 0 or 1, the chord will be sent shortly, but has not yet been sent. This relieves you of the need of keeping track of where a packet ends and another begins. The `chord` argument contains the packet of the current chord as specified by the protocol in use. This is *NOT* simply a list of chorded steno keys of the form `[STN_E, STN_U, STN_BR, STN_GR]`. Refer to the appropriate protocol section of this document to learn more about the format of the packets in your steno protocol/mode of choice. diff --git a/docs/ja/feature_stenography.md b/docs/ja/feature_stenography.md index b280084ae3..9551221696 100644 --- a/docs/ja/feature_stenography.md +++ b/docs/ja/feature_stenography.md @@ -80,7 +80,7 @@ bool process_steno_user(uint16_t keycode, keyrecord_t *record) { return true; } bool post_process_steno_user(uint16_t keycode, keyrecord_t *record, steno_mode_t mode, uint8_t chord[6], int8_t pressed); ``` -この関数はキーが処理された後、ただしコードを送信するかどうかを決める前に呼び出されます。`IS_PRESSED(record->event)` が false で、`pressed` が 0 または 1 の場合は、コードはまもなく送信されますが、まだ送信されてはいません。ここが速記コードあるいはキーのライブ表示などのフックを配置する場所です。 +この関数はキーが処理された後、ただしコードを送信するかどうかを決める前に呼び出されます。`record->event.pressed` が false で、`pressed` が 0 または 1 の場合は、コードはまもなく送信されますが、まだ送信されてはいません。ここが速記コードあるいはキーのライブ表示などのフックを配置する場所です。 ## キーコードリファレンス :id=keycode-reference diff --git a/keyboards/atlantis/encoder_actions.c b/keyboards/atlantis/encoder_actions.c index 5bfba6d99f..126b665a8e 100644 --- a/keyboards/atlantis/encoder_actions.c +++ b/keyboards/atlantis/encoder_actions.c @@ -28,7 +28,8 @@ void encoder_action_unregister(void) { keyevent_t encoder_event = (keyevent_t) { .key = encoder_state[index] >> 1 ? encoder_cw[index] : encoder_ccw[index], .pressed = false, - .time = (timer_read() | 1) + .time = timer_read(), + .type = KEY_EVENT }; encoder_state[index] = 0; action_exec(encoder_event); @@ -40,7 +41,8 @@ void encoder_action_register(uint8_t index, bool clockwise) { keyevent_t encoder_event = (keyevent_t) { .key = clockwise ? encoder_cw[index] : encoder_ccw[index], .pressed = true, - .time = (timer_read() | 1) + .time = timer_read(), + .type = KEY_EVENT }; encoder_state[index] = (clockwise ^ 1) | (clockwise << 1); action_exec(encoder_event); diff --git a/keyboards/custommk/evo70/keymaps/via/keymap.c b/keyboards/custommk/evo70/keymaps/via/keymap.c index 74f68590cf..ba0d231118 100644 --- a/keyboards/custommk/evo70/keymaps/via/keymap.c +++ b/keyboards/custommk/evo70/keymaps/via/keymap.c @@ -57,12 +57,14 @@ void set_custom_encoder_mode_user(bool custom_mode) { keyevent_t encoder_ccw = { .key = (keypos_t){.row = 4, .col = 7}, - .pressed = false + .pressed = false, + .type = KEY_EVENT }; keyevent_t encoder_cw = { .key = (keypos_t){.row = 4, .col = 10}, - .pressed = false + .pressed = false, + .type = KEY_EVENT }; @@ -70,12 +72,12 @@ bool encoder_update_user(uint8_t index, bool clockwise) { if (custom_encoder_mode) { if (clockwise) { encoder_cw.pressed = true; - encoder_cw.time = (timer_read() | 1); + encoder_cw.time = timer_read(); action_exec(encoder_cw); } else { encoder_ccw.pressed = true; - encoder_ccw.time = (timer_read() | 1); + encoder_ccw.time = timer_read(); action_exec(encoder_ccw); } return false; @@ -86,13 +88,13 @@ bool encoder_update_user(uint8_t index, bool clockwise) { void matrix_scan_user(void) { if (IS_PRESSED(encoder_ccw)) { encoder_ccw.pressed = false; - encoder_ccw.time = (timer_read() | 1); + encoder_ccw.time = timer_read(); action_exec(encoder_ccw); } if (IS_PRESSED(encoder_cw)) { encoder_cw.pressed = false; - encoder_cw.time = (timer_read() | 1); + encoder_cw.time = timer_read(); action_exec(encoder_cw); } -}
\ No newline at end of file +} diff --git a/keyboards/custommk/genesis/rev2/keymaps/via/keymap.c b/keyboards/custommk/genesis/rev2/keymaps/via/keymap.c index eb0f7772cf..f6a3c936df 100644 --- a/keyboards/custommk/genesis/rev2/keymaps/via/keymap.c +++ b/keyboards/custommk/genesis/rev2/keymaps/via/keymap.c @@ -95,46 +95,50 @@ void keyboard_post_init_user(void) { keyevent_t encoder_left_ccw = { .key = (keypos_t){.row = 5, .col = 0}, - .pressed = false + .pressed = false, + .type = KEY_EVENT }; keyevent_t encoder_left_cw = { .key = (keypos_t){.row = 5, .col = 1}, .pressed = false + .type = KEY_EVENT }; keyevent_t encoder_right_ccw = { .key = (keypos_t){.row = 5, .col = 2}, .pressed = false + .type = KEY_EVENT }; keyevent_t encoder_right_cw = { .key = (keypos_t){.row = 5, .col = 3}, .pressed = false + .type = KEY_EVENT }; void matrix_scan_user(void) { if (IS_PRESSED(encoder_left_ccw)) { encoder_left_ccw.pressed = false; - encoder_left_ccw.time = (timer_read() | 1); + encoder_left_ccw.time = timer_read(); action_exec(encoder_left_ccw); } if (IS_PRESSED(encoder_left_cw)) { encoder_left_cw.pressed = false; - encoder_left_cw.time = (timer_read() | 1); + encoder_left_cw.time = timer_read(); action_exec(encoder_left_cw); } if (IS_PRESSED(encoder_right_ccw)) { encoder_right_ccw.pressed = false; - encoder_right_ccw.time = (timer_read() | 1); + encoder_right_ccw.time = timer_read(); action_exec(encoder_right_ccw); } if (IS_PRESSED(encoder_right_cw)) { encoder_right_cw.pressed = false; - encoder_right_cw.time = (timer_read() | 1); + encoder_right_cw.time = timer_read(); action_exec(encoder_right_cw); } @@ -145,21 +149,21 @@ bool encoder_update_user(uint8_t index, bool clockwise) { if (index == 0) { if (clockwise) { encoder_left_cw.pressed = true; - encoder_left_cw.time = (timer_read() | 1); + encoder_left_cw.time = timer_read(); action_exec(encoder_left_cw); } else { encoder_left_ccw.pressed = true; - encoder_left_ccw.time = (timer_read() | 1); + encoder_left_ccw.time = timer_read(); action_exec(encoder_left_ccw); } } else { if (clockwise) { encoder_right_cw.pressed = true; - encoder_right_cw.time = (timer_read() | 1); + encoder_right_cw.time = timer_read(); action_exec(encoder_right_cw); } else { encoder_right_ccw.pressed = true; - encoder_right_ccw.time = (timer_read() | 1); + encoder_right_ccw.time = timer_read(); action_exec(encoder_right_ccw); } } diff --git a/keyboards/dailycraft/owl8/keymaps/via/keymap.c b/keyboards/dailycraft/owl8/keymaps/via/keymap.c index 6e3f6ea90b..667392b946 100644 --- a/keyboards/dailycraft/owl8/keymaps/via/keymap.c +++ b/keyboards/dailycraft/owl8/keymaps/via/keymap.c @@ -52,46 +52,50 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { keyevent_t encoder1_ccw = { .key = (keypos_t){.row = 0, .col = 12}, - .pressed = false + .pressed = false, + .type = KEY_EVENT }; keyevent_t encoder1_cw = { .key = (keypos_t){.row = 0, .col = 13}, - .pressed = false + .pressed = false, + .type = KEY_EVENT }; keyevent_t encoder2_ccw = { .key = (keypos_t){.row = 0, .col = 14}, - .pressed = false + .pressed = false, + .type = KEY_EVENT }; keyevent_t encoder2_cw = { .key = (keypos_t){.row = 0, .col = 15}, - .pressed = false + .pressed = false, + .type = KEY_EVENT }; void matrix_scan_user(void) { if (IS_PRESSED(encoder1_ccw)) { encoder1_ccw.pressed = false; - encoder1_ccw.time = (timer_read() | 1); + encoder1_ccw.time = timer_read(); action_exec(encoder1_ccw); } if (IS_PRESSED(encoder1_cw)) { encoder1_cw.pressed = false; - encoder1_cw.time = (timer_read() | 1); + encoder1_cw.time = timer_read(); action_exec(encoder1_cw); } if (IS_PRESSED(encoder2_ccw)) { encoder2_ccw.pressed = false; - encoder2_ccw.time = (timer_read() | 1); + encoder2_ccw.time = timer_read(); action_exec(encoder2_ccw); } if (IS_PRESSED(encoder2_cw)) { encoder2_cw.pressed = false; - encoder2_cw.time = (timer_read() | 1); + encoder2_cw.time = timer_read(); action_exec(encoder2_cw); } } @@ -100,21 +104,21 @@ bool encoder_update_user(uint8_t index, bool clockwise) { if (index == 0) { /* First encoder */ if (clockwise) { encoder1_cw.pressed = true; - encoder1_cw.time = (timer_read() | 1); + encoder1_cw.time = timer_read(); action_exec(encoder1_cw); } else { encoder1_ccw.pressed = true; - encoder1_ccw.time = (timer_read() | 1); + encoder1_ccw.time = timer_read(); action_exec(encoder1_ccw); } } else if (index == 1) { if (clockwise) { encoder2_cw.pressed = true; - encoder2_cw.time = (timer_read() | 1); + encoder2_cw.time = timer_read(); action_exec(encoder2_cw); } else { encoder2_ccw.pressed = true; - encoder2_ccw.time = (timer_read() | 1); + encoder2_ccw.time = timer_read(); action_exec(encoder2_ccw); } } diff --git a/keyboards/dailycraft/stickey4/keymaps/via/keymap.c b/keyboards/dailycraft/stickey4/keymaps/via/keymap.c index 602d3fb10d..30d8ad188e 100644 --- a/keyboards/dailycraft/stickey4/keymaps/via/keymap.c +++ b/keyboards/dailycraft/stickey4/keymaps/via/keymap.c @@ -44,46 +44,50 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { keyevent_t encoder1_ccw = { .key = (keypos_t){.row = 0, .col = 4}, - .pressed = false + .pressed = false, + .type = KEY_EVENT }; keyevent_t encoder1_cw = { .key = (keypos_t){.row = 0, .col = 5}, - .pressed = false + .pressed = false, + .type = KEY_EVENT }; keyevent_t encoder2_ccw = { .key = (keypos_t){.row = 0, .col = 6}, - .pressed = false + .pressed = false, + .type = KEY_EVENT }; keyevent_t encoder2_cw = { .key = (keypos_t){.row = 0, .col = 7}, - .pressed = false + .pressed = false, + .type = KEY_EVENT }; void matrix_scan_user(void) { if (IS_PRESSED(encoder1_ccw)) { encoder1_ccw.pressed = false; - encoder1_ccw.time = (timer_read() | 1); + encoder1_ccw.time = timer_read(); action_exec(encoder1_ccw); } if (IS_PRESSED(encoder1_cw)) { encoder1_cw.pressed = false; - encoder1_cw.time = (timer_read() | 1); + encoder1_cw.time = timer_read(); action_exec(encoder1_cw); } if (IS_PRESSED(encoder2_ccw)) { encoder2_ccw.pressed = false; - encoder2_ccw.time = (timer_read() | 1); + encoder2_ccw.time = timer_read(); action_exec(encoder2_ccw); } if (IS_PRESSED(encoder2_cw)) { encoder2_cw.pressed = false; - encoder2_cw.time = (timer_read() | 1); + encoder2_cw.time = timer_read(); action_exec(encoder2_cw); } } @@ -92,21 +96,21 @@ bool encoder_update_user(uint8_t index, bool clockwise) { if (index == 0) { /* First encoder */ if (clockwise) { encoder1_cw.pressed = true; - encoder1_cw.time = (timer_read() | 1); + encoder1_cw.time = timer_read(); action_exec(encoder1_cw); } else { encoder1_ccw.pressed = true; - encoder1_ccw.time = (timer_read() | 1); + encoder1_ccw.time = timer_read(); action_exec(encoder1_ccw); } } else if (index == 1) { if (clockwise) { encoder2_cw.pressed = true; - encoder2_cw.time = (timer_read() | 1); + encoder2_cw.time = timer_read(); action_exec(encoder2_cw); } else { encoder2_ccw.pressed = true; - encoder2_ccw.time = (timer_read() | 1); + encoder2_ccw.time = timer_read(); action_exec(encoder2_ccw); } } diff --git a/keyboards/dailycraft/wings42/rev2/keymaps/via/keymap.c b/keyboards/dailycraft/wings42/rev2/keymaps/via/keymap.c index 97f94366a8..5655d2ca48 100644 --- a/keyboards/dailycraft/wings42/rev2/keymaps/via/keymap.c +++ b/keyboards/dailycraft/wings42/rev2/keymaps/via/keymap.c @@ -82,91 +82,99 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { keyevent_t encoder1_ccw = { .key = (keypos_t){.row = 4, .col = 0}, - .pressed = false + .pressed = false, + .type = KEY_EVENT }; keyevent_t encoder1_cw = { .key = (keypos_t){.row = 4, .col = 1}, - .pressed = false + .pressed = false, + .type = KEY_EVENT }; keyevent_t encoder2_ccw = { .key = (keypos_t){.row = 4, .col = 2}, - .pressed = false + .pressed = false, + .type = KEY_EVENT }; keyevent_t encoder2_cw = { .key = (keypos_t){.row = 4, .col = 3}, - .pressed = false + .pressed = false, + .type = KEY_EVENT }; keyevent_t encoder3_ccw = { .key = (keypos_t){.row = 9, .col = 1}, - .pressed = false + .pressed = false, + .type = KEY_EVENT }; keyevent_t encoder3_cw = { .key = (keypos_t){.row = 9, .col = 0}, - .pressed = false + .pressed = false, + .type = KEY_EVENT }; keyevent_t encoder4_ccw = { .key = (keypos_t){.row = 9, .col = 3}, - .pressed = false + .pressed = false, + .type = KEY_EVENT }; keyevent_t encoder4_cw = { .key = (keypos_t){.row = 9, .col = 2}, - .pressed = false + .pressed = false, + .type = KEY_EVENT }; void matrix_scan_user(void) { if (IS_PRESSED(encoder1_ccw)) { encoder1_ccw.pressed = false; - encoder1_ccw.time = (timer_read() | 1); + encoder1_ccw.time = timer_read(); action_exec(encoder1_ccw); } if (IS_PRESSED(encoder1_cw)) { encoder1_cw.pressed = false; - encoder1_cw.time = (timer_read() | 1); + encoder1_cw.time = timer_read(); action_exec(encoder1_cw); } if (IS_PRESSED(encoder2_ccw)) { encoder2_ccw.pressed = false; - encoder2_ccw.time = (timer_read() | 1); + encoder2_ccw.time = timer_read(); action_exec(encoder2_ccw); } if (IS_PRESSED(encoder2_cw)) { encoder2_cw.pressed = false; - encoder2_cw.time = (timer_read() | 1); + encoder2_cw.time = timer_read(); action_exec(encoder2_cw); } if (IS_PRESSED(encoder3_ccw)) { encoder3_ccw.pressed = false; - encoder3_ccw.time = (timer_read() | 1); + encoder3_ccw.time = timer_read(); action_exec(encoder3_ccw); } if (IS_PRESSED(encoder3_cw)) { encoder3_cw.pressed = false; - encoder3_cw.time = (timer_read() | 1); + encoder3_cw.time = timer_read(); action_exec(encoder3_cw); } if (IS_PRESSED(encoder4_ccw)) { encoder4_ccw.pressed = false; - encoder4_ccw.time = (timer_read() | 1); + encoder4_ccw.time = timer_read(); action_exec(encoder4_ccw); } if (IS_PRESSED(encoder4_cw)) { encoder4_cw.pressed = false; - encoder4_cw.time = (timer_read() | 1); + encoder4_cw.time = timer_read(); action_exec(encoder4_cw); } } @@ -175,41 +183,41 @@ bool encoder_update_user(uint8_t index, bool clockwise) { if (index == 0) { if (clockwise) { encoder1_cw.pressed = true; - encoder1_cw.time = (timer_read() | 1); + encoder1_cw.time = timer_read(); action_exec(encoder1_cw); } else { encoder1_ccw.pressed = true; - encoder1_ccw.time = (timer_read() | 1); + encoder1_ccw.time = timer_read(); action_exec(encoder1_ccw); } } else if (index == 1) { if (clockwise) { encoder2_cw.pressed = true; - encoder2_cw.time = (timer_read() | 1); + encoder2_cw.time = timer_read(); action_exec(encoder2_cw); } else { encoder2_ccw.pressed = true; - encoder2_ccw.time = (timer_read() | 1); + encoder2_ccw.time = timer_read(); action_exec(encoder2_ccw); } } else if (index == 2) { if (clockwise) { encoder3_cw.pressed = true; - encoder3_cw.time = (timer_read() | 1); + encoder3_cw.time = timer_read(); action_exec(encoder3_cw); } else { encoder3_ccw.pressed = true; - encoder3_ccw.time = (timer_read() | 1); + encoder3_ccw.time = timer_read(); action_exec(encoder3_ccw); } } else if (index == 3) { if (clockwise) { encoder4_cw.pressed = true; - encoder4_cw.time = (timer_read() | 1); + encoder4_cw.time = timer_read(); action_exec(encoder4_cw); } else { encoder4_ccw.pressed = true; - encoder4_ccw.time = (timer_read() | 1); + encoder4_ccw.time = timer_read(); action_exec(encoder4_ccw); } } diff --git a/keyboards/gl516/n51gl/keymaps/salicylic/keymap.c b/keyboards/gl516/n51gl/keymaps/salicylic/keymap.c index 42b2204cf1..81f7b8665f 100644 --- a/keyboards/gl516/n51gl/keymaps/salicylic/keymap.c +++ b/keyboards/gl516/n51gl/keymaps/salicylic/keymap.c @@ -111,7 +111,7 @@ bool encoder_update_user(uint8_t index, bool clockwise) { key.row = 1; key.col = 0; } - action_exec((keyevent_t){.key = key, .pressed = true, .time = (timer_read() | 1)}); - action_exec((keyevent_t){.key = key, .pressed = false, .time = (timer_read() | 1)}); + action_exec(MAKE_KEYEVENT(key.row, key.col, true)); + action_exec(MAKE_KEYEVENT(key.row, key.col, false)); return true; } diff --git a/keyboards/gl516/n51gl/keymaps/via/keymap.c b/keyboards/gl516/n51gl/keymaps/via/keymap.c index a44392124c..cf1aa7d595 100644 --- a/keyboards/gl516/n51gl/keymaps/via/keymap.c +++ b/keyboards/gl516/n51gl/keymaps/via/keymap.c @@ -96,7 +96,7 @@ bool encoder_update_user(uint8_t index, bool clockwise) { key.row = 1; key.col = 0; } - action_exec((keyevent_t){.key = key, .pressed = true, .time = (timer_read() | 1)}); - action_exec((keyevent_t){.key = key, .pressed = false, .time = (timer_read() | 1)}); + action_exec(MAKE_KEYEVENT(key.row, key.col, true)); + action_exec(MAKE_KEYEVENT(key.row, key.col, false)); return true; } diff --git a/keyboards/jones/v1/keymaps/via/keymap.c b/keyboards/jones/v1/keymaps/via/keymap.c index 3304b13700..3b41c40174 100644 --- a/keyboards/jones/v1/keymaps/via/keymap.c +++ b/keyboards/jones/v1/keymaps/via/keymap.c @@ -178,7 +178,8 @@ void encoder_action_unregister(void) { keyevent_t encoder_event = (keyevent_t) { .key = encoder_state[index] >> 1 ? encoder_cw[index] : encoder_ccw[index], .pressed = false, - .time = (timer_read() | 1) + .time = timer_read(), + .type = KEY_EVENT }; encoder_state[index] = 0; action_exec(encoder_event); @@ -190,7 +191,8 @@ void encoder_action_register(uint8_t index, bool clockwise) { keyevent_t encoder_event = (keyevent_t) { .key = clockwise ? encoder_cw[index] : encoder_ccw[index], .pressed = true, - .time = (timer_read() | 1) + .time = timer_read(), + .type = KEY_EVENT }; encoder_state[index] = (clockwise ^ 1) | (clockwise << 1); action_exec(encoder_event); diff --git a/keyboards/kabedon/kabedon98e/kabedon98e.c b/keyboards/kabedon/kabedon98e/kabedon98e.c index 7ca156eab9..6984790006 100644 --- a/keyboards/kabedon/kabedon98e/kabedon98e.c +++ b/keyboards/kabedon/kabedon98e/kabedon98e.c @@ -25,7 +25,8 @@ void encoder_action_unregister(void) { keyevent_t encoder_event = (keyevent_t) { < |