diff options
author | QMK Bot <hello@qmk.fm> | 2023-04-21 01:42:46 +0000 |
---|---|---|
committer | QMK Bot <hello@qmk.fm> | 2023-04-21 01:42:46 +0000 |
commit | 691706d61919f56a906e5f5cbd674245a9df2da4 (patch) | |
tree | 4a4bbf38e628889c1c1cbd161dee58d8dc19bf37 | |
parent | f13f865e09c72e08543dd4a8554242871cac9ef0 (diff) | |
parent | 974c01b4f845927ad3922ae62793c33187f5852c (diff) |
Merge remote-tracking branch 'origin/master' into develop
-rw-r--r-- | docs/feature_advanced_keycodes.md | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/docs/feature_advanced_keycodes.md b/docs/feature_advanced_keycodes.md index 90f06e405a..3da5e7b32f 100644 --- a/docs/feature_advanced_keycodes.md +++ b/docs/feature_advanced_keycodes.md @@ -37,9 +37,9 @@ For more information on bitwise operators in C, click [here](https://en.wikipedi In practice, this means that you can check whether a given modifier is active with `get_mods() & MOD_BIT(KC_<modifier>)` (see the [list of modifier keycodes](keycodes_basic.md#modifiers)) or with `get_mods() & MOD_MASK_<modifier>` if the difference between left and right hand modifiers is not important and you want to match both. Same thing can be done for one-shot modifiers if you replace `get_mods()` with `get_oneshot_mods()`. -To check that *only* a specific set of mods is active at a time, AND the modifier state and your desired mod mask as explained above and compare the result to the mod mask itself: `get_mods() & <mod mask> == <mod mask>`. +To check that *only* a specific set of mods is active at a time, use a simple equality operator: `get_mods() == <mod mask>`. -For example, let's say you want to trigger a piece of custom code if one-shot left control and one-shot left shift are on but every other one-shot mods are off. To do so, you can compose the desired mod mask by combining the mod bits for left control and shift with `(MOD_BIT(KC_LCTL) | MOD_BIT(KC_LSFT))` and then plug it in: `get_oneshot_mods() & (MOD_BIT(KC_LCTL) | MOD_BIT(KC_LSFT)) == (MOD_BIT(KC_LCTL) | MOD_BIT(KC_LSFT))`. Using `MOD_MASK_CS` instead for the mod bitmask would have forced you to press four modifier keys (both versions of control and shift) to fulfill the condition. +For example, let's say you want to trigger a piece of custom code if one-shot left control and one-shot left shift are on but every other one-shot mods are off. To do so, you can compose the desired mod mask by combining the mod bits for left control and shift with `(MOD_BIT(KC_LCTL) | MOD_BIT(KC_LSFT))` and then plug it in: `get_oneshot_mods() == (MOD_BIT(KC_LCTL) | MOD_BIT(KC_LSFT))`. Using `MOD_MASK_CS` instead for the mod bitmask would have forced you to press four modifier keys (both versions of control and shift) to fulfill the condition. The full list of mod masks is as follows: @@ -184,4 +184,4 @@ This page used to encompass a large set of features. We have moved many sections ## Key Overrides :id=key-overrides -* [Key Overrides](feature_key_overrides.md)
\ No newline at end of file +* [Key Overrides](feature_key_overrides.md) |