summaryrefslogtreecommitdiff
path: root/quantum/keymap_common.c
diff options
context:
space:
mode:
authorDrashna Jael're <drashna@live.com>2022-05-29 15:38:33 -0700
committerDrashna Jael're <drashna@live.com>2022-05-29 15:38:33 -0700
commit30aac80d5a6d8c6f7c06efb49189d748e70edc4a (patch)
treeceb11968ae41228e4b110c07467cdca7cc9cff22 /quantum/keymap_common.c
parent67f4e5f34489abf986dedb4984b256692086c615 (diff)
parente22a183329fd05d39f88bb9dfebe98cfa7cd8402 (diff)
Merge remote-tracking branch 'qmk 0.17.0' into firmware21
Diffstat (limited to 'quantum/keymap_common.c')
-rw-r--r--quantum/keymap_common.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/quantum/keymap_common.c b/quantum/keymap_common.c
index a91b2a0b36..c1940f0fd3 100644
--- a/quantum/keymap_common.c
+++ b/quantum/keymap_common.c
@@ -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;
}