From: tmk Date: Thu, 8 Sep 2016 04:18:05 +0000 (+0900) Subject: core: Fix unimap UNIMAP_NO case X-Git-Url: https://git.friedersdorff.com/?a=commitdiff_plain;h=384562bc8a25ae63bc2a93e9b7436a7d873e4a51;p=max%2Ftmk_keyboard.git core: Fix unimap UNIMAP_NO case --- diff --git a/tmk_core/common/unimap.c b/tmk_core/common/unimap.c index c3d6c264..84109b5a 100644 --- a/tmk_core/common/unimap.c +++ b/tmk_core/common/unimap.c @@ -25,8 +25,8 @@ keypos_t unimap_translate(keypos_t key) unimap_trans[key.row][key.col]; #endif return (keypos_t) { - .row = ((unimap_pos & 0x70) >> 4), - .col = (unimap_pos & 0x0F) + .row = ((unimap_pos & 0xf0) >> 4), + .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) == UNIMAP_NO) { + 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 & 0x7)][(uni.col)]); #else - return actionmaps[(layer)][(uni.row)][(uni.col)]; + return actionmaps[(layer)][(uni.row & 0x7)][(uni.col)]; #endif }