12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- #include <stdint.h>
- #include <stdbool.h>
- #include <avr/pgmspace.h>
- #include "keycode.h"
- #include "action.h"
- #include "action_macro.h"
- #include "report.h"
- #include "host.h"
- #include "debug.h"
- #include "keymap.h"
- #define KEYMAP( \
- K5A, K5B, K5C, K5D, \
- K4A, K4B, K4C, K4D, \
- K3A, K3B, K3C, K3D, \
- K2A, K2B, K2C, \
- K1A, K1B, K1C, K1D, \
- K0A, K0B, K0C \
- ) { \
- \
- { KC_##K5A, KC_##K5B, KC_##K5C, KC_##K5D}, \
- { KC_##K4A, KC_##K4B, KC_##K4C, KC_##K4D}, \
- { KC_##K3A, KC_##K3B, KC_##K3C, KC_##K3D}, \
- { KC_##K2A, KC_##K2B, KC_##K2C, KC_NO}, \
- { KC_##K1A, KC_##K1B, KC_##K1C, KC_##K1D}, \
- { KC_##K0A, KC_##K0B, KC_##K0C, KC_NO, } \
- }
- #include "keymap_lightpad.h"
- #define KEYMAPS_SIZE (sizeof(keymaps) / sizeof(keymaps[0]))
- #define FN_ACTIONS_SIZE (sizeof(fn_actions) / sizeof(fn_actions[0]))
- uint8_t keymap_key_to_keycode(uint8_t layer, keypos_t key)
- {
- if (layer < KEYMAPS_SIZE) {
- return pgm_read_byte(&keymaps[(layer)][(key.row)][(key.col)]);
- } else {
-
- return pgm_read_byte(&keymaps[0][(key.row)][(key.col)]);
- }
- }
- action_t keymap_fn_to_action(uint8_t keycode)
- {
- action_t action;
- if (FN_INDEX(keycode) < FN_ACTIONS_SIZE) {
- action.code = pgm_read_word(&fn_actions[FN_INDEX(keycode)]);
- } else {
- action.code = ACTION_NO;
- }
- return action;
- }
|