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

Macro keycode name refactoring #18958

Merged
merged 6 commits into from
Nov 5, 2022
Merged
Show file tree
Hide file tree
Changes from 5 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
66 changes: 33 additions & 33 deletions data/constants/keycodes/keycodes_0.0.1_macro.hjson
Original file line number Diff line number Diff line change
Expand Up @@ -3,131 +3,131 @@

"0x7700": {
"group": "macro",
"key": "MACRO_0"
"key": "QK_MACRO_0"
},
"0x7701": {
"group": "macro",
"key": "MACRO_1"
"key": "QK_MACRO_1"
},
"0x7702": {
"group": "macro",
"key": "MACRO_2"
"key": "QK_MACRO_2"
},
"0x7703": {
"group": "macro",
"key": "MACRO_3"
"key": "QK_MACRO_3"
},
"0x7704": {
"group": "macro",
"key": "MACRO_4"
"key": "QK_MACRO_4"
},
"0x7705": {
"group": "macro",
"key": "MACRO_5"
"key": "QK_MACRO_5"
},
"0x7706": {
"group": "macro",
"key": "MACRO_6"
"key": "QK_MACRO_6"
},
"0x7707": {
"group": "macro",
"key": "MACRO_7"
"key": "QK_MACRO_7"
},
"0x7708": {
"group": "macro",
"key": "MACRO_8"
"key": "QK_MACRO_8"
},
"0x7709": {
"group": "macro",
"key": "MACRO_9"
"key": "QK_MACRO_9"
},
"0x770A": {
"group": "macro",
"key": "MACRO_10"
"key": "QK_MACRO_10"
},
"0x770B": {
"group": "macro",
"key": "MACRO_11"
"key": "QK_MACRO_11"
},
"0x770C": {
"group": "macro",
"key": "MACRO_12"
"key": "QK_MACRO_12"
},
"0x770D": {
"group": "macro",
"key": "MACRO_13"
"key": "QK_MACRO_13"
},
"0x770E": {
"group": "macro",
"key": "MACRO_14"
"key": "QK_MACRO_14"
},
"0x770F": {
"group": "macro",
"key": "MACRO_15"
"key": "QK_MACRO_15"
},
"0x7710": {
"group": "macro",
"key": "MACRO_16"
"key": "QK_MACRO_16"
},
"0x7711": {
"group": "macro",
"key": "MACRO_17"
"key": "QK_MACRO_17"
},
"0x7712": {
"group": "macro",
"key": "MACRO_18"
"key": "QK_MACRO_18"
},
"0x7713": {
"group": "macro",
"key": "MACRO_19"
"key": "QK_MACRO_19"
},
"0x7714": {
"group": "macro",
"key": "MACRO_20"
"key": "QK_MACRO_20"
},
"0x7715": {
"group": "macro",
"key": "MACRO_21"
"key": "QK_MACRO_21"
},
"0x7716": {
"group": "macro",
"key": "MACRO_22"
"key": "QK_MACRO_22"
},
"0x7717": {
"group": "macro",
"key": "MACRO_23"
"key": "QK_MACRO_23"
},
"0x7718": {
"group": "macro",
"key": "MACRO_24"
"key": "QK_MACRO_24"
},
"0x7719": {
"group": "macro",
"key": "MACRO_25"
"key": "QK_MACRO_25"
},
"0x771A": {
"group": "macro",
"key": "MACRO_26"
"key": "QK_MACRO_26"
},
"0x771B": {
"group": "macro",
"key": "MACRO_27"
"key": "QK_MACRO_27"
},
"0x771C": {
"group": "macro",
"key": "MACRO_28"
"key": "QK_MACRO_28"
},
"0x771D": {
"group": "macro",
"key": "MACRO_29"
"key": "QK_MACRO_29"
},
"0x771E": {
"group": "macro",
"key": "MACRO_30"
"key": "QK_MACRO_30"
},
"0x771F": {
"group": "macro",
"key": "MACRO_31"
"key": "QK_MACRO_31"
}
}
}
}
10 changes: 5 additions & 5 deletions docs/ChangeLog/20211127.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,27 +56,27 @@ 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"]}
]
],
"layout": "LAYOUT_all",
"layers": [
["MACRO_0", "MACRO_1", "MACRO_2", "MACRO_3"]
["QK_MACRO_0", "QK_MACRO_1", "QK_MACRO_2", "QK_MACRO_3"]
]
}
```
Expand Down
36 changes: 18 additions & 18 deletions docs/configurator_default_keymaps.md
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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!
};
```
Expand All @@ -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;
}
Expand Down
6 changes: 3 additions & 3 deletions docs/feature_macros.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
]
}
```
Expand All @@ -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"]
]
}
```
Expand Down Expand Up @@ -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.

Expand Down
36 changes: 18 additions & 18 deletions docs/zh-cn/configurator_default_keymaps.md
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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 // 重要!
};
```
Expand All @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"keyboard": "handwired/pytest/basic",
"keymap": "default_json",
"layout": "LAYOUT_ortho_1x1",
"layers": [["MACRO_0"]],
"layers": [["QK_MACRO_0"]],
"macros": [
[
"Hello, World!",
Expand Down
8 changes: 4 additions & 4 deletions keyboards/work_louder/work_board/keymaps/via/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
MO(3), KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT
),
[_LOWER] = LAYOUT(
KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC, _______,
KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE,
_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, S(KC_NUHS),S(KC_NUBS),KC_HOME, KC_END, _______,
_______, _______, _______, MACRO_1, _______, MACRO_0, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY
KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC, _______,
KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE,
_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, S(KC_NUHS),S(KC_NUBS),KC_HOME, KC_END, _______,
_______, _______, _______, QK_MACRO_1, _______, QK_MACRO_0, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY
tzarc marked this conversation as resolved.
Show resolved Hide resolved
),
[_RAISE] = LAYOUT(
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, _______,
Expand Down
Loading