[Keyboard] Add encoder map support for GMMK Pro (#18600)

This commit is contained in:
adophoxia 2022-10-05 10:42:21 -07:00 committed by GitHub
parent cb9241e8b9
commit 8cbb043fac
4 changed files with 18 additions and 20 deletions

View file

@ -77,13 +77,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
}; };
// clang-format on // clang-format on
#ifdef ENCODER_ENABLE #if defined(ENCODER_MAP_ENABLE)
bool encoder_update_user(uint8_t index, bool clockwise) { const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = {
if (clockwise) { [0] = { ENCODER_CCW_CW(KC_VOLU, KC_VOLD) },
tap_code(KC_VOLU); [1] = { ENCODER_CCW_CW(KC_TRNS, KC_TRNS) },
} else { [2] = { ENCODER_CCW_CW(KC_TRNS, KC_TRNS) },
tap_code(KC_VOLD); [3] = { ENCODER_CCW_CW(KC_TRNS, KC_TRNS) }
} };
return false; #endif
}
#endif // ENCODER_ENABLE

View file

@ -1 +1,2 @@
VIA_ENABLE = yes VIA_ENABLE = yes
ENCODER_MAP_ENABLE = yes

View file

@ -79,13 +79,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
}; };
// clang-format on // clang-format on
#ifdef ENCODER_ENABLE #if defined(ENCODER_MAP_ENABLE)
bool encoder_update_user(uint8_t index, bool clockwise) { const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = {
if (clockwise) { [0] = { ENCODER_CCW_CW(KC_VOLU, KC_VOLD) },
tap_code(KC_VOLU); [1] = { ENCODER_CCW_CW(KC_TRNS, KC_TRNS) },
} else { [2] = { ENCODER_CCW_CW(KC_TRNS, KC_TRNS) },
tap_code(KC_VOLD); [3] = { ENCODER_CCW_CW(KC_TRNS, KC_TRNS) }
} };
return false; #endif
}
#endif // ENCODER_ENABLE

View file

@ -1 +1,2 @@
VIA_ENABLE = yes VIA_ENABLE = yes
ENCODER_MAP_ENABLE = yes