2 Copyright 2013 Jun Wako <wakojun@gmail.com>
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see <http://www.gnu.org/licenses/>.
23 uint8_t default_layer = 0;
24 uint8_t current_layer = 0;
27 #ifndef NO_LEGACY_KEYMAP_SUPPORT
28 /* legacy support with weak reference */
29 __attribute__ ((weak))
30 action_t keymap_get_action(uint8_t layer, uint8_t row, uint8_t col)
32 /* convert from legacy keycode to action */
33 uint8_t key = keymap_get_keycode(layer, row, col);
36 case KC_A ... KC_EXSEL:
37 action.code = ACTION_KEY(key);
39 case KC_LCTRL ... KC_LGUI:
40 action.code = ACTION_LMOD(key);
42 case KC_RCTRL ... KC_RGUI:
43 action.code = ACTION_RMOD(key);
45 case KC_SYSTEM_POWER ... KC_SYSTEM_WAKE:
46 action.code = ACTION_USAGE_SYSTEM(KEYCODE2SYSTEM(key));
48 case KC_AUDIO_MUTE ... KC_WWW_FAVORITES:
49 action.code = ACTION_USAGE_CONSUMER(KEYCODE2CONSUMER(key));
51 case KC_MS_UP ... KC_MS_ACCEL2:
52 action.code = ACTION_MOUSEKEY(key);
54 case KC_FN0 ... KC_FN31:
56 uint8_t layer = keymap_fn_layer(FN_INDEX(key));
57 uint8_t code = keymap_fn_keycode(FN_INDEX(key));
58 action.code = ACTION_LAYER_SET_TAP_KEY(layer, code);
61 case KC_NO ... KC_UNDEFINED:
63 action.code = ACTION_NO;
70 __attribute__ ((weak))
71 void action_call_function(keyevent_t event, uint8_t id)