]> git.donarmstrong.com Git - qmk_firmware.git/blob - keyboard/planck/extended_keymap_common.h
Merge branch 'master' of https://github.com/jackhumbert/tmk_keyboard
[qmk_firmware.git] / keyboard / planck / extended_keymap_common.h
1 /*
2 Copyright 2012,2013 Jun Wako <wakojun@gmail.com>
3
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.
8
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.
13
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/>.
16 */
17
18 #ifndef KEYMAP_H
19 #define KEYMAP_H
20
21 #include <stdint.h>
22 #include <stdbool.h>
23 #include "action.h"
24 #include <avr/pgmspace.h>
25 #include "keycode.h"
26 #include "keymap.h"
27 #include "action_macro.h"
28 #include "report.h"
29 #include "host.h"
30 #include "print.h"
31 #include "debug.h"
32
33 #ifdef BOOTMAGIC_ENABLE
34 /* NOTE: Not portable. Bit field order depends on implementation */
35 typedef union {
36     uint16_t raw;
37     struct {
38         bool swap_control_capslock:1;
39         bool capslock_to_control:1;
40         bool swap_lalt_lgui:1;
41         bool swap_ralt_rgui:1;
42         bool no_gui:1;
43         bool swap_grave_esc:1;
44         bool swap_backslash_backspace:1;
45         bool nkro:1;
46     };
47 } keymap_config_t;
48 keymap_config_t keymap_config;
49 #endif
50
51 /* translates key to keycode */
52 uint16_t keymap_key_to_keycode(uint8_t layer, keypos_t key);
53
54 /* translates Fn keycode to action */
55 action_t keymap_fn_to_action(uint16_t keycode);
56
57 extern const uint16_t keymaps[][MATRIX_ROWS][MATRIX_COLS];
58 extern const uint16_t fn_actions[];
59
60 // Ability to use mods in layouts
61 #define LCTL(kc) kc | 0x0100
62 #define LSFT(kc) kc | 0x0200
63 #define LALT(kc) kc | 0x0400
64 #define LGUI(kc) kc | 0x0800
65 #define RCTL(kc) kc | 0x1100
66 #define RSFT(kc) kc | 0x1200
67 #define RALT(kc) kc | 0x1400
68 #define RGUI(kc) kc | 0x1800
69
70 #define S(kc) LSFT(kc)
71
72 #endif