Skip to content

Commit d0a8f13

Browse files
committed
core: Fix unimap UNIMAP_NO case
1 parent e17abef commit d0a8f13

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

common/unimap.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ keypos_t unimap_translate(keypos_t key)
2525
unimap_trans[key.row][key.col];
2626
#endif
2727
return (keypos_t) {
28-
.row = ((unimap_pos & 0x70) >> 4),
29-
.col = (unimap_pos & 0x0F)
28+
.row = ((unimap_pos & 0xf0) >> 4),
29+
.col = (unimap_pos & 0x0f)
3030
};
3131
}
3232

@@ -35,11 +35,13 @@ __attribute__ ((weak))
3535
action_t action_for_key(uint8_t layer, keypos_t key)
3636
{
3737
keypos_t uni = unimap_translate(key);
38-
if ((uni.row << 4 | uni.col) == UNIMAP_NO) return (action_t)ACTION_NO;
38+
if ((uni.row << 4 | uni.col) == UNIMAP_NO) {
39+
return (action_t)ACTION_NO;
40+
}
3941
#if defined(__AVR__)
40-
return (action_t)pgm_read_word(&actionmaps[(layer)][(uni.row)][(uni.col)]);
42+
return (action_t)pgm_read_word(&actionmaps[(layer)][(uni.row & 0x7)][(uni.col)]);
4143
#else
42-
return actionmaps[(layer)][(uni.row)][(uni.col)];
44+
return actionmaps[(layer)][(uni.row & 0x7)][(uni.col)];
4345
#endif
4446
}
4547

0 commit comments

Comments
 (0)