Add support for encoder mapping. (#13286)

This commit is contained in:
Nick Brassel 2022-03-09 19:29:00 +11:00 committed by GitHub
parent 7121a228eb
commit 8d5eacb7dd
Failed to generate hash of commit
16 changed files with 279 additions and 53 deletions

View file

@ -148,6 +148,15 @@ action_t action_for_keycode(uint16_t keycode) {
// translates key to keycode
__attribute__((weak)) uint16_t keymap_key_to_keycode(uint8_t layer, keypos_t key) {
// Read entire word (16bits)
return pgm_read_word(&keymaps[(layer)][(key.row)][(key.col)]);
if (key.row < MATRIX_ROWS && key.col < MATRIX_COLS) {
return pgm_read_word(&keymaps[layer][key.row][key.col]);
}
#ifdef ENCODER_MAP_ENABLE
else if (key.row == KEYLOC_ENCODER_CW && key.col < NUM_ENCODERS) {
return pgm_read_word(&encoder_map[layer][key.col][0]);
} else if (key.row == KEYLOC_ENCODER_CCW && key.col < NUM_ENCODERS) {
return pgm_read_word(&encoder_map[layer][key.col][1]);
}
#endif // ENCODER_MAP_ENABLE
return KC_NO;
}