aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJack Humbert <jack.humb@gmail.com>2015-08-22 11:10:57 -0400
committerJack Humbert <jack.humb@gmail.com>2015-08-22 11:10:57 -0400
commit5d2baede8a4f401e34df9421108a5f350cc0aeeb (patch)
tree04672f36b95deede2a19fd1c00eb1e1c8f8e1849
parent476e29d1190ac45b810109512bbb50cc4769493b (diff)
downloadqmk_firmware-5d2baede8a4f401e34df9421108a5f350cc0aeeb.tar.gz
qmk_firmware-5d2baede8a4f401e34df9421108a5f350cc0aeeb.zip
making the extended keymap the default - no more 'common'
-rwxr-xr-xkeyboard/planck/Config/LUFAConfig.h93
-rw-r--r--keyboard/planck/Makefile38
-rw-r--r--keyboard/planck/PCB_GUIDE.md9
-rw-r--r--keyboard/planck/README.md20
-rw-r--r--keyboard/planck/extended_keymap_common.c210
-rw-r--r--keyboard/planck/extended_keymap_common.h180
-rw-r--r--keyboard/planck/extended_keymaps/extended_keymap_angerthosenear.c50
-rw-r--r--keyboard/planck/extended_keymaps/extended_keymap_austin.c50
-rw-r--r--keyboard/planck/extended_keymaps/extended_keymap_charlie.c54
-rw-r--r--keyboard/planck/extended_keymaps/extended_keymap_daniel.c48
-rw-r--r--keyboard/planck/extended_keymaps/extended_keymap_david.c76
-rw-r--r--keyboard/planck/extended_keymaps/extended_keymap_dzobert.c49
-rw-r--r--keyboard/planck/extended_keymaps/extended_keymap_jack.c50
-rw-r--r--keyboard/planck/extended_keymaps/extended_keymap_joe.c88
-rw-r--r--keyboard/planck/extended_keymaps/extended_keymap_kyle.c49
-rw-r--r--keyboard/planck/extended_keymaps/extended_keymap_leo.c46
-rw-r--r--keyboard/planck/extended_keymaps/extended_keymap_lock.c65
-rw-r--r--keyboard/planck/extended_keymaps/extended_keymap_max.c49
-rw-r--r--keyboard/planck/extended_keymaps/extended_keymap_numpad.c26
-rw-r--r--keyboard/planck/keymap_common.c186
-rw-r--r--keyboard/planck/keymap_common.h241
-rw-r--r--keyboard/planck/keymaps/keymap_default.c (renamed from keyboard/planck/extended_keymaps/extended_keymap_default.c)5
-rw-r--r--keyboard/planck/matrix.c1
-rw-r--r--keyboard/planck/matrix_center.c269
-rw-r--r--keyboard/planck/matrix_handwired.c193
-rw-r--r--keyboard/planck/matrix_pcb.c222
-rw-r--r--keyboard/planck/old_keymap_files/common_keymaps/keymap_brett.c (renamed from keyboard/planck/common_keymaps/keymap_brett.c)0
-rw-r--r--keyboard/planck/old_keymap_files/common_keymaps/keymap_dotcom.c (renamed from keyboard/planck/common_keymaps/keymap_dotcom.c)0
-rw-r--r--keyboard/planck/old_keymap_files/common_keymaps/keymap_jack.c (renamed from keyboard/planck/common_keymaps/keymap_jack.c)0
-rw-r--r--keyboard/planck/old_keymap_files/common_keymaps/keymap_joe.c (renamed from keyboard/planck/common_keymaps/keymap_joe.c)0
-rw-r--r--keyboard/planck/old_keymap_files/common_keymaps/keymap_matthew.c (renamed from keyboard/planck/common_keymaps/keymap_matthew.c)0
-rw-r--r--keyboard/planck/old_keymap_files/common_keymaps/keymap_nathan.c (renamed from keyboard/planck/common_keymaps/keymap_nathan.c)0
-rw-r--r--keyboard/planck/old_keymap_files/common_keymaps/keymap_paul.c (renamed from keyboard/planck/common_keymaps/keymap_paul.c)0
-rw-r--r--keyboard/planck/old_keymap_files/common_keymaps/keymap_peasant.c (renamed from keyboard/planck/common_keymaps/keymap_peasant.c)0
-rw-r--r--keyboard/planck/old_keymap_files/common_keymaps/keymap_reed.c (renamed from keyboard/planck/common_keymaps/keymap_reed.c)0
-rw-r--r--keyboard/planck/old_keymap_files/common_keymaps/keymap_sean.c (renamed from keyboard/planck/common_keymaps/keymap_sean.c)0
-rw-r--r--keyboard/planck/old_keymap_files/common_keymaps/keymap_shane.c (renamed from keyboard/planck/common_keymaps/keymap_shane.c)0
-rw-r--r--keyboard/planck/old_keymap_files/common_keymaps/keymap_simon.c (renamed from keyboard/planck/common_keymaps/keymap_simon.c)0
-rw-r--r--keyboard/planck/old_keymap_files/common_keymaps/keymap_tim.c (renamed from keyboard/planck/common_keymaps/keymap_tim.c)0
-rw-r--r--keyboard/planck/old_keymap_files/common_keymaps/keymap_wilba.c (renamed from keyboard/planck/common_keymaps/keymap_wilba.c)0
-rw-r--r--keyboard/planck/old_keymap_files/keymap_common.c30
-rw-r--r--keyboard/planck/old_keymap_files/keymap_common.h129
42 files changed, 507 insertions, 2019 deletions
diff --git a/keyboard/planck/Config/LUFAConfig.h b/keyboard/planck/Config/LUFAConfig.h
deleted file mode 100755
index fa9404498..000000000
--- a/keyboard/planck/Config/LUFAConfig.h
+++ /dev/null
@@ -1,93 +0,0 @@
1/*
2 LUFA Library
3 Copyright (C) Dean Camera, 2012.
4
5 dean [at] fourwalledcubicle [dot] com
6 www.lufa-lib.org
7*/
8
9/*
10 Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com)
11
12 Permission to use, copy, modify, distribute, and sell this
13 software and its documentation for any purpose is hereby granted
14 without fee, provided that the above copyright notice appear in
15 all copies and that both that the copyright notice and this
16 permission notice and warranty disclaimer appear in supporting
17 documentation, and that the name of the author not be used in
18 advertising or publicity pertaining to distribution of the
19 software without specific, written prior permission.
20
21 The author disclaim all warranties with regard to this
22 software, including all implied warranties of merchantability
23 and fitness. In no event shall the author be liable for any
24 special, indirect or consequential damages or any damages
25 whatsoever resulting from loss of use, data or profits, whether
26 in an action of contract, negligence or other tortious action,
27 arising out of or in connection with the use or performance of
28 this software.
29*/
30
31/** \file
32 * \brief LUFA Library Configuration Header File
33 *
34 * This header file is used to configure LUFA's compile time options,
35 * as an alternative to the compile time constants supplied through
36 * a makefile.
37 *
38 * For information on what each token does, refer to the LUFA
39 * manual section "Summary of Compile Tokens".
40 */
41
42#ifndef _LUFA_CONFIG_H_
43#define _LUFA_CONFIG_H_
44
45 #if (ARCH == ARCH_AVR8)
46
47 /* Non-USB Related Configuration Tokens: */
48// #define DISABLE_TERMINAL_CODES
49
50 /* USB Class Driver Related Tokens: */
51// #define HID_HOST_BOOT_PROTOCOL_ONLY
52// #define HID_STATETABLE_STACK_DEPTH {Insert Value Here}
53// #define HID_USAGE_STACK_DEPTH {Insert Value Here}
54// #define HID_MAX_COLLECTIONS {Insert Value Here}
55// #define HID_MAX_REPORTITEMS {Insert Value Here}
56// #define HID_MAX_REPORT_IDS {Insert Value Here}
57// #define NO_CLASS_DRIVER_AUTOFLUSH
58
59 /* General USB Driver Related Tokens: */
60// #define ORDERED_EP_CONFIG
61 #define USE_STATIC_OPTIONS (USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)
62 #define USB_DEVICE_ONLY
63// #define USB_HOST_ONLY
64// #define USB_STREAM_TIMEOUT_MS {Insert Value Here}
65// #define NO_LIMITED_CONTROLLER_CONNECT
66// #define NO_SOF_EVENTS
67
68 /* USB Device Mode Driver Related Tokens: */
69// #define USE_RAM_DESCRIPTORS
70 #define USE_FLASH_DESCRIPTORS
71// #define USE_EEPROM_DESCRIPTORS
72// #define NO_INTERNAL_SERIAL
73 #define FIXED_CONTROL_ENDPOINT_SIZE 8
74// #define DEVICE_STATE_AS_GPIOR {Insert Value Here}
75 #define FIXED_NUM_CONFIGURATIONS 1
76// #define CONTROL_ONLY_DEVICE
77// #define INTERRUPT_CONTROL_ENDPOINT
78// #define NO_DEVICE_REMOTE_WAKEUP
79// #define NO_DEVICE_SELF_POWER
80
81 /* USB Host Mode Driver Related Tokens: */
82// #define HOST_STATE_AS_GPIOR {Insert Value Here}
83// #define USB_HOST_TIMEOUT_MS {Insert Value Here}
84// #define HOST_DEVICE_SETTLE_DELAY_MS {Insert Value Here}
85// #define NO_AUTO_VBUS_MANAGEMENT
86// #define INVERTED_VBUS_ENABLE_LINE
87
88 #else
89
90 #error Unsupported architecture for this LUFA configuration file.
91
92 #endif
93#endif
diff --git a/keyboard/planck/Makefile b/keyboard/planck/Makefile
index ad25854e6..9f7634d99 100644
--- a/keyboard/planck/Makefile
+++ b/keyboard/planck/Makefile
@@ -41,46 +41,23 @@
41# Target file name (without extension). 41# Target file name (without extension).
42TARGET = planck_lufa 42TARGET = planck_lufa
43 43
44
44# Directory common source filess exist 45# Directory common source filess exist
45TOP_DIR = ../.. 46TOP_DIR = ../..
46 47
47# Directory keyboard dependent files exist 48# Directory keyboard dependent files exist
48TARGET_DIR = . 49TARGET_DIR = .
49 50
50# Default to PCB matrix
51ifndef MATRIX
52 MATRIX=matrix_pcb.c
53endif
54
55$(warning MATRIX: $(MATRIX))
56
57# # project specific files 51# # project specific files
58ifdef COMMON 52SRC = keymap_common.c \
59 53 matrix.c \
60 SRC = keymap_common.c \
61 $(MATRIX) \
62 led.c \ 54 led.c \
63 backlight.c 55 backlight.c
64 56
65ifdef KEYMAP 57ifdef KEYMAP
66 SRC := common_keymaps/keymap_$(KEYMAP).c $(SRC) 58 SRC := keymaps/keymap_$(KEYMAP).c $(SRC)
67else 59else
68 SRC := common_keymaps/keymap_jack.c $(SRC) 60 SRC := keymaps/keymap_default.c $(SRC)
69endif
70
71else
72
73SRC = extended_keymap_common.c \
74 $(MATRIX) \
75 led.c \
76 backlight.c
77
78ifdef KEYMAP
79 SRC := extended_keymaps/extended_keymap_$(KEYMAP).c $(SRC)
80else
81 SRC := extended_keymaps/extended_keymap_default.c $(SRC)
82endif
83
84endif 61endif
85 62
86CONFIG_H = config.h 63CONFIG_H = config.h
@@ -145,8 +122,10 @@ CONSOLE_ENABLE = yes # Console for debug(+400)
145COMMAND_ENABLE = yes # Commands for debug and configuration 122COMMAND_ENABLE = yes # Commands for debug and configuration
146# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE 123# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
147#SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend 124#SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend
148NKRO_ENABLE = yes # USB Nkey Rollover - not yet supported in LUFA 125NKRO_ENABLE = yes # USB Nkey Rollover - not yet supported in LUFA
149BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality 126BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
127#MIDI_ENABLE = YES # MIDI controls
128BACKLIGHT_ENABLE = yes
150 129
151# Optimize size but this may cause error "relocation truncated to fit" 130# Optimize size but this may cause error "relocation truncated to fit"
152#EXTRALDFLAGS = -Wl,--relax 131#EXTRALDFLAGS = -Wl,--relax
@@ -158,3 +137,4 @@ VPATH += $(TOP_DIR)
158include $(TOP_DIR)/protocol/lufa.mk 137include $(TOP_DIR)/protocol/lufa.mk
159include $(TOP_DIR)/common.mk 138include $(TOP_DIR)/common.mk
160include $(TOP_DIR)/rules.mk 139include $(TOP_DIR)/rules.mk
140
diff --git a/keyboard/planck/PCB_GUIDE.md b/keyboard/planck/PCB_GUIDE.md
index c3004c75a..88a6c0140 100644
--- a/keyboard/planck/PCB_GUIDE.md
+++ b/keyboard/planck/PCB_GUIDE.md
@@ -26,10 +26,7 @@ Here is a list of some of the functions available from the command line:
26 26
27* `make clean`: clean the environment - may be required in-between builds 27* `make clean`: clean the environment - may be required in-between builds
28* `make`: compile the code 28* `make`: compile the code
29* `make COMMON=true`: compile with the common (non-extended) keymap
30* `make MATRIX=<matrix_file>`: compile with the referenced matrix file. Default if unspecified is `matrix_pcb.c`. For handwired boards, use `matrix_handwired.c`.
31* `make KEYMAP=<keymap>`: compile with the extended keymap file `extended_keymaps/extended_keymap_<keymap>.c` 29* `make KEYMAP=<keymap>`: compile with the extended keymap file `extended_keymaps/extended_keymap_<keymap>.c`
32* `make COMMON=true KEYMAP=<keymap>`: compile with the common keymap file `common_keymaps/keymap_<keymap>.c`
33* `make dfu`: build and flash the layout to the PCB 30* `make dfu`: build and flash the layout to the PCB
34* `make dfu-force`: build and force-flash the layout to the PCB (may be require for first flash) 31* `make dfu-force`: build and force-flash the layout to the PCB (may be require for first flash)
35 32
@@ -41,11 +38,11 @@ Generally, the instructions to flash the PCB are as follows:
414. Press the reset button on the PCB/press the key with the `RESET` keycode 384. Press the reset button on the PCB/press the key with the `RESET` keycode
425. `make <arguments> dfu` - use the necessary `KEYMAP=<keymap>` and/or `COMMON=true` arguments here. 395. `make <arguments> dfu` - use the necessary `KEYMAP=<keymap>` and/or `COMMON=true` arguments here.
43 40
44## Extended keymap 41## OLKB keymap
45 42
46### Keymap 43### Keymap
47 44
48Unlike the common keymap, prefixing the keycodes with `KC_` is required. A full list of the keycodes is available [here](https://github.com/jackhumbert/tmk_keyboard/blob/master/doc/keycode.txt). For the keycodes available only in the extended keymap, see this [header file](https://github.com/jackhumbert/tmk_keyboard/blob/master/keyboard/planck/extended_keymap_common.h). 45Unlike the other keymaps, prefixing the keycodes with `KC_` is required. A full list of the keycodes is available [here](https://github.com/jackhumbert/tmk_keyboard/blob/master/doc/keycode.txt). For the keycodes available only in the extended keymap, see this [header file](https://github.com/jackhumbert/tmk_keyboard/blob/master/keyboard/planck/keymap_common.h).
49 46
50You can use modifiers with keycodes like this: 47You can use modifiers with keycodes like this:
51 48
@@ -88,7 +85,7 @@ The function actions are unchanged, and you can see the full list of them [here]
88 85
89### Macros 86### Macros
90 87
91Macros have been setup in the `extended_keymaps/extended_keymaps_default.c` file so that you can use `M(<num>)` to access a macro in the `action_get_macro` section on your keymap. The switch/case structure you see here is required, and is setup for `M(0)` - you'll need to copy and paste the code to look like this (e.g. to support `M(3)`): 88Macros have been setup in the `keymaps/keymap_default.c` file so that you can use `M(<num>)` to access a macro in the `action_get_macro` section on your keymap. The switch/case structure you see here is required, and is setup for `M(0)` - you'll need to copy and paste the code to look like this (e.g. to support `M(3)`):
92 89
93 switch(id) { 90 switch(id) {
94 case 0: 91 case 0:
diff --git a/keyboard/planck/README.md b/keyboard/planck/README.md
index ee824d26e..faaee0958 100644
--- a/keyboard/planck/README.md
+++ b/keyboard/planck/README.md
@@ -2,10 +2,10 @@ Planck keyboard firmware
2====================== 2======================
3DIY/Assembled compact ortholinear 40% keyboard by [Ortholinear Keyboards](http://ortholinearkeyboards.com). 3DIY/Assembled compact ortholinear 40% keyboard by [Ortholinear Keyboards](http://ortholinearkeyboards.com).
4 4
5## Extended Keymap 5## OLKB Keymap
6If you include extended_keymap_common.h instead of keymap_common.h at the top of your file, you'll have access to a bunch of goodies: 6You have access to a bunch of goodies:
7 7
8- Use `LSFT()`, `LCTL()`, et. al. (listed in extended_keymap_common.h) as modifiers for keys (daisy-chain-able) 8- Use `LSFT()`, `LCTL()`, et. al. (listed in keymap_common.h) as modifiers for keys (daisy-chain-able)
9- Use `FUNC(1)` instead of `FN1` (etc.) to access the function layers beyond the 32 function layer limit 9- Use `FUNC(1)` instead of `FN1` (etc.) to access the function layers beyond the 32 function layer limit
10- Use `CM_F` instead of `KC_F` to get the ColeMak equivilent for shortcuts (maps backwards) 10- Use `CM_F` instead of `KC_F` to get the ColeMak equivilent for shortcuts (maps backwards)
11- Use `MACRODOWN()` instead of `MACRO()` to easily make a keydown macro (`CM_*` works here too) 11- Use `MACRODOWN()` instead of `MACRO()` to easily make a keydown macro (`CM_*` works here too)
@@ -33,21 +33,13 @@ $ make
33## Keymap 33## Keymap
34Several version of keymap are available in advance but you are recommended to define your favorite layout yourself. To define your own keymap create file named `keymap_<name>.c` and see keymap document (you can find in top README.md) and existent keymap files. 34Several version of keymap are available in advance but you are recommended to define your favorite layout yourself. To define your own keymap create file named `keymap_<name>.c` and see keymap document (you can find in top README.md) and existent keymap files.
35 35
36####**Extended Keymaps** 36####**Keymaps**
37 37
38To build the firmware binary hex file with an extended keymap just do `make` with `KEYMAP` option like: 38To build the firmware binary hex file with an extended keymap just do `make` with `KEYMAP` option like:
39``` 39```
40$ make KEYMAP=[common|jack|<name>] 40$ make KEYMAP=[default|jack|<name>]
41``` 41```
42_The only applicable keymaps will work with this option._ Extended keymaps follow the format **__extended\_keymap\_\<name\>.c__** 42_The only applicable keymaps will work with this option._ Keymaps follow the format **__keymap\_\<name\>.c__** and are stored in the `keymaps` folder.
43
44####**Common Keymaps**
45
46Building with a common keymap is as simple as adding the COMMON option. Note that only
47```
48$ make KEYMAP=[common|jack|<name>] COMMON=true
49```
50_The only applicable keymaps will work with this option._ Common keymaps follow the format **__keymap\_\<name\>.c__**
51 43
52## Notable TMK forks (which some of the keymap files are from) 44## Notable TMK forks (which some of the keymap files are from)
53- [Shane's Fork](https://github.com/shanecelis/tmk_keyboard/tree/master/keyboard/planck) 45- [Shane's Fork](https://github.com/shanecelis/tmk_keyboard/tree/master/keyboard/planck)
diff --git a/keyboard/planck/extended_keymap_common.c b/keyboard/planck/extended_keymap_common.c
deleted file mode 100644
index ade850844..000000000
--- a/keyboard/planck/extended_keymap_common.c
+++ /dev/null
@@ -1,210 +0,0 @@
1/*
2Copyright 2012,2013 Jun Wako <wakojun@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18#include "extended_keymap_common.h"
19#include "report.h"
20#include "keycode.h"
21#include "action_layer.h"
22#include "action.h"
23#include "action_macro.h"
24#include "debug.h"
25#include "backlight.h"
26
27static action_t keycode_to_action(uint16_t keycode);
28
29
30/* converts key to action */
31action_t action_for_key(uint8_t layer, keypos_t key)
32{
33 // 16bit keycodes - important
34 uint16_t keycode = keymap_key_to_keycode(layer, key);
35
36 if (keycode >= 0x0100 && keycode < 0x2000) {
37 // Has a modifier
38 action_t action;
39 // Split it up
40 action.code = ACTION_MODS_KEY(keycode >> 8, keycode & 0xFF);
41 return action;
42 } else if (keycode >= 0x2000 && keycode < 0x3000) {
43 // Is a shortcut for function layer, pull last 12bits
44 return keymap_func_to_action(keycode & 0xFFF);
45 } else if (keycode >= 0x3000 && keycode < 0x4000) {
46 action_t action;
47 action.code = ACTION_MACRO(keycode & 0xFF);
48 return action;
49 } else if (keycode >= BL_0 & keycode <= BL_15) {
50 action_t action;
51 action.code = ACTION_BACKLIGHT_LEVEL(keycode & 0x000F);
52 return action;
53 } else if (keycode == BL_DEC) {
54 action_t action;
55 action.code = ACTION_BACKLIGHT_DECREASE();
56 return action;
57 } else if (keycode == BL_INC) {
58 action_t action;
59 action.code = ACTION_BACKLIGHT_INCREASE();
60 return action;
61 } else if (keycode == BL_TOGG) {
62 action_t action;
63 action.code = ACTION_BACKLIGHT_TOGGLE();
64 return action;
65 } else if (keycode == BL_STEP) {
66 action_t action;
67 action.code = ACTION_BACKLIGHT_STEP();
68 return action;
69 } else if (keycode == RESET) {
70 bootloader_jump();
71 return;
72 } else if (keycode > RESET) {
73 // MIDI
74 return;
75 }
76
77 switch (keycode) {
78 case KC_FN0 ... KC_FN31:
79 return keymap_fn_to_action(keycode);
80#ifdef BOOTMAGIC_ENABLE
81 case KC_CAPSLOCK:
82 case KC_LOCKING_CAPS:
83 if (keymap_config.swap_control_capslock || keymap_config.capslock_to_control) {
84 return keycode_to_action(KC_LCTL);
85 }
86 return keycode_to_action(keycode);
87 case KC_LCTL:
88 if (keymap_config.swap_control_capslock) {
89 return keycode_to_action(KC_CAPSLOCK);
90 }
91 return keycode_to_action(KC_LCTL);
92 case KC_LALT:
93 if (keymap_config.swap_lalt_lgui) {
94 if (keymap_config.no_gui) {
95 return keycode_to_action(ACTION_NO);
96 }
97 return keycode_to_action(KC_LGUI);
98 }
99 return keycode_to_action(KC_LALT);
100 case KC_LGUI:
101 if (keymap_config.swap_lalt_lgui) {
102 return keycode_to_action(KC_LALT);
103 }
104 if (keymap_config.no_gui) {
105 return keycode_to_action(ACTION_NO);
106 }
107 return keycode_to_action(KC_LGUI);
108 case KC_RALT:
109 if (keymap_config.swap_ralt_rgui) {
110 if (keymap_config.no_gui) {
111 return keycode_to_action(ACTION_NO);
112 }
113 return keycode_to_action(KC_RGUI);
114 }
115 return keycode_to_action(KC_RALT);
116 case KC_RGUI:
117 if (keymap_config.swap_ralt_rgui) {
118 return keycode_to_action(KC_RALT);
119 }
120 if (keymap_config.no_gui) {
121 return keycode_to_action(ACTION_NO);
122 }
123 return keycode_to_action(KC_RGUI);
124 case KC_GRAVE:
125 if (keymap_config.swap_grave_esc) {
126 return keycode_to_action(KC_ESC);
127 }
128 return keycode_to_action(KC_GRAVE);
129 case KC_ESC:
130 if (keymap_config.swap_grave_esc) {
131 return keycode_to_action(KC_GRAVE);
132 }
133 return keycode_to_action(KC_ESC);
134 case KC_BSLASH:
135 if (keymap_config.swap_backslash_backspace) {
136 return keycode_to_action(KC_BSPACE);
137 }
138 return keycode_to_action(KC_BSLASH);
139 case KC_BSPACE:
140 if (keymap_config.swap_backslash_backspace) {
141 return keycode_to_action(KC_BSLASH);
142 }
143 return keycode_to_action(KC_BSPACE);
144#endif
145 default:
146 return keycode_to_action(keycode);
147 }
148}
149
150
151/* Macro */
152__attribute__ ((weak))
153const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
154{
155 return MACRO_NONE;
156}
157
158/* Function */
159__attribute__ ((weak))
160void action_function(keyrecord_t *record, uint8_t id, uint8_t opt)
161{
162}
163
164/* translates keycode to action */
165static action_t keycode_to_action(uint16_t keycode)
166{
167 action_t action;
168 switch (keycode) {
169 case KC_A ... KC_EXSEL:
170 case KC_LCTRL ... KC_RGUI:
171 action.code = ACTION_KEY(keycode);
172 break;
173 case KC_SYSTEM_POWER ... KC_SYSTEM_WAKE:
174 action.code = ACTION_USAGE_SYSTEM(KEYCODE2SYSTEM(keycode));
175 break;
176 case KC_AUDIO_MUTE ... KC_WWW_FAVORITES:
177 action.code = ACTION_USAGE_CONSUMER(KEYCODE2CONSUMER(keycode));
178 break;
179 case KC_MS_UP ... KC_MS_ACCEL2:
180 action.code = ACTION_MOUSEKEY(keycode);
181 break;
182 case KC_TRNS:
183 action.code = ACTION_TRANSPARENT;
184 break;
185 default:
186 action.code = ACTION_NO;
187 break;
188 }
189 return action;
190}
191
192
193/* translates key to keycode */
194uint16_t keymap_key_to_keycode(uint8_t layer, keypos_t key)
195{
196 // Read entire word (16bits)
197 return pgm_read_word(&keymaps[(layer)][(key.row)][(key.col)]);
198}
199
200/* translates Fn keycode to action */
201action_t keymap_fn_to_action(uint16_t keycode)
202{
203 return (action_t){ .code = pgm_read_word(&fn_actions[FN_INDEX(keycode)]) };
204}
205
206action_t keymap_func_to_action(uint16_t keycode)
207{
208 // For FUNC without 8bit limit
209 return (action_t){ .code = pgm_read_word(&fn_actions[(int)keycode]) };
210}
diff --git a/keyboard/planck/extended_keymap_common.h b/keyboard/planck/extended_keymap_common.h
deleted file mode 100644
index e6a7dac5b..000000000
--- a/keyboard/planck/extended_keymap_common.h
+++ /dev/null
@@ -1,180 +0,0 @@
1/*
2Copyright 2012,2013 Jun Wako <wakojun@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along 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 */
35typedef 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;
48keymap_config_t keymap_config;
49#endif
50
51
52/* translates key to keycode */
53uint16_t keymap_key_to_keycode(uint8_t layer, keypos_t key);
54
55/* translates Fn keycode to action */
56action_t keymap_fn_to_action(uint16_t keycode);
57
58/* translates Fn keycode to action */
59action_t keymap_func_to_action(uint16_t keycode);
60
61extern const uint16_t keymaps[][MATRIX_ROWS][MATRIX_COLS];
62extern const uint16_t fn_actions[];
63
64// Ability to use mods in layouts
65#define LCTL(kc) kc | 0x0100
66#define LSFT(kc) kc | 0x0200
67#define LALT(kc) kc | 0x0400
68#define LGUI(kc) kc | 0x0800
69#define RCTL(kc) kc | 0x1100
70#define RSFT(kc) kc | 0x1200
71#define RALT(kc) kc | 0x1400
72#define RGUI(kc) kc | 0x1800
73
74// Alias for function layers than expand past FN31
75#define FUNC(kc) kc | 0x2000
76
77// Aliases
78#define S(kc) LSFT(kc)
79#define F(kc) FUNC(kc)
80
81// For software implementation of colemak
82#define CM_Q KC_Q
83#define CM_W KC_W
84#define CM_F KC_E
85#define CM_P KC_R
86#define CM_G KC_T
87#define CM_J KC_Y
88#define CM_L KC_U
89#define CM_U KC_I
90#define CM_Y KC_O
91#define CM_SCLN KC_P
92
93#define CM_A KC_A
94#define CM_R KC_S
95#define CM_S KC_D
96#define CM_T KC_F
97#define CM_D KC_G
98#define CM_H KC_H
99#define CM_N KC_J
100#define CM_E KC_K
101#define CM_I KC_L
102#define CM_O KC_SCLN
103
104#define CM_Z KC_Z
105#define CM_X KC_X
106#define CM_C KC_C
107#define CM_V KC_V
108#define CM_B KC_B
109#define CM_K KC_N
110#define CM_M KC_M
111#define CM_COMM KC_COMM
112#define CM_DOT KC_DOT
113#define CM_SLSH KC_SLSH
114
115// Make it easy to support these in macros
116#define KC_CM_Q CM_Q
117#define KC_CM_W CM_W
118#define KC_CM_F CM_F
119#define KC_CM_P CM_P
120#define KC_CM_G CM_G
121#define KC_CM_J CM_J
122#define KC_CM_L CM_L
123#define KC_CM_U CM_U
124#define KC_CM_Y CM_Y
125#define KC_CM_SCLN CM_SCLN
126
127#define KC_CM_A CM_A
128#define KC_CM_R CM_R
129#define KC_CM_S CM_S
130#define KC_CM_T CM_T
131#define KC_CM_D CM_D
132#define KC_CM_H CM_H
133#define KC_CM_N CM_N
134#define KC_CM_E CM_E
135#define KC_CM_I CM_I
136#define KC_CM_O CM_O
137
138#define KC_CM_Z CM_Z
139#define KC_CM_X CM_X
140#define KC_CM_C CM_C
141#define KC_CM_V CM_V
142#define KC_CM_B CM_B
143#define KC_CM_K CM_K
144#define KC_CM_M CM_M
145#define KC_CM_COMM CM_COMM
146#define KC_CM_DOT CM_DOT
147#define KC_CM_SLSH CM_SLSH
148
149#define M(kc) kc | 0x3000
150
151#define MACRODOWN(...) (record->event.pressed ? MACRO(__VA_ARGS__) : MACRO_NONE)
152
153#define BL_ON 0x4009
154#define BL_OFF 0x4000
155#define BL_0 0x4000
156#define BL_1 0x4001
157#define BL_2 0x4002
158#define BL_3 0x4003
159#define BL_4 0x4004
160#define BL_5 0x4005
161#define BL_6 0x4006
162#define BL_7 0x4007
163#define BL_8 0x4008
164#define BL_9 0x4009
165#define BL_10 0x400A
166#define BL_11 0x400B
167#define BL_12 0x400C
168#define BL_13 0x400D
169#define BL_14 0x400E
170#define BL_15 0x400F
171#define BL_DEC 0x4010
172#define BL_INC 0x4011
173#define BL_TOGG 0x4012
174#define BL_STEP 0x4013
175
176#define RESET 0x5000
177
178#define MIDI(n) n | 0x6000
179
180#endif
diff --git a/keyboard/planck/extended_keymaps/extended_keymap_angerthosenear.c b/keyboard/planck/extended_keymaps/extended_keymap_angerthosenear.c
deleted file mode 100644
index 34710d60d..000000000
--- a/keyboard/planck/extended_keymaps/extended_keymap_angerthosenear.c
+++ /dev/null
@@ -1,50 +0,0 @@
1#include "extended_keymap_common.h"
2
3const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
4[0] = { /* Qwerty */
5 {KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC},
6 {KC_TAB, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_ENT},
7 {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_QUOT},
8 {KC_LCTL, KC_LGUI, KC_LALT, BL_STEP, FUNC(2), KC_SPC, KC_SPC, FUNC(1), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT}
9 // Space is repeated to accommadate for both spacebar wiring positions
10},
11[1] = { /* WASD + NumPad */
12 {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_P7, KC_P8, KC_P9, KC_PSLS, KC_PMNS, KC_TRNS},
13 {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_P4, KC_P5, KC_P6, KC_PAST, KC_PPLS, KC_TRNS},
14 {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_P1, KC_P2, KC_P3, KC_PDOT, KC_PENT, KC_TRNS},
15 {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, FUNC(2), KC_SPC, KC_P0, FUNC(1), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}
16},
17[2] = { /* RAISE */
18 {KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_TRNS},
19 {KC_TRNS, FUNC(3), FUNC(4), LSFT(RSFT(KC_PAUSE)), KC_TRNS, KC_TRNS, KC_TRNS, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS},
20 {KC_TRNS, KC_F11, KC_F12, KC_F13, KC_F14, KC_F15, KC_F16, KC_F17, KC_F18, KC_F19, KC_F20, KC_TRNS},
21 {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MPRV, FUNC(1), KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY}
22},
23[3] = { /* LOWER */
24 {S(KC_GRV), S(KC_1), S(KC_2), S(KC_3), S(KC_4), S(KC_5), S(KC_6), S(KC_7), S(KC_8), S(KC_9), S(KC_0), KC_DEL},
25 {KC_TRNS, FUNC(3), FUNC(4), LSFT(RSFT(KC_PAUSE)), KC_TRNS, KC_TRNS, KC_TRNS, S(KC_MINS), S(KC_EQL), S(KC_LBRC), S(KC_RBRC), S(KC_BSLS)},
26 {KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_TRNS},
27 {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, FUNC(2), KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_PGDN, KC_PGUP, KC_END}
28}
29};
30
31
32const uint16_t PROGMEM fn_actions[] = {
33 [1] = ACTION_LAYER_MOMENTARY(2), // to RAISE
34 [2] = ACTION_LAYER_MOMENTARY(3), // to LOWER
35
36 [3] = ACTION_DEFAULT_LAYER_SET(0),
37 [4] = ACTION_DEFAULT_LAYER_SET(1),
38
39};
40
41const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
42{
43 // MACRODOWN only works in this function
44 switch(id) {
45 case 0:
46 return MACRODOWN(T(CM_T), END);
47 break;
48 }
49 return MACRO_NONE;
50};
diff --git a/keyboard/planck/extended_keymaps/extended_keymap_austin.c b/keyboard/planck/extended_keymaps/extended_keymap_austin.c
deleted file mode 100644
index 35330be74..000000000
--- a/keyboard/planck/extended_keymaps/extended_keymap_austin.c
+++ /dev/null
@@ -1,50 +0,0 @@
1#include "extended_keymap_common.h"
2
3const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
4[0] = { /* Qwerty */
5 {KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC},
6 {KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT},
7 {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT},
8 {BL_STEP, KC_LGUI, KC_LALT, KC_LCTL, FUNC(2), KC_SPC, KC_SPC, FUNC(1), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT}
9 // Space is repeated to accommadate for both spacebar wiring positions
10},
11[1] = { /* Colemak */
12 {KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC},
13 {KC_ESC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT},
14 {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT},
15 {KC_FN3, KC_LGUI, KC_LALT, KC_LCTL, FUNC(2), KC_SPC, KC_SPC, FUNC(1), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT}
16},
17[2] = { /* RAISE */
18 {KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC},
19 {KC_TRNS, FUNC(3), FUNC(4), LSFT(RSFT(KC_PAUSE)), KC_TRNS, KC_TRNS, KC_TRNS, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS},
20 {KC_TRNS, KC_F11, KC_F12, KC_F13, KC_F14, KC_F15, KC_F16, KC_F17, KC_F18, KC_F19, KC_F20, KC_TRNS},
21 {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, FUNC(1), KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY}
22},
23[3] = { /* LOWER */
24 {S(KC_GRV), S(KC_1), S(KC_2), S(KC_3), S(KC_4), S(KC_5), S(KC_6), S(KC_7), S(KC_8), S(KC_9), S(KC_0), KC_BSPC},
25 {KC_TRNS, FUNC(3), FUNC(4), LSFT(RSFT(KC_PAUSE)), KC_TRNS, KC_TRNS, KC_TRNS, S(KC_MINS), S(KC_EQL), S(KC_LBRC), S(KC_RBRC), S(KC_BSLS)},
26 {KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_TRNS},
27 {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, FUNC(2), KC_TRNS, KC_TRNS, KC_TRNS, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY}
28}
29};
30
31
32const uint16_t PROGMEM fn_actions[] = {
33 [1] = ACTION_LAYER_MOMENTARY(2), // to RAISE
34 [2] = ACTION_LAYER_MOMENTARY(3), // to LOWER
35
36 [3] = ACTION_DEFAULT_LAYER_SET(0),
37 [4] = ACTION_DEFAULT_LAYER_SET(1),
38
39};
40
41const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
42{
43 // MACRODOWN only works in this function
44 switch(id) {
45 case 0:
46 return MACRODOWN(T(CM_T), END);
47 break;
48 }
49 return MACRO_NONE;
50};
diff --git a/keyboard/planck/extended_keymaps/extended_keymap_charlie.c b/keyboard/planck/extended_keymaps/extended_keymap_charlie.c
deleted file mode 100644
index 18657c8e4..000000000
--- a/keyboard/planck/extended_keymaps/extended_keymap_charlie.c
+++ /dev/null
@@ -1,54 +0,0 @@
1#include "extended_keymap_common.h"
2
3const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
4 [0] = { /* Native */
5 {KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, FUNC(2)},
6 {KC_BSPC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT},
7 {KC_TAB, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT},
8 {KC_DEL, KC_LCTL, KC_NO, KC_LSFT, KC_LALT, KC_SPC, KC_NO, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT}
9},
10 [1] = { /* QWERTY->PHOTOSHOP */
11 {KC_DELETE, KC_0, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, FUNC(1)},
12 {KC_O, KC_G, KC_S, KC_U, KC_T, FUNC(27), KC_F21, KC_F10, KC_F11, KC_F7, KC_F8, KC_F9},
13 {KC_TAB, FUNC(4), FUNC(5), FUNC(6), KC_F1, FUNC(7), KC_F18, KC_F19, KC_F23, KC_F20, KC_F22, FUNC(9)},
14 {KC_COMM, KC_DOT, KC_R, FUNC(11), FUNC(3), KC_SPC, FUNC(12), KC_F2, FUNC(8), KC_F3, KC_F14}
15 },
16 [2] = { /* 2: FUNC(3 PHOTOSHOP */
17 {KC_ESC, FUNC(25), FUNC(26), KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO},
18 {KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, FUNC(19), FUNC(20), FUNC(21)},
19 {KC_C, KC_NO, FUNC(22), FUNC(5), KC_NO, FUNC(23), KC_NO, KC_NO, KC_NO, KC_NO, FUNC(13), KC_NO},
20 {FUNC(14), FUNC(15), FUNC(16), FUNC(17), FUNC(3), KC_SPC, FUNC(18), KC_NO, KC_NO, KC_F24, KC_NO}
21 }
22};
23
24const uint16_t PROGMEM fn_actions[] = {
25 [1] = ACTION_DEFAULT_LAYER_SET(0), // set Qwerty layout
26 [2] = ACTION_DEFAULT_LAYER_SET(1), // set Photoshop presets
27 [3] = ACTION_LAYER_MOMENTARY(2), // Photoshop function layer
28
29 [4] = ACTION_MODS_KEY(MOD_LSFT | MOD_LCTL | MOD_LALT, KC_F9), // photo folder AHK
30 [5] = ACTION_MODS_KEY(MOD_LSFT | MOD_LCTL, KC_I), // select inverse
31 [6] = ACTION_MODS_KEY(MOD_LSFT, KC_M), // marquee select
32 [7] = ACTION_MODS_KEY(MOD_LALT, KC_BSPC), // fill
33 [8] = ACTION_MODS_KEY(MOD_LSFT | MOD_LCTL | MOD_LALT, KC_X), // warp
34 [9] = ACTION_MODS_KEY(MOD_LCTL | MOD_LALT | MOD_LSFT, KC_F12), // merge all new layer
35 [10] = ACTION_MODS_KEY(MOD_LCTL, KC_MINS), // zoom out
36 [11] = ACTION_MODS_KEY(MOD_LCTL, KC_H), // RBG sliders
37 [12] = ACTION_MODS_KEY(MOD_LCTL, KC_S), // save
38 [13] = ACTION_MODS_KEY(MOD_LSFT | MOD_LCTL, KC_F5), // layer mask from transparancy
39 [14] = ACTION_MODS_KEY(MOD_LCTL, KC_F2), // stroke
40 [15] = ACTION_MODS_KEY(MOD_LCTL | MOD_LSFT, KC_F2), // stroke layer
41 [16] = ACTION_MODS_KEY(MOD_LCTL, KC_0), // zoom 0
42 [17] = ACTION_MODS_KEY(MOD_LSFT | MOD_LCTL, KC_H), // HSV sliders
43 [18] = ACTION_MODS_KEY(MOD_LCTL | MOD_LSFT, KC_S), // save as
44 [19] = ACTION_MODS_KEY(MOD_LSFT | MOD_LCTL | MOD_LALT, KC_F7), // gaussian blur
45 [20] = ACTION_MODS_KEY(MOD_LSFT | MOD_LCTL | MOD_LALT, KC_F8), // motion blur
46 [21] = ACTION_MODS_KEY(MOD_LSFT | MOD_LCTL, KC_X), // liquify filter
47 [22] = ACTION_MODS_KEY(MOD_LSFT, KC_MINS), // prev layer blending
48 [23] = ACTION_MODS_KEY(MOD_LSFT | MOD_LCTL, KC_BSPC), // KC_NOrmal layer blending
49 [24] = ACTION_MODS_KEY(MOD_LSFT, KC_EQL), // next layer blending
50 [25] = ACTION_MODS_KEY(MOD_LCTL, KC_Z), // step back
51 [26] = ACTION_MODS_KEY(MOD_LCTL, KC_Y), // step forward
52 [27] = ACTION_MODS_KEY(MOD_LCTL, KC_R), // rasterize
53
54};
diff --git a/keyboard/planck/extended_keymaps/extended_keymap_daniel.c b/keyboard/planck/extended_keymaps/extended_keymap_daniel.c
deleted file mode 100644
index d3565495f..000000000
--- a/keyboard/planck/extended_keymaps/extended_keymap_daniel.c
+++ /dev/null
@@ -1,48 +0,0 @@
1#include "extended_keymap_common.h"
2
3const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
4[0] = { /* Qwerty */
5 {KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC},
6 {KC_TAB, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT},
7 {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT},
8 {FUNC(3), KC_LCTL, KC_LALT, KC_LGUI, FUNC(2), KC_SPC, KC_SPC, FUNC(1), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT}
9 // Space is repeated to accommadate for both spacebar wiring positions
10},
11[1] = { /* RAISE */
12 {KC_GRV, S(KC_1), S(KC_2), S(KC_3), S(KC_4), S(KC_5), S(KC_6), S(KC_7), S(KC_8), S(KC_9), S(KC_0), KC_EQL},
13 {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_LBRC, KC_RBRC},
14 {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MINS, S(KC_MINS), KC_BSLS, KC_TRNS},
15 {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, FUNC(1), KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY}
16},
17[2] = { /* LOWER */
18 {S(KC_GRV), KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, S(KC_EQL)},
19 {KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12},
20 {KC_CAPS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_ENT},
21 {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, FUNC(2), KC_TRNS, KC_TRNS, KC_TRNS, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY}
22},
23[3] = { /* Qwerty */
24 {KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_DEL},
25 {KC_TAB, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT},
26 {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT},
27 {KC_TRNS, KC_LCTL, KC_LALT, KC_LGUI, FUNC(2), KC_SPC, KC_SPC, FUNC(1), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT}
28 // Space is repeated to accommadate for both spacebar wiring positions
29}
30};
31
32
33const uint16_t PROGMEM fn_actions[] = {
34 [1] = ACTION_LAYER_MOMENTARY(1), // to RAISE
35 [2] = ACTION_LAYER_MOMENTARY(2), // to LOWER
36 [3] = ACTION_LAYER_MOMENTARY(3) // to LOWER
37};
38
39const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
40{
41 // MACRODOWN only works in this function
42 switch(id) {
43 case 0:
44 return MACRODOWN(T(CM_T), END);
45 break;
46 }
47 return MACRO_NONE;
48};
diff --git a/keyboard/planck/extended_keymaps/extended_keymap_david.c b/keyboard/planck/extended_keymaps/extended_keymap_david.c
deleted file mode 100644
index fe9f3937a..000000000
--- a/keyboard/planck/extended_keymaps/extended_keymap_david.c
+++ /dev/null
@@ -1,76 +0,0 @@
1#include "extended_keymap_common.h"
2#include "beeps.h"
3
4const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
5[0] = { /* Qwerty */
6 {KC_Q, KC_W, KC_E, KC_R, KC_T, KC_BSPC, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC},
7 {KC_A, KC_S, KC_D, KC_F, KC_G, KC_ENT, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT},
8 {KC_Z, KC_X, KC_C, KC_V, KC_B, KC_ESC, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT},
9 {M(10), KC_LCTL, KC_LALT, KC_LGUI, FUNC(2), KC_SPC, KC_SPC, FUNC(1), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT}
10 // Space is repeated to accommadate for both spacebar wiring positions
11},
12[1] = { /* Colemak */
13 {KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC},
14 {KC_ESC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT},
15 {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT},
16 {KC_FN3, KC_LCTL, KC_LALT, KC_LGUI, FUNC(2), KC_SPC, KC_SPC, FUNC(1), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT}
17},
18[2] = { /* RAISE */
19 {KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC},
20 {KC_TRNS, FUNC(3), FUNC(4), RESET, M(0), M(1), M(2), KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS},
21 {KC_TRNS, KC_F11, KC_F12, M(0), M(1), M(2), M(3), M(4), M(5), M(6), M(7), KC_TRNS},
22 {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, FUNC(1), KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY}
23},
24[3] = { /* LOWER */
25 {S(KC_GRV), S(KC_1), S(KC_2), S(KC_3), S(KC_4), S(KC_5), S(KC_6), S(KC_7), S(KC_8), S(KC_9), S(KC_0), KC_BSPC},
26 {KC_TRNS, FUNC(3), FUNC(4), RESET, M(0), M(1), M(2), S(KC_MINS), S(KC_EQL), S(KC_LBRC), S(KC_RBRC), S(KC_BSLS)},
27 {KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_TRNS},
28 {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, FUNC(2), KC_TRNS, KC_TRNS, KC_TRNS, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY}
29}
30};
31
32const uint16_t PROGMEM fn_actions[] = {
33 [1] = ACTION_LAYER_MOMENTARY(2), // to RAISE
34 [2] = ACTION_LAYER_MOMENTARY(3), // to LOWER
35
36 [3] = ACTION_DEFAULT_LAYER_SET(0),
37 [4] = ACTION_DEFAULT_LAYER_SET(1),
38
39};
40
41const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
42{
43 // MACRODOWN only works in this function
44 if (record->event.pressed) {
45 switch(id) {
46 case 0:
47 true_note(12, 12, 20);
48 break;
49 case 1:
50 true_note(14, 14, 20);
51 break;
52 case 2:
53 true_note(16, 16, 20);
54 break;
55 case 3:
56 true_note(17, 17, 20);
57 break;
58 case 4:
59 true_note(19, 19, 20);
60 break;
61 case 5:
62 true_note(21, 21, 20);
63 break;
64 case 6:
65 true_note(23, 23, 20);
66 break;
67 case 7:
68 true_note(24, 24, 20);
69 break;
70 case 10:
71
72 break;
73 }
74 }
75 return MACRO_NONE;
76};
diff --git a/keyboard/planck/extended_keymaps/extended_keymap_dzobert.c b/keyboard/planck/extended_keymaps/extended_keymap_dzobert.c
deleted file mode 100644
index 6b3864b6c..000000000
--- a/keyboard/planck/extended_keymaps/extended_keymap_dzobert.c
+++ /dev/null
@@ -1,49 +0,0 @@
1#include "extended_keymap_common.h"
2
3const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
4[0] = { /* Qwerty */
5 {KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_TAB},
6 {KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_BSPC},
7 {KC_LALT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT},
8 {KC_FN4, KC_RSFT, KC_LGUI, KC_LSFT, FUNC(2), KC_SPC, KC_SPC, FUNC(1), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT}
9 // Space is repeated to accommadate for both spacebar wiring positions
10},
11[1] = { /* Colemak */
12 {KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_TAB},
13 {KC_ESC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_BSPC},
14 {KC_LALT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT},
15 {KC_FN3, KC_RSFT, KC_LGUI, KC_LSFT, FUNC(2), KC_SPC, KC_SPC, FUNC(1), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT}
16},
17[2] = { /* RAISE */
18 {KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12},
19 {KC_TRNS, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_DEL},
20 {KC_TRNS, KC_GRV, KC_MINS, KC_EQL, KC_QUOT, S(KC_QUOT), S(KC_LBRC), S(KC_RBRC), KC_LBRC, KC_RBRC, KC_BSLS, KC_TRNS},
21 {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, FUNC(1), KC_HOME, KC_PGUP, KC_PGDN, KC_END}
22},
23[3] = { /* LOWER */
24 {KC_POWER,KC_PSCR, KC_SLCK, KC_PAUSE, KC_NLCK, KC_EXECUTE, KC_MENU, KC_APP, KC_7, KC_8, KC_9, KC_KP_SLASH},
25 {KC_TRNS, KC_VOLD, KC_VOLU, KC_MUTE, KC_CAPS, KC_CANCEL, KC_UNDO, KC_AGAIN, KC_4, KC_5, KC_6, KC_KP_ASTERISK},
26 {KC_TRNS, KC_INSERT,KC_CUT, KC_COPY, KC_PASTE, KC_BSLS, KC_9, KC_0, KC_1, KC_2, KC_3, KC_KP_MINUS},
27 {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, FUNC(2), KC_TRNS, KC_TRNS, KC_TRNS, KC_0, KC_KP_DOT, KC_KP_ENTER, KC_KP_PLUS}
28}
29};
30
31const uint16_t PROGMEM fn_actions[] = {
32 [1] = ACTION_LAYER_MOMENTARY(2), // to RAISE
33 [2] = ACTION_LAYER_MOMENTARY(3), // to LOWER
34
35 [3] = ACTION_DEFAULT_LAYER_SET(0),
36 [4] = ACTION_DEFAULT_LAYER_SET(1),
37
38};
39
40const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
41{
42 // MACRODOWN only works in this function
43 switch(id) {
44 case 0:
45 return MACRODOWN(T(CM_T), END);
46 break;
47 }
48 return MACRO_NONE;
49}; \ No newline at end of file
diff --git a/keyboard/planck/extended_keymaps/extended_keymap_jack.c b/keyboard/planck/extended_keymaps/extended_keymap_jack.c
deleted file mode 100644
index d39dc5b84..000000000
--- a/keyboard/planck/extended_keymaps/extended_keymap_jack.c
+++ /dev/null
@@ -1,50 +0,0 @@
1#include "extended_keymap_common.h"
2
3const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
4[0] = { /* Jack soft-coded colemak */
5 {KC_TAB, CM_Q, CM_W, CM_F, CM_P, CM_G, CM_J, CM_L, CM_U, CM_Y, CM_SCLN, KC_BSPC},
6 {KC_ESC, CM_A, CM_R, CM_S, CM_T, CM_D, CM_H, CM_N, CM_E, CM_I, CM_O, KC_QUOT},
7 {KC_LSFT, CM_Z, CM_X, CM_C, CM_V, CM_B, CM_K, CM_M, CM_COMM, CM_DOT, CM_SLSH, KC_ENT},
8 {BL_STEP, KC_LCTL, KC_LALT, KC_LGUI, FUNC(2), KC_SPC, KC_SPC, FUNC(1), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT}
9 // Space is repeated to accommadate for both spacebar wiring positions
10},
11[1] = { /* Jack hard-coded colemak */
12 {KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC},
13 {KC_ESC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT},
14 {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT},
15 {KC_FN3, KC_LCTL, KC_LALT, KC_LGUI, FUNC(2), KC_SPC, KC_SPC, FUNC(1), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT}
16},
17[2] = { /* Jack RAISE */
18 {KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC},
19 {KC_TRNS, FUNC(3), FUNC(4), LSFT(RSFT(KC_PAUSE)), KC_TRNS, KC_TRNS, KC_TRNS, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS},
20 {KC_TRNS, KC_F11, KC_F12, KC_F13, KC_F14, KC_F15, KC_F16, KC_F17, KC_F18, KC_F19, KC_F20, KC_TRNS},
21 {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, FUNC(1), KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY}
22},
23[3] = { /* Jack LOWER */
24 {S(KC_GRV), S(KC_1), S(KC_2), S(KC_3), S(KC_4), S(KC_5), S(KC_6), S(KC_7), S(KC_8), S(KC_9), S(KC_0), KC_BSPC},
25 {KC_TRNS, FUNC(3), FUNC(4), LSFT(RSFT(KC_PAUSE)), KC_TRNS, KC_TRNS, KC_TRNS, S(KC_MINS), S(KC_EQL), S(KC_LBRC), S(KC_RBRC), S(KC_BSLS)},
26 {KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_TRNS},
27 {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, FUNC(2), KC_TRNS, KC_TRNS, KC_TRNS, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY}
28}
29};
30
31
32const uint16_t PROGMEM fn_actions[] = {
33 [1] = ACTION_LAYER_MOMENTARY(2), // to Fn overlay
34 [2] = ACTION_LAYER_MOMENTARY(3), // to Fn overlay
35
36 [3] = ACTION_DEFAULT_LAYER_SET(0),
37 [4] = ACTION_DEFAULT_LAYER_SET(1),
38
39};
40
41const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
42{
43 // MACRODOWN only works in this function
44 switch(id) {
45 case 0:
46 return MACRODOWN(T(CM_T), END);
47 break;
48 }
49 return MACRO_NONE;
50};
diff --git a/keyboard/planck/extended_keymaps/extended_keymap_joe.c b/keyboard/planck/extended_keymaps/extended_keymap_joe.c
deleted file mode 100644
index c560d8a3a..000000000
--- a/keyboard/planck/extended_keymaps/extended_keymap_joe.c
+++ /dev/null
@@ -1,88 +0,0 @@
1#include "extended_keymap_common.h"
2
3const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
4 [0] = { /* Joe colemak */
5 {F(3), KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_MINS},
6 {KC_BSPC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_ENT },
7 {F(15), KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_QUOT},
8 {KC_LCTL, KC_LGUI, KC_LALT, KC_LSFT, F(1), KC_SPC, KC_SPC, F(2), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT}
9 },
10 [1] = { /* Joe soft Colemak */
11 {F(3), CM_Q, CM_W, CM_F, CM_P, CM_G, CM_J, CM_L, CM_U, CM_Y, CM_SCLN, KC_MINS},
12 {KC_BSPC, CM_A, CM_R, CM_S, CM_T, CM_D, CM_H, CM_N, CM_E, CM_I, CM_O, KC_ENT },
13 {F(15), CM_Z, CM_X, CM_C, CM_V, CM_B, CM_K, CM_M, KC_COMM, KC_DOT, KC_SLSH, KC_QUOT},
14 {KC_LCTL, KC_LGUI, KC_LALT, KC_LSFT, F(1), KC_SPC, KC_SPC, F(2), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT}
15 },
16 [2] = { /* Joe NUMPAD */
17 {F(3), KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, LSFT(KC_9), LSFT(KC_0), KC_P7, KC_P8, KC_P9, KC_PSLS},
18 {KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, LSFT(KC_5), KC_PEQL, KC_P4, KC_P5, KC_P6, KC_PAST},
19 {KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_PCMM, KC_P1, KC_P2, KC_P3, KC_PMNS},
20 {KC_LCTL, KC_LGUI, KC_LALT, KC_LSFT, F(1), KC_TRNS, KC_TRNS, F(2), KC_P0, KC_PDOT, KC_PENT, KC_PPLS}
21 },
22 [3] = { /* Joe 1337 haxOr5*/
23 {F(3), KC_Q, KC_W, KC_F, KC_P, KC_6, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_MINS},
24 {KC_BSPC, KC_4, KC_R, KC_5, KC_7, KC_D, KC_H, KC_N, KC_3, KC_1, KC_0, KC_ENT },
25 {F(15), KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_QUOT},
26 {KC_LCTL, KC_LGUI, KC_LALT, KC_LSFT, F(1), KC_SPC, KC_SPC, F(2), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT}
27 },
28 [4] = { /* Joe LOWER fn1 */
29 {KC_GRV, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, M(3), M(2), M(1), M(0) },
30 {KC_BSPC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_TRNS},
31 {KC_BSLS, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_LBRC, KC_RBRC, KC_EQL },
32 {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, F(1), KC_TRNS, KC_TRNS, F(2), KC_HOME, KC_PGDN, KC_PGUP, KC_END }
33 },
34 [5] = { /* Joe UPPER fn2 */
35 {KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12 },
36 {KC_DEL, KC_BTN1, KC_MS_U, KC_BTN2, KC_BTN3, KC_WH_U, KC_BTN4, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, KC_NO },
37 {KC_TRNS, KC_MS_L, KC_MS_D, KC_MS_R, KC_WH_L, KC_WH_D, KC_WH_R, KC_NO, KC_NO, KC_NO, LCTL(KC_PGUP), LCTL(KC_PGDN) },
38 {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, F(1), KC_NO, KC_NO, F(2), LCTL(LALT(KC_LEFT)), LCTL(LALT(KC_DOWN)), LCTL(LALT(KC_UP)), LCTL(LALT(KC_RGHT))}
39 },
40 [6] = { /* Joe SPECIAL fn3 */
41 {KC_TRNS, KC_MUTE, KC_VOLD, KC_VOLU, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO },
42 {KC_NO, KC_MPLY, KC_MPRV, KC_MNXT, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, RESET },
43 {KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO },
44 {F(6), F(7), F(8), F(9), F(1), KC_TRNS, KC_TRNS, F(2), KC_POWER, KC_WAKE, KC_SLEP, LCTL(LALT(KC_L))}
45 }
46};
47
48const uint16_t PROGMEM fn_actions[] = {
49 [1] = ACTION_LAYER_MOMENTARY(4), // fn1
50 [2] = ACTION_LAYER_MOMENTARY(5), // fn2
51
52 /* ESC on tap, fn3 on hold */
53 [3] = ACTION_LAYER_TAP_KEY(6, KC_ESC),
54
55 /* toggle layers */
56 [6] = ACTION_DEFAULT_LAYER_SET(0),
57 [7] = ACTION_DEFAULT_LAYER_SET(1),
58 [8] = ACTION_DEFAULT_LAYER_SET(2),
59 [9] = ACTION_DEFAULT_LAYER_SET(3),
60
61 /* tab on tap, shift on hold */
62 [15] = ACTION_MODS_TAP_KEY(MOD_LSFT, KC_TAB),
63};
64
65const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
66{
67 switch (id) {
68 case 0:
69 /* :) */
70 return MACRODOWN( DOWN(KC_LSFT), TYPE(KC_SCLN), TYPE(KC_0), UP(KC_LSFT), END );
71 break;
72 case 1:
73 /* :( */
74 return MACRODOWN( DOWN(KC_LSFT), TYPE(KC_SCLN), TYPE(KC_9), UP(KC_LSFT), END );
75 break;
76 case 2:
77 /* (: | :) */
78 return MACRODOWN( DOWN(KC_LSFT), TYPE(KC_9), TYPE(KC_SCLN), TYPE(KC_SPC), TYPE(KC_SPC), TYPE(KC_SCLN), TYPE(KC_0), UP(KC_LSFT), TYPE(KC_LEFT), TYPE(KC_LEFT), TYPE(KC_LEFT), END );
79 break;
80 case 3:
81 /* :( | ): */
82 return MACRODOWN( DOWN(KC_LSFT), TYPE(KC_SCLN), TYPE(KC_9), TYPE(KC_SPC), TYPE(KC_SPC), TYPE(KC_0), TYPE(KC_SCLN), UP(KC_LSFT), TYPE(KC_LEFT), TYPE(KC_LEFT), TYPE(KC_LEFT), END );
83 break;
84 default:
85 break;
86 }
87 return MACRO_NONE;
88}
diff --git a/keyboard/planck/extended_keymaps/extended_keymap_kyle.c b/keyboard/planck/extended_keymaps/extended_keymap_kyle.c
deleted file mode 100644
index b7b7fcb76..000000000
--- a/keyboard/planck/extended_keymaps/extended_keymap_kyle.c
+++ /dev/null
@@ -1,49 +0,0 @@
1#include "extended_keymap_common.h"
2
3const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
4[0] = { /* Qwerty */
5 {KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC},
6 {KC_TAB, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT},
7 {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT},
8 {KC_RCTL, KC_LCTL, KC_LALT, KC_LGUI, FUNC(2), KC_SPC, KC_SPC, FUNC(1), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT}
9 // Space is repeated to accommadate for both spacebar wiring positions
10},
11[1] = { /* Colemak */
12 {KC_ESC, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC},
13 {KC_TAB, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT},
14 {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT},
15 {KC_FN3, KC_LCTL, KC_LALT, KC_LGUI, FUNC(2), KC_SPC, KC_SPC, FUNC(1), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT}
16},
17[2] = { /* RAISE */
18 {KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC},
19 {KC_TRNS, FUNC(3), FUNC(4), LSFT(RSFT(KC_PAUSE)), KC_TRNS, KC_TRNS, KC_TRNS, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS},
20 {KC_TRNS, KC_F11, KC_F12, KC_F13, KC_F14, KC_F15, KC_F16, KC_F17, KC_F18, KC_F19, KC_F20, KC_TRNS},
21 {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, FUNC(1), KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY}
22},
23[3] = { /* LOWER */
24 {S(KC_GRV), S(KC_1), S(KC_2), S(KC_3), S(KC_4), S(KC_5), S(KC_6), S(KC_7), S(KC_8), S(KC_9), S(KC_0), KC_BSPC},
25 {KC_TRNS, FUNC(3), FUNC(4), LSFT(RSFT(KC_PAUSE)), LSFT(RSFT(KC_D)), KC_TRNS, KC_TRNS, S(KC_MINS), S(KC_EQL), S(KC_LBRC), S(KC_RBRC), S(KC_BSLS)},
26 {KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_TRNS},
27 {BL_STEP, KC_TRNS, KC_TRNS, KC_TRNS, FUNC(2), KC_TRNS, KC_TRNS, KC_TRNS, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY}
28}
29};
30
31const uint16_t PROGMEM fn_actions[] = {
32 [1] = ACTION_LAYER_MOMENTARY(2), // to RAISE
33 [2] = ACTION_LAYER_MOMENTARY(3), // to LOWER
34
35 [3] = ACTION_DEFAULT_LAYER_SET(0),
36 [4] = ACTION_DEFAULT_LAYER_SET(1),
37
38};
39
40const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
41{
42 // MACRODOWN only works in this function
43 switch(id) {
44 case 0:
45 return MACRODOWN(T(CM_T), END);
46 break;
47 }
48 return MACRO_NONE;
49};
diff --git a/keyboard/planck/extended_keymaps/extended_keymap_leo.c b/keyboard/planck/extended_keymaps/extended_keymap_leo.c
deleted file mode 100644
index 0c8b9e315..000000000
--- a/keyboard/planck/extended_keymaps/extended_keymap_leo.c
+++ /dev/null
@@ -1,46 +0,0 @@
1#include "extended_keymap_common.h"
2
3const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
4[0] = { /* BASE */
5 {KC_ESC, KC_LBRC, KC_QUOT, KC_SCLN, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_BSPC},
6 {KC_TAB, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_ENT},
7 {KC_LSFT, KC_DOT, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_COMM},
8 {KC_LCTL, KC_LALT, KC_LGUI, FUNC(3), FUNC(2), KC_SPC, KC_SPC, FUNC(1), FUNC(3), KC_RGUI, KC_RALT, KC_RCTL}
9},
10[2] = { /* RAISE */
11 {RALT(KC_RBRC), KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, S(KC_RBRC)},
12 {KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12},
13 {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS},
14 {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}
15},
16[3] = { /* LOWER */
17 {S(KC_EQL),S(KC_1),S(KC_2),S(KC_3),RALT(KC_5),S(KC_5), S(KC_6), S(KC_7),RALT(KC_7),RALT(KC_0),S(KC_0), KC_MINS},
18 {KC_TRNS,RALT(KC_2),S(KC_SLSH),KC_NUBS,S(KC_NUBS),RALT(KC_MINS),RALT(KC_NUBS), KC_NUHS, S(KC_8), S(KC_9), S(KC_MINS), KC_SLSH},
19 {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RALT(KC_8), RALT(KC_9), KC_TRNS, KC_TRNS},
20 {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}
21},
22[4] = { /* META */
23 {KC_TRNS, KC_HOME, KC_UP, KC_END, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_UP, KC_END, KC_TRNS, KC_DEL},
24 {KC_TRNS, KC_RGHT, KC_DOWN, KC_LEFT, KC_PGUP, KC_TRNS, KC_PGUP, KC_LEFT, KC_DOWN, KC_RGHT, KC_TRNS, KC_TRNS},
25 {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PGDN, KC_TRNS, KC_PGDN, KC_TRNS, KC_VOLD, KC_VOLU, KC_TRNS, KC_TRNS},
26 {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}
27}
28};
29
30const uint16_t PROGMEM fn_actions[] = {
31 [1] = ACTION_LAYER_MOMENTARY(2), // to RAISE
32 [2] = ACTION_LAYER_MOMENTARY(3), // to LOWER
33 [3] = ACTION_LAYER_MOMENTARY(4), // to META
34
35};
36
37const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
38{
39 // MACRODOWN only works in this function
40 switch(id) {
41 case 0:
42 return MACRODOWN(T(CM_T), END);
43 break;
44 }
45 return MACRO_NONE;
46};
diff --git a/keyboard/planck/extended_keymaps/extended_keymap_lock.c b/keyboard/planck/extended_keymaps/extended_keymap_lock.c
deleted file mode 100644
index bb989cca8..000000000
--- a/keyboard/planck/extended_keymaps/extended_keymap_lock.c
+++ /dev/null
@@ -1,65 +0,0 @@
1#include "extended_keymap_common.h"
2#include "backlight.h"
3#include "action_layer.h"
4
5const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
6[0] = { /* Qwerty */
7 {KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC},
8 {KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT},
9 {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT},
10 {M(0), KC_LCTL, KC_LALT, KC_LGUI, FUNC(2), KC_SPC, KC_SPC, FUNC(1), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT}
11 // Space is repeated to accommadate for both spacebar wiring positions
12},
13[1] = { /* Colemak */
14 {KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC},
15 {KC_ESC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT},
16 {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT},
17 {KC_FN3, KC_LCTL, KC_LALT, KC_LGUI, FUNC(2), KC_SPC, KC_SPC, FUNC(1), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT}
18},
19[2] = { /* RAISE */
20 {KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC},
21 {KC_TRNS, FUNC(3), FUNC(4), RESET, KC_TRNS, KC_TRNS, KC_TRNS, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS},
22 {KC_TRNS, KC_F11, KC_F12, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS},
23 {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, FUNC(1), KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY}
24},
25[3] = { /* LOWER */
26 {S(KC_GRV), S(KC_1), S(KC_2), S(KC_3), S(KC_4), S(KC_5), S(KC_6), S(KC_7), S(KC_8), S(KC_9), S(KC_0), KC_BSPC},
27 {KC_TRNS, FUNC(3), FUNC(4), RESET, KC_TRNS, KC_TRNS, KC_TRNS, S(KC_MINS), S(KC_EQL), S(KC_LBRC), S(KC_RBRC), S(KC_BSLS)},
28 {KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_TRNS},
29 {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, FUNC(2), KC_TRNS, KC_TRNS, KC_TRNS, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY}
30},
31[4] = { /* TENKEY */
32 {KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_KP_7, KC_KP_8, KC_KP_9, KC_P, KC_BSPC},
33 {KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_KP_4, KC_KP_5, KC_KP_6, KC_SCLN, KC_QUOT},
34 {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_KP_1, KC_KP_2, KC_KP_3, KC_SLSH, KC_ENT},
35 {KC_TRNS, KC_LCTL, KC_LALT, KC_LGUI, KC_TRNS, KC_SPC, KC_SPC, KC_KP_0, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT}
36}
37};
38
39const uint16_t PROGMEM fn_actions[] = {
40 [1] = ACTION_LAYER_MOMENTARY(2), // to RAISE
41 [2] = ACTION_LAYER_MOMENTARY(3), // to LOWER
42
43 [3] = ACTION_DEFAULT_LAYER_SET(0),
44 [4] = ACTION_DEFAULT_LAYER_SET(1),
45
46};
47
48const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
49{
50 // MACRODOWN only works in this function
51 switch(id) {
52 case 0:
53 if (record->event.pressed) {
54 // register_code(KC_RSFT);
55 backlight_set(BACKLIGHT_LEVELS);
56 layer_on(4);
57 } else {
58 // unregister_code(KC_RSFT);
59 backlight_set(0);
60 layer_clear();
61 }
62 break;
63 }
64 return MACRO_NONE;
65};
diff --git a/keyboard/planck/extended_keymaps/extended_keymap_max.c b/keyboard/planck/extended_keymaps/extended_keymap_max.c
deleted file mode 100644
index daad22dff..000000000
--- a/keyboard/planck/extended_keymaps/extended_keymap_max.c
+++ /dev/null
@@ -1,49 +0,0 @@
1#include "extended_keymap_common.h"
2
3const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
4[0] = { /* Qwerty */
5 {KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC},
6 {KC_TAB, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_ENT },
7 {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_QUOT},
8 {KC_LCTL, BL_STEP, KC_LALT, KC_LGUI, FUNC(2), KC_SPC, KC_SPC, FUNC(1), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT}
9 // Space is repeated to accommadate for both spacebar wiring positions
10},
11[1] = { /* Colemak */
12 {KC_ESC, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC},
13 {KC_TAB, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_ENT },
14 {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_QUOT},
15 {KC_LCTL, BL_STEP, KC_LALT, KC_LGUI, FUNC(2), KC_SPC, KC_SPC, FUNC(1), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT}
16},
17[2] = { /* RAISE */
18 {KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC},
19 {KC_TRNS, FUNC(3), FUNC(4), RESET, KC_TRNS, KC_TRNS, KC_TRNS, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_TRNS},
20 {KC_TRNS, KC_F11, KC_F12, KC_F13, KC_F14, KC_F15, KC_F16, KC_F17, KC_F18, KC_F19, KC_F20, KC_BSLS},
21 {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, FUNC(1), KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY}
22},
23[3] = { /* LOWER */
24 {S(KC_GRV), S(KC_1), S(KC_2), S(KC_3), S(KC_4), S(KC_5), S(KC_6), S(KC_7), S(KC_8), S(KC_9), S(KC_0), KC_BSPC},
25 {KC_TRNS, FUNC(3), FUNC(4), RESET, KC_TRNS, KC_TRNS, KC_TRNS, S(KC_MINS), S(KC_EQL), S(KC_LBRC), S(KC_RBRC), KC_TRNS},
26 {KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, S(KC_BSLS)},
27 {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, FUNC(2), KC_TRNS, KC_TRNS, KC_TRNS, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY}
28}
29};
30
31const uint16_t PROGMEM fn_actions[] = {
32 [1] = ACTION_LAYER_MOMENTARY(2), // to RAISE
33 [2] = ACTION_LAYER_MOMENTARY(3), // to LOWER
34
35 [3] = ACTION_DEFAULT_LAYER_SET(0),
36 [4] = ACTION_DEFAULT_LAYER_SET(1),
37
38};
39
40const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
41{
42 // MACRODOWN only works in this function
43 switch(id) {
44 case 0:
45 return MACRODOWN(T(CM_T), END);
46 break;
47 }
48 return MACRO_NONE;
49};
diff --git a/keyboard/planck/extended_keymaps/extended_keymap_numpad.c b/keyboard/planck/extended_keymaps/extended_keymap_numpad.c
deleted file mode 100644
index 721fd496b..000000000
--- a/keyboard/planck/extended_keymaps/extended_keymap_numpad.c
+++ /dev/null
@@ -1,26 +0,0 @@
1#include "extended_keymap_common.h"
2
3const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
4[0] = { /* Qwerty */
5 {KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_KP_MINUS, KC_KP_PLUS, KC_KP_PLUS, KC_KP_ENTER, KC_KP_ENTER},
6 {KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_KP_ASTERISK, KC_KP_9, KC_KP_6, KC_KP_3, KC_KP_DOT},
7 {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_KP_SLASH, KC_KP_8, KC_KP_5, KC_KP_2, KC_KP_0},
8 {BL_STEP, KC_LCTL, KC_LALT, KC_LGUI, KC_NO, KC_SPC, KC_SPC, KC_NUMLOCK, KC_KP_7, KC_KP_4, KC_KP_1, KC_KP_0}
9 // Space is repeated to accommadate for both spacebar wiring positions
10}
11};
12
13const uint16_t PROGMEM fn_actions[] = {
14
15};
16
17const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
18{
19 // MACRODOWN only works in this function
20 switch(id) {
21 case 0:
22 return MACRODOWN(T(CM_T), END);
23 break;
24 }
25 return MACRO_NONE;
26}; \ No newline at end of file
diff --git a/keyboard/planck/keymap_common.c b/keyboard/planck/keymap_common.c
index fdb1769e1..1ce450097 100644
--- a/keyboard/planck/keymap_common.c
+++ b/keyboard/planck/keymap_common.c
@@ -14,17 +14,197 @@ GNU General Public License for more details.
14You should have received a copy of the GNU General Public License 14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>. 15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/ 16*/
17
17#include "keymap_common.h" 18#include "keymap_common.h"
19#include "report.h"
20#include "keycode.h"
21#include "action_layer.h"
22#include "action.h"
23#include "action_macro.h"
24#include "debug.h"
25#include "backlight.h"
26
27static action_t keycode_to_action(uint16_t keycode);
28
29
30/* converts key to action */
31action_t action_for_key(uint8_t layer, keypos_t key)
32{
33 // 16bit keycodes - important
34 uint16_t keycode = keymap_key_to_keycode(layer, key);
35
36 if (keycode >= 0x0100 && keycode < 0x2000) {
37 // Has a modifier
38 action_t action;
39 // Split it up
40 action.code = ACTION_MODS_KEY(keycode >> 8, keycode & 0xFF);
41 return action;
42 } else if (keycode >= 0x2000 && keycode < 0x3000) {
43 // Is a shortcut for function layer, pull last 12bits
44 return keymap_func_to_action(keycode & 0xFFF);
45 } else if (keycode >= 0x3000 && keycode < 0x4000) {
46 action_t action;
47 action.code = ACTION_MACRO(keycode & 0xFF);
48 return action;
49 } else if (keycode >= BL_0 & keycode <= BL_15) {
50 action_t action;
51 action.code = ACTION_BACKLIGHT_LEVEL(keycode & 0x000F);
52 return action;
53 } else if (keycode == BL_DEC) {
54 action_t action;
55 action.code = ACTION_BACKLIGHT_DECREASE();
56 return action;
57 } else if (keycode == BL_INC) {
58 action_t action;
59 action.code = ACTION_BACKLIGHT_INCREASE();
60 return action;
61 } else if (keycode == BL_TOGG) {
62 action_t action;
63 action.code = ACTION_BACKLIGHT_TOGGLE();
64 return action;
65 } else if (keycode == BL_STEP) {
66 action_t action;
67 action.code = ACTION_BACKLIGHT_STEP();
68 return action;
69 } else if (keycode == RESET) {
70 bootloader_jump();
71 return;
72 } else if (keycode > RESET) {
73 // MIDI
74 return;
75 }
76
77 switch (keycode) {
78 case KC_FN0 ... KC_FN31:
79 return keymap_fn_to_action(keycode);
80#ifdef BOOTMAGIC_ENABLE
81 case KC_CAPSLOCK:
82 case KC_LOCKING_CAPS:
83 if (keymap_config.swap_control_capslock || keymap_config.capslock_to_control) {
84 return keycode_to_action(KC_LCTL);
85 }
86 return keycode_to_action(keycode);
87 case KC_LCTL:
88 if (keymap_config.swap_control_capslock) {
89 return keycode_to_action(KC_CAPSLOCK);
90 }
91 return keycode_to_action(KC_LCTL);
92 case KC_LALT:
93 if (keymap_config.swap_lalt_lgui) {
94 if (keymap_config.no_gui) {
95 return keycode_to_action(ACTION_NO);
96 }
97 return keycode_to_action(KC_LGUI);
98 }
99 return keycode_to_action(KC_LALT);
100 case KC_LGUI:
101 if (keymap_config.swap_lalt_lgui) {
102 return keycode_to_action(KC_LALT);
103 }
104 if (keymap_config.no_gui) {
105 return keycode_to_action(ACTION_NO);
106 }
107 return keycode_to_action(KC_LGUI);
108 case KC_RALT:
109 if (keymap_config.swap_ralt_rgui) {
110 if (keymap_config.no_gui) {
111 return keycode_to_action(ACTION_NO);
112 }
113 return keycode_to_action(KC_RGUI);
114 }
115 return keycode_to_action(KC_RALT);
116 case KC_RGUI:
117 if (keymap_config.swap_ralt_rgui) {
118 return keycode_to_action(KC_RALT);
119 }
120 if (keymap_config.no_gui) {
121 return keycode_to_action(ACTION_NO);
122 }
123 return keycode_to_action(KC_RGUI);
124 case KC_GRAVE:
125 if (keymap_config.swap_grave_esc) {
126 return keycode_to_action(KC_ESC);
127 }
128 return keycode_to_action(KC_GRAVE);
129 case KC_ESC:
130 if (keymap_config.swap_grave_esc) {
131 return keycode_to_action(KC_GRAVE);
132 }
133 return keycode_to_action(KC_ESC);
134 case KC_BSLASH:
135 if (keymap_config.swap_backslash_backspace) {
136 return keycode_to_action(KC_BSPACE);
137 }
138 return keycode_to_action(KC_BSLASH);
139 case KC_BSPACE:
140 if (keymap_config.swap_backslash_backspace) {
141 return keycode_to_action(KC_BSLASH);
142 }
143 return keycode_to_action(KC_BSPACE);
144#endif
145 default:
146 return keycode_to_action(keycode);
147 }
148}
149
150
151/* Macro */
152__attribute__ ((weak))
153const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
154{
155 return MACRO_NONE;
156}
157
158/* Function */
159__attribute__ ((weak))
160void action_function(keyrecord_t *record, uint8_t id, uint8_t opt)
161{
162}
163
164/* translates keycode to action */
165static action_t keycode_to_action(uint16_t keycode)
166{
167 action_t action;
168 switch (keycode) {
169 case KC_A ... KC_EXSEL:
170 case KC_LCTRL ... KC_RGUI:
171 action.code = ACTION_KEY(keycode);
172 break;
173 case KC_SYSTEM_POWER ... KC_SYSTEM_WAKE:
174 action.code = ACTION_USAGE_SYSTEM(KEYCODE2SYSTEM(keycode));
175 break;
176 case KC_AUDIO_MUTE ... KC_WWW_FAVORITES:
177 action.code = ACTION_USAGE_CONSUMER(KEYCODE2CONSUMER(keycode));
178 break;
179 case KC_MS_UP ... KC_MS_ACCEL2:
180 action.code = ACTION_MOUSEKEY(keycode);
181 break;
182 case KC_TRNS:
183 action.code = ACTION_TRANSPARENT;
184 break;
185 default:
186 action.code = ACTION_NO;
187 break;
188 }
189 return action;
190}
18 191
19 192
20/* translates key to keycode */ 193/* translates key to keycode */
21uint8_t keymap_key_to_keycode(uint8_t layer, keypos_t key) 194uint16_t keymap_key_to_keycode(uint8_t layer, keypos_t key)
22{ 195{
23 return pgm_read_byte(&keymaps[(layer)][(key.row)][(key.col)]); 196 // Read entire word (16bits)
197 return pgm_read_word(&keymaps[(layer)][(key.row)][(key.col)]);
24} 198}
25 199
26/* translates Fn keycode to action */ 200/* translates Fn keycode to action */
27action_t keymap_fn_to_action(uint8_t keycode) 201action_t keymap_fn_to_action(uint16_t keycode)
28{ 202{
29 return (action_t){ .code = pgm_read_word(&fn_actions[FN_INDEX(keycode)]) }; 203 return (action_t){ .code = pgm_read_word(&fn_actions[FN_INDEX(keycode)]) };
30} 204}
205
206action_t keymap_func_to_action(uint16_t keycode)
207{
208 // For FUNC without 8bit limit
209 return (action_t){ .code = pgm_read_word(&fn_actions[(int)keycode]) };
210}
diff --git a/keyboard/planck/keymap_common.h b/keyboard/planck/keymap_common.h
index d46df9287..e6a7dac5b 100644
--- a/keyboard/planck/keymap_common.h
+++ b/keyboard/planck/keymap_common.h
@@ -14,116 +14,167 @@ GNU General Public License for more details.
14You should have received a copy of the GNU General Public License 14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>. 15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/ 16*/
17#ifndef KEYMAP_COMMON_H 17
18#define KEYMAP_COMMON_H 18#ifndef KEYMAP_H
19#define KEYMAP_H
19 20
20#include <stdint.h> 21#include <stdint.h>
21#include <stdbool.h> 22#include <stdbool.h>
23#include "action.h"
22#include <avr/pgmspace.h> 24#include <avr/pgmspace.h>
23#include "keycode.h" 25#include "keycode.h"
24#include "action.h" 26#include "keymap.h"
25#include "action_macro.h" 27#include "action_macro.h"
26#include "report.h" 28#include "report.h"
27#include "host.h" 29#include "host.h"
28// #include "print.h" 30// #include "print.h"
29#include "debug.h" 31#include "debug.h"
30#include "keymap.h" 32
33#ifdef BOOTMAGIC_ENABLE
34/* NOTE: Not portable. Bit field order depends on implementation */
35typedef 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;
48keymap_config_t keymap_config;
49#endif
31 50
32 51
33extern const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS]; 52/* translates key to keycode */
34extern const uint16_t fn_actions[]; 53uint16_t keymap_key_to_keycode(uint8_t layer, keypos_t key);
35 54
55/* translates Fn keycode to action */
56action_t keymap_fn_to_action(uint16_t keycode);
36 57
37// MIT Layout 58/* translates Fn keycode to action */
38/* 59action_t keymap_func_to_action(uint16_t keycode);
39 * ,-----------------------------------------------------------------------.
40 * | | | | | | | | | | | | |
41 * |-----------------------------------------------------------------------|
42 * | | | | | | | | | | | | |
43 * |-----------------------------------------------------------------------|
44 * | | | | | | | | | | | | |
45 * |-----------------------------------------------------------------------|
46 * | | | | | | | | | | | |
47 * `-----------------------------------------------------------------------'
48 */
49#define KEYMAP( \
50 K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, \
51 K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, \
52 K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, \
53 K30, K31, K32, K33, K34, K35, K37, K38, K39, K3A, K3B \
54) { \
55 { KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07, KC_##K08, KC_##K09, KC_##K0A, KC_##K0B }, \
56 { KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17, KC_##K18, KC_##K19, KC_##K1A, KC_##K1B }, \
57 { KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27, KC_##K28, KC_##K29, KC_##K2A, KC_##K2B }, \
58 { KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_##K34, KC_##K35, KC_##K35, KC_##K37, KC_##K38, KC_##K39, KC_##K3A, KC_##K3B } \
59}
60
61// Grid Layout
62/*
63 * ,-----------------------------------------------------------------------.
64 * | | | | | | | | | | | | |
65 * |-----------------------------------------------------------------------|
66 * | | | | | | | | | | | | |
67 * |-----------------------------------------------------------------------|
68 * | | | | | | | | | | | | |
69 * |-----------------------------------------------------------------------|
70 * | | | | | | | | | | | | |
71 * `-----------------------------------------------------------------------'
72 */
73#define KEYMAP_GRID( \
74 K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, \
75 K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, \
76 K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, \
77 K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B \
78) { \
79 { KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07, KC_##K08, KC_##K09, KC_##K0A, KC_##K0B }, \
80 { KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17, KC_##K18, KC_##K19, KC_##K1A, KC_##K1B }, \
81 { KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27, KC_##K28, KC_##K29, KC_##K2A, KC_##K2B }, \
82 { KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_##K34, KC_##K35, KC_##K36, KC_##K37, KC_##K38, KC_##K39, KC_##K3A, KC_##K3B } \
83}
84
85#define KEYMAP_REVERSE( \
86 K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, \
87 K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, \
88 K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, \
89 K30, K31, K32, K33, K34, K35, K37, K38, K39, K3A, K3B \
90 ) { \
91 { KC_##K0B, KC_##K0A, KC_##K09, KC_##K08, KC_##K07, KC_##K06, KC_##K05, KC_##K04, KC_##K03, KC_##K02, KC_##K01, KC_##K00 }, \
92 { KC_##K1B, KC_##K1A, KC_##K19, KC_##K18, KC_##K17, KC_##K16, KC_##K15, KC_##K14, KC_##K13, KC_##K12, KC_##K11, KC_##K10 }, \
93 { KC_##K2B, KC_##K2A, KC_##K29, KC_##K28, KC_##K27, KC_##K26, KC_##K25, KC_##K24, KC_##K23, KC_##K22, KC_##K21, KC_##K20 }, \
94 { KC_##K3B, KC_##K3A, KC_##K39, KC_##K38, KC_##K37, KC_##K35, KC_##K35, KC_##K34, KC_##K33, KC_##K32, KC_##K31, KC_##K30 }, \
95 }
96
97#define KEYMAP_AND_REVERSE(args...) KEYMAP(args), KEYMAP_REVERSE(args)
98
99#define KEYMAP_SWAP( \
100 K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, \
101 K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, \
102 K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, \
103 K30, K31, K32, K33, K34, K35, K37, K38, K39, K3A, K3B \
104 ) { \
105 { KC_##K06, KC_##K07, KC_##K08, KC_##K09, KC_##K0A, KC_##K0B, KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05 }, \
106 { KC_##K16, KC_##K17, KC_##K18, KC_##K19, KC_##K1A, KC_##K1B, KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15 }, \
107 { KC_##K26, KC_##K27, KC_##K28, KC_##K29, KC_##K2A, KC_##K2B, KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25 }, \
108 { KC_##K37, KC_##K38, KC_##K39, KC_##K3A, KC_##K3B, KC_##K35, KC_##K35, KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_##K34 }, \
109}
110
111#define KEYMAP_AND_SWAP(args...) KEYMAP(args), KEYMAP_SWAP(args)
112 60
113/* 61extern const uint16_t keymaps[][MATRIX_ROWS][MATRIX_COLS];
114 Keymap for the Planck 48 key variant. 62extern const uint16_t fn_actions[];
115 */
116#define KEYMAP_48( \
117 K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, \
118 K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, \
119 K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, \
120 K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B \
121) { \
122 { KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07, KC_##K08, KC_##K09, KC_##K0A, KC_##K0B }, \
123 { KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17, KC_##K18, KC_##K19, KC_##K1A, KC_##K1B }, \
124 { KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27, KC_##K28, KC_##K29, KC_##K2A, KC_##K2B }, \
125 { KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_##K34, KC_##K35, KC_##K36, KC_##K37, KC_##K38, KC_##K39, KC_##K3A, KC_##K3B }, \
126}
127 63
64// Ability to use mods in layouts
65#define LCTL(kc) kc | 0x0100
66#define LSFT(kc) kc | 0x0200
67#define LALT(kc) kc | 0x0400
68#define LGUI(kc) kc | 0x0800
69#define RCTL(kc) kc | 0x1100
70#define RSFT(kc) kc | 0x1200
71#define RALT(kc) kc | 0x1400
72#define RGUI(kc) kc | 0x1800
73
74// Alias for function layers than expand past FN31
75#define FUNC(kc) kc | 0x2000
76
77// Aliases
78#define S(kc) LSFT(kc)
79#define F(kc) FUNC(kc)
80
81// For software implementation of colemak
82#define CM_Q KC_Q
83#define CM_W KC_W
84#define CM_F KC_E
85#define CM_P KC_R
86#define CM_G KC_T
87#define CM_J KC_Y
88#define CM_L KC_U
89#define CM_U KC_I
90#define CM_Y KC_O
91#define CM_SCLN KC_P
92
93#define CM_A KC_A
94#define CM_R KC_S
95#define CM_S KC_D
96#define CM_T KC_F
97#define CM_D KC_G
98#define CM_H KC_H
99#define CM_N KC_J
100#define CM_E KC_K
101#define CM_I KC_L
102#define CM_O KC_SCLN
103
104#define CM_Z KC_Z
105#define CM_X KC_X
106#define CM_C KC_C
107#define CM_V KC_V
108#define CM_B KC_B
109#define CM_K KC_N
110#define CM_M KC_M
111#define CM_COMM KC_COMM
112#define CM_DOT KC_DOT
113#define CM_SLSH KC_SLSH
114
115// Make it easy to support these in macros
116#define KC_CM_Q CM_Q
117#define KC_CM_W CM_W
118#define KC_CM_F CM_F
119#define KC_CM_P CM_P
120#define KC_CM_G CM_G
121#define KC_CM_J CM_J
122#define KC_CM_L CM_L
123#define KC_CM_U CM_U
124#define KC_CM_Y CM_Y
125#define KC_CM_SCLN CM_SCLN
126
127#define KC_CM_A CM_A
128#define KC_CM_R CM_R
129#define KC_CM_S CM_S
130#define KC_CM_T CM_T
131#define KC_CM_D CM_D
132#define KC_CM_H CM_H
133#define KC_CM_N CM_N
134#define KC_CM_E CM_E
135#define KC_CM_I CM_I
136#define KC_CM_O CM_O
137
138#define KC_CM_Z CM_Z
139#define KC_CM_X CM_X
140#define KC_CM_C CM_C
141#define KC_CM_V CM_V
142#define KC_CM_B CM_B
143#define KC_CM_K CM_K
144#define KC_CM_M CM_M
145#define KC_CM_COMM CM_COMM
146#define KC_CM_DOT CM_DOT
147#define KC_CM_SLSH CM_SLSH
148
149#define M(kc) kc | 0x3000
150
151#define MACRODOWN(...) (record->event.pressed ? MACRO(__VA_ARGS__) : MACRO_NONE)
152
153#define BL_ON 0x4009
154#define BL_OFF 0x4000
155#define BL_0 0x4000
156#define BL_1 0x4001
157#define BL_2 0x4002
158#define BL_3 0x4003
159#define BL_4 0x4004
160#define BL_5 0x4005
161#define BL_6 0x4006
162#define BL_7 0x4007
163#define BL_8 0x4008
164#define BL_9 0x4009
165#define BL_10 0x400A
166#define BL_11 0x400B
167#define BL_12 0x400C
168#define BL_13 0x400D
169#define BL_14 0x400E
170#define BL_15 0x400F
171#define BL_DEC 0x4010
172#define BL_INC 0x4011
173#define BL_TOGG 0x4012
174#define BL_STEP 0x4013
175
176#define RESET 0x5000
177
178#define MIDI(n) n | 0x6000
128 179
129#endif 180#endif
diff --git a/keyboard/planck/extended_keymaps/extended_keymap_default.c b/keyboard/planck/keymaps/keymap_default.c
index c75144bf4..7eb81b202 100644
--- a/keyboard/planck/extended_keymaps/extended_keymap_default.c
+++ b/keyboard/planck/keymaps/keymap_default.c
@@ -1,6 +1,5 @@
1#include "extended_keymap_common.h" 1#include "keymap_common.h"
2#include "backlight.h" 2#include "backlight.h"
3#include "lufa.h"
4#include "debug.h" 3#include "debug.h"
5 4
6const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { 5const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
@@ -53,11 +52,9 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
53 case 0: 52 case 0:
54 if (record->event.pressed) { 53 if (record->event.pressed) {
55 register_code(KC_RSFT); 54 register_code(KC_RSFT);
56 midi_send_noteon(&midi_device, 1, 64, 127);
57 backlight_step(); 55 backlight_step();
58 } else { 56 } else {
59 unregister_code(KC_RSFT); 57 unregister_code(KC_RSFT);
60 midi_send_noteoff(&midi_device, 1, 64, 127);
61 } 58 }
62 break; 59 break;
63 } 60 }
diff --git a/keyboard/planck/matrix.c b/keyboard/planck/matrix.c
index 58bd61f75..98ef55ed6 100644
--- a/keyboard/planck/matrix.c
+++ b/keyboard/planck/matrix.c
@@ -27,7 +27,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
27#include "debug.h" 27#include "debug.h"
28#include "util.h" 28#include "util.h"
29#include "matrix.h" 29#include "matrix.h"
30#include "backlight.h" // TODO fix this dependency
31 30
32#ifndef DEBOUNCE 31#ifndef DEBOUNCE
33# define DEBOUNCE 10 32# define DEBOUNCE 10
diff --git a/keyboard/planck/matrix_center.c b/keyboard/planck/matrix_center.c
deleted file mode 100644
index 2a603f334..000000000
--- a/keyboard/planck/matrix_center.c
+++ /dev/null
@@ -1,269 +0,0 @@
1/*
2Copyright 2012 Jun Wako <wakojun@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18/*
19 * scan matrix
20 */
21#include <stdint.h>
22#include <stdbool.h>
23#include <avr/io.h>
24#include <util/delay.h>
25#include "action_layer.h"
26// #include "print.h"
27#include "debug.h"
28#include "util.h"
29#include "matrix.h"
30#include "analog.h"
31
32
33#ifndef DEBOUNCE
34# define DEBOUNCE 10
35#endif
36static uint8_t debouncing = DEBOUNCE;
37
38/* matrix state(1:on, 0:off) */
39static matrix_row_t matrix[MATRIX_ROWS];
40static matrix_row_t matrix_debouncing[MATRIX_ROWS];
41
42static matrix_row_t read_cols(void);
43static void init_cols(void);
44static void init_encoder(void);
45static void init_pot(void);
46static void unselect_rows(void);
47static void select_row(uint8_t row);
48int16_t analogRead(uint8_t pin);
49uint8_t state;
50int32_t position;
51int16_t value;
52
53inline
54uint8_t matrix_rows(void)
55{
56 return MATRIX_ROWS;
57}
58
59inline
60uint8_t matrix_cols(void)
61{
62 return MATRIX_COLS;
63}
64
65void matrix_init(void)
66{
67 // initialize row and col
68 unselect_rows();
69 init_cols();
70 init_encoder();
71 init_pot();
72
73 // initialize matrix state: all keys off
74 for (uint8_t i=0; i < MATRIX_ROWS; i++) {
75 matrix[i] = 0;
76 matrix_debouncing[i] = 0;
77 }
78}
79
80static void init_encoder(void)
81{
82 DDRC &= ~(1<<6 | 1<<7);
83 PORTC |= (1<<6 | 1<<7);
84
85 uint8_t s = 0;
86 _delay_ms(1);
87 if (PINC&(1<<6)) s |= 1;
88 if (PINC&(1<<7)) s |= 2;
89 state = s;
90 position = 0;
91}
92
93void read_encoder(void)
94{
95 uint8_t s = state & 3;
96 if (PINC&(1<<6)) s |= 4;
97 if (PINC&(1<<7)) s |= 8;
98 state = (s >> 2);
99 switch (s) {
100 case 1: case 7: case 8: case 14:
101 position++;
102 break;
103 case 2: case 4: case 11: case 13:
104 position--;
105 break;
106 case 3: case 12:
107 position += 2;
108 break;
109 case 6: case 9:
110 position -= 2;
111 break;
112 }
113}
114
115#define HEX(n) (((n) < 10) ? ((n) + '0') : ((n) + 'A' - 10))
116
117static void init_pot(void)
118{
119 // DDRD &= ~(1<<4);
120 // PORTD |= (1<<4);
121 // DIDR2 = (1<<0);
122}
123
124uint8_t matrix_scan(void)
125{
126 for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
127 select_row(i);
128 _delay_us(30); // without this wait read unstable value.
129 matrix_row_t cols = read_cols();
130 if (matrix_debouncing[i] != cols) {
131 matrix_debouncing[i] = cols;
132 if (debouncing) {
133 debug("bounce!: "); debug_hex(debouncing); debug("\n");
134 }
135 debouncing = DEBOUNCE;
136 }
137 unselect_rows();
138 }
139
140 if (debouncing) {
141 if (--debouncing) {
142 _delay_ms(1);
143 } else {
144 for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
145 matrix[i] = matrix_debouncing[i];
146 }
147 }
148 }
149
150 read_encoder();
151 if (position >= 2) {
152 register_code(KC_AUDIO_VOL_UP);
153 unregister_code(KC_AUDIO_VOL_UP);
154 position = 0;
155 } else if (position <= -2) {
156 register_code(KC_AUDIO_VOL_DOWN);
157 unregister_code(KC_AUDIO_VOL_DOWN);
158 position = 0;
159 }
160
161 // uint16_t val = analogRead(11);
162
163 // debug("analogRead: "); debug_hex(val); debug("\n");
164
165 return 1;
166}
167
168bool matrix_is_modified(void)
169{
170 if (debouncing) return false;
171 return true;
172}
173
174inline
175bool matrix_is_on(uint8_t row, uint8_t col)
176{
177 return (matrix[row] & ((matrix_row_t)1<<col));
178}
179
180inline
181matrix_row_t matrix_get_row(uint8_t row)
182{
183 return matrix[row];
184}
185
186void matrix_print(void)
187{
188 print("\nr/c 0123456789ABCDEF\n");
189 for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
190 phex(row); print(": ");
191 pbin_reverse16(matrix_get_row(row));
192 print("\n");
193 }
194}
195
196uint8_t matrix_key_count(void)
197{
198 uint8_t count = 0;
199 for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
200 count += bitpop16(matrix[i]);
201 }
202 return count;
203}
204
205/* Column pin configuration
206 * col: 0 1 2 3 4 5 6 7 8 9 10 11
207 * pin: F0 F1 F4 F5 F6 F7 B6 B5 B4 D7 D5 D4
208 */
209
210static void init_cols(void)
211{
212 DDRF &= ~(1<<0 | 1<<1 | 1<<4 | 1<<5 | 1<<6 | 1<<7);
213 PORTF |= (1<<0 | 1<<1 | 1<<4 | 1<<5 | 1<<6 | 1<<7);
214 DDRD &= ~(1<<0);
215 PORTD |= (1<<0);
216 DDRB &= ~(1<<0 | 1<<1 | 1<<2 | 1<<3 | 1<<7);
217 PORTB |= (1<<0 | 1<<1 | 1<<2 | 1<<3 | 1<<7);
218}
219
220static matrix_row_t read_cols(void)
221{
222 return (PINB&(1<<0) ? 0 : (1<< 0)) |
223 (PINB&(1<<1) ? 0 : (1<< 1)) |
224 (PINB&(1<<2) ? 0 : (1<< 2)) |
225 (PINB&(1<<3) ? 0 : (1<< 3)) |
226 (PINB&(1<<7) ? 0 : (1<< 4)) |
227 (PIND&(1<<0) ? 0 : (1<< 5)) |
228 (PINF&(1<<7) ? 0 : (1<< 6)) |
229 (PINF&(1<<6) ? 0 : (1<< 7)) |
230 (PINF&(1<<5) ? 0 : (1<< 8)) |
231 (PINF&(1<<4) ? 0 : (1<< 9)) |
232 (PINF&(1<<1) ? 0 : (1<<10)) |
233 (PINF&(1<<0) ? 0 : (1<<11));
234}
235
236/* Row pin configuration
237 * row: 0 1 2 3
238 * pin: B0 B1 B2 B3
239 */
240static void unselect_rows(void)
241{
242 // Hi-Z(DDR:0, PORT:0) to unselect
243 DDRB &= ~0b01110000;
244 PORTB &= ~0b01110000;
245 DDRD &= ~0b10000000;
246 PORTD &= ~0b10000000;
247}
248
249static void select_row(uint8_t row)
250{
251 switch (row) {
252 case 0:
253 DDRB |= (1<<6);
254 PORTB &= ~(1<<6);
255 break;
256 case 1:
257 DDRB |= (1<<5);
258 PORTB &= ~(1<<5);
259 break;
260 case 2:
261 DDRB |= (1<<4);
262 PORTB &= ~(1<<4);
263 break;
264 case 3:
265 DDRD |= (1<<7);
266 PORTD &= ~(1<<7);
267 break;
268 }
269}
diff --git a/keyboard/planck/matrix_handwired.c b/keyboard/planck/matrix_handwired.c
deleted file mode 100644
index 2ae69c3c8..000000000
--- a/keyboard/planck/matrix_handwired.c
+++ /dev/null
@@ -1,193 +0,0 @@
1/*
2Copyright 2012 Jun Wako
3Generated by planckkeyboard.com (2014 Jack Humbert)
4
5This program is free software: you can redistribute it and/or modify
6it under the terms of the GNU General Public License as published by
7the Free Software Foundation, either version 2 of the License, or
8(at your option) any later version.
9
10This program is distributed in the hope that it will be useful,
11but WITHOUT ANY WARRANTY; without even the implied warranty of
12MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13GNU General Public License for more details.
14
15You should have received a copy of the GNU General Public License
16along with this program. If not, see <http://www.gnu.org/licenses/>.
17*/
18
19/*
20 * scan matrix
21 */
22#include <stdint.h>
23#include <stdbool.h>
24#include <avr/io.h>
25#include <util/delay.h>
26// #include "print.h"
27#include "debug.h"
28#include "util.h"
29#include "matrix.h"
30
31
32#ifndef DEBOUNCE
33# define DEBOUNCE 10
34#endif
35static uint8_t debouncing = DEBOUNCE;
36
37/* matrix state(1:on, 0:off) */
38static matrix_row_t matrix[MATRIX_ROWS];
39static matrix_row_t matrix_debouncing[MATRIX_ROWS];
40
41static matrix_row_t read_cols(void);
42static void init_cols(void);
43static void unselect_rows(void);
44static void select_row(uint8_t row);
45
46inline
47uint8_t matrix_rows(void)
48{
49 return MATRIX_ROWS;
50}
51
52inline
53uint8_t matrix_cols(void)
54{
55 return MATRIX_COLS;
56}
57
58void matrix_init(void)
59{
60 // initialize row and col
61 unselect_rows();
62 init_cols();
63
64 // initialize matrix state: all keys off
65 for (uint8_t i=0; i < MATRIX_ROWS; i++) {
66 matrix[i] = 0;
67 matrix_debouncing[i] = 0;
68 }
69}
70
71uint8_t matrix_scan(void)
72{
73 for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
74 select_row(i);
75 _delay_us(30); // without this wait read unstable value.
76 matrix_row_t cols = read_cols();
77 if (matrix_debouncing[i] != cols) {
78 matrix_debouncing[i] = cols;
79 if (debouncing) {
80 debug("bounce!: "); debug_hex(debouncing); debug("\n");
81 }
82 debouncing = DEBOUNCE;
83 }
84 unselect_rows();
85 }
86
87 if (debouncing) {
88 if (--debouncing) {
89 _delay_ms(1);
90 } else {
91 for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
92 matrix[i] = matrix_debouncing[i];
93 }
94 }
95 }
96
97 return 1;
98}
99
100bool matrix_is_modified(void)
101{
102 if (debouncing) return false;
103 return true;
104}
105
106inline
107bool matrix_is_on(uint8_t row, uint8_t col)
108{
109 return (matrix[row] & ((matrix_row_t)1<col));
110}
111
112inline
113matrix_row_t matrix_get_row(uint8_t row)
114{
115 return matrix[row];
116}
117
118void matrix_print(void)
119{
120 print("\nr/c 0123456789ABCDEF\n");
121 for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
122 phex(row); print(": ");
123 pbin_reverse16(matrix_get_row(row));
124 print("\n");
125 }
126}
127
128uint8_t matrix_key_count(void)
129{
130 uint8_t count = 0;
131 for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
132 count += bitpop16(matrix[i]);
133 }
134 return count;
135}
136
137static void init_cols(void)
138{
139 DDRB &= ~(1<<6 | 1<<5 | 1<<4);
140 PORTB |= (1<<6 | 1<<5 | 1<<4);
141 DDRD &= ~(1<<7 | 1<<6 | 1<<4);
142 PORTD |= (1<<7 | 1<<6 | 1<<4);
143 DDRF &= ~(1<<0 | 1<<1 | 1<<4 | 1<<5 | 1<<6 | 1<<7);
144 PORTF |= (1<<0 | 1<<1 | 1<<4 | 1<<5 | 1<<6 | 1<<7);
145
146}
147
148static matrix_row_t read_cols(void)
149{
150 return (PIND&(1<<4) ? 0 : (1<<0)) |
151 (PIND&(1<<6) ? 0 : (1<<1)) |
152 (PIND&(1<<7) ? 0 : (1<<2)) |
153 (PINB&(1<<4) ? 0 : (1<<3)) |
154 (PINB&(1<<5) ? 0 : (1<<4)) |
155 (PINB&(1<<6) ? 0 : (1<<5)) |
156 (PINF&(1<<7) ? 0 : (1<<6)) |
157 (PINF&(1<<6) ? 0 : (1<<7)) |
158 (PINF&(1<<5) ? 0 : (1<<8)) |
159 (PINF&(1<<4) ? 0 : (1<<9)) |
160 (PINF&(1<<1) ? 0 : (1<<10)) |
161 (PINF&(1<<0) ? 0 : (1<<11));
162
163}
164
165static void unselect_rows(void)
166{
167 DDRB &= ~(1<<0 | 1<<1 | 1<<2 | 1<<3);
168 PORTB |= (1<<0 | 1<<1 | 1<<2 | 1<<3);
169
170}
171
172static void select_row(uint8_t row)
173{
174 switch (row) {
175 case 0:
176 DDRB |= (1<<0);
177 PORTB &= ~(1<<0);
178 break;
179 case 1:
180 DDRB |= (1<<1);
181 PORTB &= ~(1<<1);
182 break;
183 case 2:
184 DDRB |= (1<<2);
185 PORTB &= ~(1<<2);
186 break;
187 case 3:
188 DDRB |= (1<<3);
189 PORTB &= ~(1<<3);
190 break;
191
192 }
193}
diff --git a/keyboard/planck/matrix_pcb.c b/keyboard/planck/matrix_pcb.c
deleted file mode 100644
index 2a9ec8fcd..000000000
--- a/keyboard/planck/matrix_pcb.c
+++ /dev/null
@@ -1,222 +0,0 @@
1/*
2Copyright 2012 Jun Wako
3Generated by planckkeyboard.com (2014 Jack Humbert)
4
5This program is free software: you can redistribute it and/or modify
6it under the terms of the GNU General Public License as published by
7the Free Software Foundation, either version 2 of the License, or
8(at your option) any later version.
9
10This program is distributed in the hope that it will be useful,
11but WITHOUT ANY WARRANTY; without even the implied warranty of
12MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13GNU General Public License for more details.
14
15You should have received a copy of the GNU General Public License
16along with this program. If not, see <http://www.gnu.org/licenses/>.
17*/
18
19/*
20 * scan matrix
21 */
22#include <stdint.h>
23#include <stdbool.h>
24#include <avr/io.h>
25#include <util/delay.h>
26// #include "print.h"
27#include "debug.h"
28#include "util.h"
29#include "matrix.h"
30#include "backlight.h" // TODO fix this dependency
31
32#ifndef DEBOUNCE
33# define DEBOUNCE 10
34#endif
35static uint8_t debouncing = DEBOUNCE;
36
37/* matrix state(1:on, 0:off) */
38static matrix_row_t matrix[MATRIX_ROWS];
39static matrix_row_t matrix_debouncing[MATRIX_ROWS];
40
41static matrix_row_t read_cols(void);
42static void init_cols(void);
43static void unselect_rows(void);
44static void select_row(uint8_t row);
45
46inline
47uint8_t matrix_rows(void)
48{
49 return MATRIX_ROWS;
50}
51
52inline
53uint8_t matrix_cols(void)
54{
55 return MATRIX_COLS;
56}
57
58void matrix_init(void)
59{
60 // To use PORTF disable JTAG with writing JTD bit twice within four cycles.
61 MCUCR |= (1<<JTD);
62 MCUCR |= (1<<JTD);
63
64 backlight_init_ports();
65
66 // Turn status LED on
67 DDRE |= (1<<6);
68 PORTE |= (1<<6);
69
70 // initialize row and col
71 unselect_rows();
72 init_cols();
73
74 // initialize matrix state: all keys off
75 for (uint8_t i=0; i < MATRIX_ROWS; i++) {
76 matrix[i] = 0;
77 matrix_debouncing[i] = 0;
78 }
79}
80
81
82uint8_t matrix_scan(void)
83{
84 for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
85 select_row(i);
86 _delay_us(30); // without this wait read unstable value.
87 matrix_row_t cols = read_cols();
88 if (matrix_debouncing[i] != cols) {
89 matrix_debouncing[i] = cols;
90 if (debouncing) {
91 debug("bounce!: "); debug_hex(debouncing); debug("\n");
92 }
93 debouncing = DEBOUNCE;
94 }
95 unselect_rows();
96 }
97
98 if (debouncing) {
99 if (--debouncing) {
100 _delay_ms(1);
101 } else {
102 for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
103 matrix[i] = matrix_debouncing[i];
104 }
105 }
106 }
107
108 return 1;
109}
110
111bool matrix_is_modified(void)
112{
113 if (debouncing) return false;
114 return true;
115}
116
117inline
118bool matrix_is_on(uint8_t row, uint8_t col)
119{
120 return (matrix[row] & ((matrix_row_t)1<col));
121}
122
123inline
124matrix_row_t matrix_get_row(uint8_t row)
125{
126 return matrix[row];
127}
128
129void matrix_print(void)
130{
131 print("\nr/c 0123456789ABCDEF\n");
132 for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
133 phex(row); print(": ");
134 pbin_reverse16(matrix_get_row(row));
135 print("\n");
136 }
137}
138
139uint8_t matrix_key_count(void)
140{
141 uint8_t count = 0;
142 for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
143 count += bitpop16(matrix[i]);
144 }
145 return count;
146}
147
148//
149// Planck PCB Rev 1 Pin Assignments
150//
151// Column: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11
152// Pin: F1, F0, B0, C7, F4, F5, F6, F7, D4, D6, B4, D7
153//
154
155static void init_cols(void)
156{
157 DDRB &= ~(1<<4 | 1<<0);
158 PORTB |= (1<<4 | 1<<0);
159 DDRC &= ~(1<<7);
160 PORTC |= (1<<7);
161 DDRD &= ~(1<<7 | 1<<6 | 1<<4);
162 PORTD |= (1<<7 | 1<<6 | 1<<4);
163 DDRF &= ~(1<<0 | 1<<1 | 1<<4 | 1<<5 | 1<<6 | 1<<7);
164 PORTF |= (1<<0 | 1<<1 | 1<<4 | 1<<5 | 1<<6 | 1<<7);
165
166}
167
168static matrix_row_t read_cols(void)
169{
170 return (PINF&(1<<1) ? 0 : (1<<0)) |
171 (PINF&(1<<0) ? 0 : (1<<1)) |
172 (PINB&(1<<0) ? 0 : (1<<2)) |
173 (PINC&(1<<7) ? 0 : (1<<3)) |
174 (PINF&(1<<4) ? 0 : (1<<4)) |
175 (PINF&(1<<5) ? 0 : (1<<5)) |
176 (PINF&(1<<6) ? 0 : (1<<6)) |
177 (PINF&(1<<7) ? 0 : (1<<7)) |
178 (PIND&(1<<4) ? 0 : (1<<8)) |
179 (PIND&(1<<6) ? 0 : (1<<9)) |
180 (PINB&(1<<4) ? 0 : (1<<10)) |
181 (PIND&(1<<7) ? 0 : (1<<11));
182
183}
184
185//
186// Planck PCB Rev 1 Pin Assignments
187//
188// Row: 0, 1, 2, 3
189// Pin: D0, D5, B5, B6
190//
191
192static void unselect_rows(void)
193{
194 DDRB &= ~(1<<5 | 1<<6);
195 PORTB |= (1<<5 | 1<<6);
196 DDRD &= ~(1<<0 | 1<<5);
197 PORTD |= (1<<0 | 1<<5);
198
199}
200
201static void select_row(uint8_t row)
202{
203 switch (row) {
204 case 0:
205 DDRD |= (1<<0);
206 PORTD &= ~(1<<0);
207 break;
208 case 1:
209 DDRD |= (1<<5);
210 PORTD &= ~(1<<5);
211 break;
212 case 2:
213 DDRB |= (1<<5);
214 PORTB &= ~(1<<5);
215 break;
216 case 3:
217 DDRB |= (1<<6);
218 PORTB &= ~(1<<6);
219 break;
220
221 }
222} \ No newline at end of file
diff --git a/keyboard/planck/common_keymaps/keymap_brett.c b/keyboard/planck/old_keymap_files/common_keymaps/keymap_brett.c
index 97d832b47..97d832b47 100644
--- a/keyboard/planck/common_keymaps/keymap_brett.c
+++ b/keyboard/planck/old_keymap_files/common_keymaps/keymap_brett.c
diff --git a/keyboard/planck/common_keymaps/keymap_dotcom.c b/keyboard/planck/old_keymap_files/common_keymaps/keymap_dotcom.c
index 347f6dea9..347f6dea9 100644
--- a/keyboard/planck/common_keymaps/keymap_dotcom.c
+++ b/keyboard/planck/old_keymap_files/common_keymaps/keymap_dotcom.c
diff --git a/keyboard/planck/common_keymaps/keymap_jack.c b/keyboard/planck/old_keymap_files/common_keymaps/keymap_jack.c
index c74812121..c74812121 100644
--- a/keyboard/planck/common_keymaps/keymap_jack.c
+++ b/keyboard/planck/old_keymap_files/common_keymaps/keymap_jack.c
diff --git a/keyboard/planck/common_keymaps/keymap_joe.c b/keyboard/planck/old_keymap_files/common_keymaps/keymap_joe.c
index 598b0c455..598b0c455 100644
--- a/keyboard/planck/common_keymaps/keymap_joe.c
+++ b/keyboard/planck/old_keymap_files/common_keymaps/keymap_joe.c
diff --git a/keyboard/planck/common_keymaps/keymap_matthew.c b/keyboard/planck/old_keymap_files/common_keymaps/keymap_matthew.c
index 56e7003a9..56e7003a9 100644
--- a/keyboard/planck/common_keymaps/keymap_matthew.c
+++ b/keyboard/planck/old_keymap_files/common_keymaps/keymap_matthew.c
diff --git a/keyboard/planck/common_keymaps/keymap_nathan.c b/keyboard/planck/old_keymap_files/common_keymaps/keymap_nathan.c
index 5a0900b66..5a0900b66 100644
--- a/keyboard/planck/common_keymaps/keymap_nathan.c
+++ b/keyboard/planck/old_keymap_files/common_keymaps/keymap_nathan.c
diff --git a/keyboard/planck/common_keymaps/keymap_paul.c b/keyboard/planck/old_keymap_files/common_keymaps/keymap_paul.c
index 49c90e019..49c90e019 100644
--- a/keyboard/planck/common_keymaps/keymap_paul.c
+++ b/keyboard/planck/old_keymap_files/common_keymaps/keymap_paul.c
diff --git a/keyboard/planck/common_keymaps/keymap_peasant.c b/keyboard/planck/old_keymap_files/common_keymaps/keymap_peasant.c
index ddacb614e..ddacb614e 100644
--- a/keyboard/planck/common_keymaps/keymap_peasant.c
+++ b/keyboard/planck/old_keymap_files/common_keymaps/keymap_peasant.c
diff --git a/keyboard/planck/common_keymaps/keymap_reed.c b/keyboard/planck/old_keymap_files/common_keymaps/keymap_reed.c
index 1aa24e10d..1aa24e10d 100644
--- a/keyboard/planck/common_keymaps/keymap_reed.c
+++ b/keyboard/planck/old_keymap_files/common_keymaps/keymap_reed.c
diff --git a/keyboard/planck/common_keymaps/keymap_sean.c b/keyboard/planck/old_keymap_files/common_keymaps/keymap_sean.c
index cb2ef8f13..cb2ef8f13 100644
--- a/keyboard/planck/common_keymaps/keymap_sean.c
+++ b/keyboard/planck/old_keymap_files/common_keymaps/keymap_sean.c
diff --git a/keyboard/planck/common_keymaps/keymap_shane.c b/keyboard/planck/old_keymap_files/common_keymaps/keymap_shane.c
index 8d5ad6875..8d5ad6875 100644
--- a/keyboard/planck/common_keymaps/keymap_shane.c
+++ b/keyboard/planck/old_keymap_files/common_keymaps/keymap_shane.c
diff --git a/keyboard/planck/common_keymaps/keymap_simon.c b/keyboard/planck/old_keymap_files/common_keymaps/keymap_simon.c
index 37951364b..37951364b 100644
--- a/keyboard/planck/common_keymaps/keymap_simon.c
+++ b/keyboard/planck/old_keymap_files/common_keymaps/keymap_simon.c
diff --git a/keyboard/planck/common_keymaps/keymap_tim.c b/keyboard/planck/old_keymap_files/common_keymaps/keymap_tim.c
index 7444f3877..7444f3877 100644
--- a/keyboard/planck/common_keymaps/keymap_tim.c
+++ b/keyboard/planck/old_keymap_files/common_keymaps/keymap_tim.c
diff --git a/keyboard/planck/common_keymaps/keymap_wilba.c b/keyboard/planck/old_keymap_files/common_keymaps/keymap_wilba.c
index 9781f8fcd..9781f8fcd 100644
--- a/keyboard/planck/common_keymaps/keymap_wilba.c
+++ b/keyboard/planck/old_keymap_files/common_keymaps/keymap_wilba.c
diff --git a/keyboard/planck/old_keymap_files/keymap_common.c b/keyboard/planck/old_keymap_files/keymap_common.c
new file mode 100644
index 000000000..fdb1769e1
--- /dev/null
+++ b/keyboard/planck/old_keymap_files/keymap_common.c
@@ -0,0 +1,30 @@
1/*
2Copyright 2012,2013 Jun Wako <wakojun@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17#include "keymap_common.h"
18
19
20/* translates key to keycode */
21uint8_t keymap_key_to_keycode(uint8_t layer, keypos_t key)
22{
23 return pgm_read_byte(&keymaps[(layer)][(key.row)][(key.col)]);
24}
25
26/* translates Fn keycode to action */
27action_t keymap_fn_to_action(uint8_t keycode)
28{
29 return (action_t){ .code = pgm_read_word(&fn_actions[FN_INDEX(keycode)]) };
30}
diff --git a/keyboard/planck/old_keymap_files/keymap_common.h b/keyboard/planck/old_keymap_files/keymap_common.h
new file mode 100644
index 000000000..d46df9287
--- /dev/null
+++ b/keyboard/planck/old_keymap_files/keymap_common.h
@@ -0,0 +1,129 @@
1/*
2Copyright 2012,2013 Jun Wako <wakojun@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17#ifndef KEYMAP_COMMON_H
18#define KEYMAP_COMMON_H
19
20#include <stdint.h>
21#include <stdbool.h>
22#include <avr/pgmspace.h>
23#include "keycode.h"
24#include "action.h"
25#include "action_macro.h"
26#include "report.h"
27#include "host.h"
28// #include "print.h"
29#include "debug.h"
30#include "keymap.h"
31
32
33extern const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS];
34extern const uint16_t fn_actions[];
35
36
37// MIT Layout
38/*
39 * ,-----------------------------------------------------------------------.
40 * | | | | | | | | | | | | |
41 * |-----------------------------------------------------------------------|
42 * | | | | | | | | | | | | |
43 * |-----------------------------------------------------------------------|
44 * | | | | | | | | | | | | |
45 * |-----------------------------------------------------------------------|
46 * | | | | | | | | | | | |
47 * `-----------------------------------------------------------------------'
48 */
49#define KEYMAP( \
50 K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, \
51 K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, \
52 K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, \
53 K30, K31, K32, K33, K34, K35, K37, K38, K39, K3A, K3B \
54) { \
55 { KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07, KC_##K08, KC_##K09, KC_##K0A, KC_##K0B }, \
56 { KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17, KC_##K18, KC_##K19, KC_##K1A, KC_##K1B }, \
57 { KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27, KC_##K28, KC_##K29, KC_##K2A, KC_##K2B }, \
58 { KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_##K34, KC_##K35, KC_##K35, KC_##K37, KC_##K38, KC_##K39, KC_##K3A, KC_##K3B } \
59}
60
61// Grid Layout
62/*
63 * ,-----------------------------------------------------------------------.
64 * | | | | | | | | | | | | |
65 * |-----------------------------------------------------------------------|
66 * | | | | | | | | | | | | |
67 * |-----------------------------------------------------------------------|
68 * | | | | | | | | | | | | |
69 * |-----------------------------------------------------------------------|
70 * | | | | | | | | | | | | |
71 * `-----------------------------------------------------------------------'
72 */
73#define KEYMAP_GRID( \
74 K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, \
75 K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, \
76 K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, \
77 K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B \
78) { \
79 { KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07, KC_##K08, KC_##K09, KC_##K0A, KC_##K0B }, \
80 { KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17, KC_##K18, KC_##K19, KC_##K1A, KC_##K1B }, \
81 { KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27, KC_##K28, KC_##K29, KC_##K2A, KC_##K2B }, \
82 { KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_##K34, KC_##K35, KC_##K36, KC_##K37, KC_##K38, KC_##K39, KC_##K3A, KC_##K3B } \
83}
84
85#define KEYMAP_REVERSE( \
86 K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, \
87 K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, \
88 K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, \
89 K30, K31, K32, K33, K34, K35, K37, K38, K39, K3A, K3B \
90 ) { \
91 { KC_##K0B, KC_##K0A, KC_##K09, KC_##K08, KC_##K07, KC_##K06, KC_##K05, KC_##K04, KC_##K03, KC_##K02, KC_##K01, KC_##K00 }, \
92 { KC_##K1B, KC_##K1A, KC_##K19, KC_##K18, KC_##K17, KC_##K16, KC_##K15, KC_##K14, KC_##K13, KC_##K12, KC_##K11, KC_##K10 }, \
93 { KC_##K2B, KC_##K2A, KC_##K29, KC_##K28, KC_##K27, KC_##K26, KC_##K25, KC_##K24, KC_##K23, KC_##K22, KC_##K21, KC_##K20 }, \
94 { KC_##K3B, KC_##K3A, KC_##K39, KC_##K38, KC_##K37, KC_##K35, KC_##K35, KC_##K34, KC_##K33, KC_##K32, KC_##K31, KC_##K30 }, \
95 }
96
97#define KEYMAP_AND_REVERSE(args...) KEYMAP(args), KEYMAP_REVERSE(args)
98
99#define KEYMAP_SWAP( \
100 K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, \
101 K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, \
102 K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, \
103 K30, K31, K32, K33, K34, K35, K37, K38, K39, K3A, K3B \
104 ) { \
105 { KC_##K06, KC_##K07, KC_##K08, KC_##K09, KC_##K0A, KC_##K0B, KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05 }, \
106 { KC_##K16, KC_##K17, KC_##K18, KC_##K19, KC_##K1A, KC_##K1B, KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15 }, \
107 { KC_##K26, KC_##K27, KC_##K28, KC_##K29, KC_##K2A, KC_##K2B, KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25 }, \
108 { KC_##K37, KC_##K38, KC_##K39, KC_##K3A, KC_##K3B, KC_##K35, KC_##K35, KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_##K34 }, \
109}
110
111#define KEYMAP_AND_SWAP(args...) KEYMAP(args), KEYMAP_SWAP(args)
112
113/*
114 Keymap for the Planck 48 key variant.
115 */
116#define KEYMAP_48( \
117 K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, \
118 K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, \
119 K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, \
120 K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B \
121) { \
122 { KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07, KC_##K08, KC_##K09, KC_##K0A, KC_##K0B }, \
123 { KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17, KC_##K18, KC_##K19, KC_##K1A, KC_##K1B }, \
124 { KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27, KC_##K28, KC_##K29, KC_##K2A, KC_##K2B }, \
125 { KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_##K34, KC_##K35, KC_##K36, KC_##K37, KC_##K38, KC_##K39, KC_##K3A, KC_##K3B }, \
126}
127
128
129#endif