]>
git.gir.st - tmk_keyboard.git/blob - tmk_core/common/unimap.c
6 # include <avr/pgmspace.h>
10 /* Keymapping with 16bit action codes */
11 extern const action_t actionmaps
[][UNIMAP_ROWS
][UNIMAP_COLS
];
13 // table translates matrix to universal keymap
14 extern const uint8_t unimap_trans
[MATRIX_ROWS
][MATRIX_COLS
];
18 // translates raw matrix to universal map
19 keypos_t
unimap_translate(keypos_t key
)
23 pgm_read_byte(&unimap_trans
[key
.row
][key
.col
]);
25 unimap_trans
[key
.row
][key
.col
];
28 .row
= ((unimap_pos
& 0xf0) >> 4),
29 .col
= (unimap_pos
& 0x0f)
33 /* Converts key to action */
34 __attribute__ ((weak
))
35 action_t
action_for_key(uint8_t layer
, keypos_t key
)
37 keypos_t uni
= unimap_translate(key
);
38 if ((uni
.row
<< 4 | uni
.col
) == UNIMAP_NO
) {
39 return (action_t
)ACTION_NO
;
42 return (action_t
)pgm_read_word(&actionmaps
[(layer
)][(uni
.row
& 0x7)][(uni
.col
)]);
44 return actionmaps
[(layer
)][(uni
.row
& 0x7)][(uni
.col
)];
49 __attribute__ ((weak
))
50 const macro_t
*action_get_macro(keyrecord_t
*record
, uint8_t id
, uint8_t opt
)
56 __attribute__ ((weak
))
57 void action_function(keyrecord_t
*record
, uint8_t id
, uint8_t opt
)