diff options
author | Nick Brassel <nick@tzarc.org> | 2022-11-05 23:22:11 +1100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-05 23:22:11 +1100 |
commit | 4d33f356a62c195f5498ed2fe8dd3ea434d5a689 (patch) | |
tree | 9e9c99d43512b2890836facfd8ae4e447dfa5810 /docs | |
parent | fe00c8021192c43e27e5a91a5193d7fbe07b9fa8 (diff) |
Macro keycode name refactoring (#18958)
Diffstat (limited to 'docs')
-rw-r--r-- | docs/ChangeLog/20211127.md | 10 | ||||
-rw-r--r-- | docs/configurator_default_keymaps.md | 36 | ||||
-rw-r--r-- | docs/feature_macros.md | 6 | ||||
-rw-r--r-- | docs/zh-cn/configurator_default_keymaps.md | 36 |
4 files changed, 44 insertions, 44 deletions
diff --git a/docs/ChangeLog/20211127.md b/docs/ChangeLog/20211127.md index d954bb9f61..0780ab6a44 100644 --- a/docs/ChangeLog/20211127.md +++ b/docs/ChangeLog/20211127.md @@ -56,19 +56,19 @@ You can now define up to 32 macros in your `keymap.json` file, as used by [QMK C "keyboard": "handwired/my_macropad", "keymap": "my_keymap", "macros": [ - [ // first listed is MACRO_0... + [ // first listed is QK_MACRO_0... {"action":"down", "keycodes": ["LSFT"]}, "hello world1", {"action": "up","keycodes": ["LSFT"]} ], - [ // ...then MACRO_1... + [ // ...then QK_MACRO_1... {"action":"tap", "keycodes": ["LCTL", "LALT", "DEL"]} ], - [ // ...then MACRO_2... + [ // ...then QK_MACRO_2... "ding!", {"action":"beep"} ], - [ // ...and MACRO_3. + [ // ...and QK_MACRO_3. {"action":"tap", "keycodes": ["F1"]}, {"action":"delay", "duration": "1000"}, {"action":"tap", "keycodes": ["PGDN"]} @@ -76,7 +76,7 @@ You can now define up to 32 macros in your `keymap.json` file, as used by [QMK C ], "layout": "LAYOUT_all", "layers": [ - ["MACRO_0", "MACRO_1", "MACRO_2", "MACRO_3"] + ["QK_MACRO_0", "QK_MACRO_1", "QK_MACRO_2", "QK_MACRO_3"] ] } ``` diff --git a/docs/configurator_default_keymaps.md b/docs/configurator_default_keymaps.md index 3fea15166a..d08ec29539 100644 --- a/docs/configurator_default_keymaps.md +++ b/docs/configurator_default_keymaps.md @@ -122,26 +122,26 @@ There is a way to support custom keycodes: if the logic for a custom keycode is ```c enum custom_keycodes { - MACRO_1 = SAFE_RANGE, - MACRO_2, - MACRO_3 + CUSTOM_1 = SAFE_RANGE, + CUSTOM_2, + CUSTOM_3 }; ... bool process_record_user(uint16_t keycode, keyrecord_t *record) { switch(keycode) { - case MACRO_1: + case CUSTOM_1: if (record->event.pressed) { - SEND_STRING("This is macro #1."); + SEND_STRING("This is custom keycode #1."); } return false; - case MACRO_2: + case CUSTOM_2: if (record->event.pressed) { - SEND_STRING("This is macro #2."); + SEND_STRING("This is custom keycode #2."); } return false; - case MACRO_3: + case CUSTOM_3: if (record->event.pressed) { - SEND_STRING("This is macro #3."); + SEND_STRING("This is custom keycode #3."); } return false; } @@ -153,9 +153,9 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { ```c enum keyboard_keycodes { - MACRO_1 = SAFE_RANGE, - MACRO_2, - MACRO_3, + CUSTOM_1 = SAFE_RANGE, + CUSTOM_2, + CUSTOM_3, NEW_SAFE_RANGE // Important! }; ``` @@ -165,19 +165,19 @@ enum keyboard_keycodes { ```c bool process_record_kb(uint16_t keycode, keyrecord_t *record) { switch(keycode) { - case MACRO_1: + case CUSTOM_1: if (record->event.pressed) { - SEND_STRING("This is macro #1."); + SEND_STRING("This is custom keycode #1."); } return false; - case MACRO_2: + case CUSTOM_2: if (record->event.pressed) { - SEND_STRING("This is macro #2."); + SEND_STRING("This is custom keycode #2."); } return false; - case MACRO_3: + case CUSTOM_3: if (record->event.pressed) { - SEND_STRING("This is macro #3."); + SEND_STRING("This is custom keycode #3."); } return false; } diff --git a/docs/feature_macros.md b/docs/feature_macros.md index 63b7223db9..08310555fb 100644 --- a/docs/feature_macros.md +++ b/docs/feature_macros.md @@ -33,7 +33,7 @@ You can define up to 32 macros in a `keymap.json` file, as used by [Configurator ], "layout": "LAYOUT_all", "layers": [ - ["MACRO_0", "MACRO_1", "MACRO_2", "MACRO_3"] + ["QK_MACRO_0", "QK_MACRO_1", "QK_MACRO_2", "QK_MACRO_3"] ] } ``` @@ -52,7 +52,7 @@ If you type in a language other than English, or use a non-QWERTY layout like Co ], "layout": "LAYOUT_all", "layers": [ - ["MACRO_0"] + ["QK_MACRO_0"] ] } ``` @@ -199,7 +199,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { #### Advanced Macros -In addition to the `process_record_user()` function, is the `post_process_record_user()` function. This runs after `process_record` and can be used to do things after a keystroke has been sent. This is useful if you want to have a key pressed before and released after a normal key, for instance. +In addition to the `process_record_user()` function, is the `post_process_record_user()` function. This runs after `process_record` and can be used to do things after a keystroke has been sent. This is useful if you want to have a key pressed before and released after a normal key, for instance. In this example, we modify most normal keypresses so that `F22` is pressed before the keystroke is normally sent, and release it __only after__ it's been released. diff --git a/docs/zh-cn/configurator_default_keymaps.md b/docs/zh-cn/configurator_default_keymaps.md index 82e4ca818d..c446a45714 100644 --- a/docs/zh-cn/configurator_default_keymaps.md +++ b/docs/zh-cn/configurator_default_keymaps.md @@ -127,26 +127,26 @@ enum layer_names { ```c enum custom_keycodes { - MACRO_1 = SAFE_RANGE, - MACRO_2, - MACRO_3 + CUSTOM_1 = SAFE_RANGE, + CUSTOM_2, + CUSTOM_3 }; ... bool process_record_user(uint16_t keycode, keyrecord_t *record) { switch(keycode) { - case MACRO_1: + case CUSTOM_1: if (record->event.pressed) { - SEND_STRING("This is macro #1."); + SEND_STRING("This is custom keycode #1."); } return false; - case MACRO_2: + case CUSTOM_2: if (record->event.pressed) { - SEND_STRING("This is macro #2."); + SEND_STRING("This is custom keycode #2."); } return false; - case MACRO_3: + case CUSTOM_3: if (record->event.pressed) { - SEND_STRING("This is macro #3."); + SEND_STRING("This is custom keycode #3."); } return false; } @@ -158,9 +158,9 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { ```c enum keyboard_keycodes { - MACRO_1 = SAFE_RANGE, - MACRO_2, - MACRO_3, + CUSTOM_1 = SAFE_RANGE, + CUSTOM_2, + CUSTOM_3, NEW_SAFE_RANGE // 重要! }; ``` @@ -170,19 +170,19 @@ enum keyboard_keycodes { ```c bool process_record_kb(uint16_t keycode, keyrecord_t *record) { switch(keycode) { - case MACRO_1: + case CUSTOM_1: if (record->event.pressed) { - SEND_STRING("This is macro #1."); + SEND_STRING("This is custom keycode #1."); } return false; - case MACRO_2: + case CUSTOM_2: if (record->event.pressed) { - SEND_STRING("This is macro #2."); + SEND_STRING("This is custom keycode #2."); } return false; - case MACRO_3: + case CUSTOM_3: if (record->event.pressed) { - SEND_STRING("This is macro #3."); + SEND_STRING("This is custom keycode #3."); } return false; } |