X-Git-Url: https://git.friedersdorff.com/?a=blobdiff_plain;f=tmk_core%2Fcommon%2Funimap.c;h=fcdc93bda03074f86ae5199ae5413810a63a3beb;hb=e7d6d24c17ba103282bf8126011816fc3a0adac3;hp=c3d6c264b1f473e0db4e3372aeb5a29064e79187;hpb=e84a5981e3f0604af77b888927c82bbb6f32b6c1;p=max%2Ftmk_keyboard.git diff --git a/tmk_core/common/unimap.c b/tmk_core/common/unimap.c index c3d6c264..fcdc93bd 100644 --- a/tmk_core/common/unimap.c +++ b/tmk_core/common/unimap.c @@ -25,7 +25,7 @@ keypos_t unimap_translate(keypos_t key) unimap_trans[key.row][key.col]; #endif return (keypos_t) { - .row = ((unimap_pos & 0x70) >> 4), + .row = ((unimap_pos >> 4 ) & 0x07), .col = (unimap_pos & 0x0F) }; } @@ -35,11 +35,13 @@ __attribute__ ((weak)) action_t action_for_key(uint8_t layer, keypos_t key) { keypos_t uni = unimap_translate(key); - if ((uni.row << 4 | uni.col) == UNIMAP_NO) return (action_t)ACTION_NO; + if ((uni.row << 4 | uni.col) > 0x7F) { + return (action_t)ACTION_NO; + } #if defined(__AVR__) - return (action_t)pgm_read_word(&actionmaps[(layer)][(uni.row)][(uni.col)]); + return (action_t)pgm_read_word(&actionmaps[(layer)][(uni.row & 0x07)][(uni.col & 0x0F)]); #else - return actionmaps[(layer)][(uni.row)][(uni.col)]; + return actionmaps[(layer)][(uni.row & 0x07)][(uni.col & 0x0F)]; #endif }