aboutsummaryrefslogtreecommitdiff
path: root/keyboard/planck
diff options
context:
space:
mode:
authorJack Humbert <jack.humb@gmail.com>2016-01-16 00:51:24 -0500
committerJack Humbert <jack.humb@gmail.com>2016-01-16 00:52:31 -0500
commitdfe7004bc545ff7247a0dbef4788b9e1952f9c5d (patch)
tree50ce3ca421a1cb0a8864e054ab7d7e00a9171110 /keyboard/planck
parent4faddd3449ca553e0d8b02ba91f9a34b534eebe7 (diff)
downloadqmk_firmware-dfe7004bc545ff7247a0dbef4788b9e1952f9c5d.tar.gz
qmk_firmware-dfe7004bc545ff7247a0dbef4788b9e1952f9c5d.zip
new keymap folder structure and makefile magic
Diffstat (limited to 'keyboard/planck')
-rw-r--r--keyboard/planck/Makefile13
-rw-r--r--keyboard/planck/README.md126
-rw-r--r--keyboard/planck/keymaps/alexey.c (renamed from keyboard/planck/keymaps/keymap_alexey.c)0
-rw-r--r--keyboard/planck/keymaps/angerthosenear.c (renamed from keyboard/planck/keymaps/keymap_angerthosenear.c)0
-rw-r--r--keyboard/planck/keymaps/austin.c (renamed from keyboard/planck/keymaps/keymap_austin.c)0
-rw-r--r--keyboard/planck/keymaps/charlie.c (renamed from keyboard/planck/keymaps/keymap_charlie.c)0
-rw-r--r--keyboard/planck/keymaps/daniel.c (renamed from keyboard/planck/keymaps/keymap_daniel.c)0
-rw-r--r--keyboard/planck/keymaps/david.c (renamed from keyboard/planck/keymaps/keymap_david.c)0
-rw-r--r--keyboard/planck/keymaps/default.c (renamed from keyboard/planck/keymaps/keymap_default.c)0
-rw-r--r--keyboard/planck/keymaps/dzobert.c (renamed from keyboard/planck/keymaps/keymap_dzobert.c)0
-rw-r--r--keyboard/planck/keymaps/gabriel.c (renamed from keyboard/planck/keymaps/keymap_gabriel.c)0
-rw-r--r--keyboard/planck/keymaps/jack.c (renamed from keyboard/planck/keymaps/keymap_jack.c)0
-rw-r--r--keyboard/planck/keymaps/joe.c (renamed from keyboard/planck/keymaps/keymap_joe.c)0
-rw-r--r--keyboard/planck/keymaps/kyle.c (renamed from keyboard/planck/keymaps/keymap_kyle.c)0
-rw-r--r--keyboard/planck/keymaps/leo.c (renamed from keyboard/planck/keymaps/keymap_leo.c)0
-rw-r--r--keyboard/planck/keymaps/lock.c (renamed from keyboard/planck/keymaps/keymap_lock.c)0
-rw-r--r--keyboard/planck/keymaps/max.c (renamed from keyboard/planck/keymaps/keymap_max.c)0
-rw-r--r--keyboard/planck/keymaps/monkey.c (renamed from keyboard/planck/keymaps/keymap_monkey.c)0
-rw-r--r--keyboard/planck/keymaps/numpad.c (renamed from keyboard/planck/keymaps/keymap_numpad.c)0
-rw-r--r--keyboard/planck/keymaps/test/default.c123
20 files changed, 221 insertions, 41 deletions
diff --git a/keyboard/planck/Makefile b/keyboard/planck/Makefile
index 485c5f77f..f3537b2c7 100644
--- a/keyboard/planck/Makefile
+++ b/keyboard/planck/Makefile
@@ -54,10 +54,19 @@ SRC = planck.c \
54 backlight.c 54 backlight.c
55 55
56ifdef KEYMAP 56ifdef KEYMAP
57 SRC := keymaps/keymap_$(KEYMAP).c $(SRC) 57ifneq ("$(wildcard keymaps/$(KEYMAP).c)","")
58 KEYMAP_FILE = keymaps/$(KEYMAP).c
58else 59else
59 SRC := keymaps/keymap_default.c $(SRC) 60 KEYMAP_FILE = keymaps/$(KEYMAP)/default.c
60endif 61endif
62else
63ifneq ("$(wildcard keymaps/default.c)","")
64 KEYMAP_FILE = keymaps/default.c
65else
66 KEYMAP_FILE = keymaps/default/default.c
67endif
68endif
69SRC := $(KEYMAP_FILE) $(SRC)
61 70
62CONFIG_H = config.h 71CONFIG_H = config.h
63 72
diff --git a/keyboard/planck/README.md b/keyboard/planck/README.md
index 0003e765d..5c3a52498 100644
--- a/keyboard/planck/README.md
+++ b/keyboard/planck/README.md
@@ -3,29 +3,42 @@ Planck keyboard firmware
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## Quantum MK Firmware 5## Quantum MK Firmware
6
6You have access to a bunch of goodies! Check out the Makefile to enable/disable some of the features. Uncomment the `#` to enable them. Setting them to `no` does nothing and will only confuse future you. 7You have access to a bunch of goodies! Check out the Makefile to enable/disable some of the features. Uncomment the `#` to enable them. Setting them to `no` does nothing and will only confuse future you.
7 8
8 BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality 9 BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
9 MIDI_ENABLE = yes # MIDI controls 10 MIDI_ENABLE = yes # MIDI controls
10 # UNICODE_ENABLE = yes # Unicode support 11 # UNICODE_ENABLE = yes # Unicode support - this is commented out, just as an example. You have to use #, not //
11 BLUETOOTH_ENABLE = yes # Enable Bluetooth with the Adafruit EZ-Key HID 12 BLUETOOTH_ENABLE = yes # Enable Bluetooth with the Adafruit EZ-Key HID
12 13
13### Mod shortcuts 14## Quick aliases to common actions
15
16Your keymap can include shortcuts to common operations (called "function actions" in tmk).
17
18### Switching and toggling layers
19
20`MO(layer)` - momentary switch to *layer*. As soon as you let go of the key, the layer is deactivated and you pop back out to the previous layer. When you apply this to a key, that same key must be set as `KC_TRNS` on the destination layer. Otherwise, you won't make it back to the original layer when you release the key (and you'll get a keycode sent). You can only switch to layers *above* your current layer. If you're on layer 0 and you use `MO(1)`, that will switch to layer 1 just fine. But if you include `MO(3)` on layer 5, that won't do anything for you -- because layer 3 is lower than layer 5 on the stack.
21
22`LT(layer, kc)` - momentary switch to *layer* when held, and *kc* when tapped. Like `MO()`, this only works upwards in the layer stack (`layer` must be higher than the current layer).
23
24`TG(layer)` - toggles a layer on or off. As with `MO()`, you should set this key as `KC_TRNS` in the destination layer so that tapping it again actually toggles back to the original layer. Only works upwards in the layer stack.
14 25
15* `LSFT(kc)` - applies left shift to *kc* - `S(kc)` is an alias 26### Fun with modifier keys
16* `RSFT(kc)` - applies right shift to *kc*
17* `LCTL(kc)` - applies left control to *kc*
18* `RCTL(kc)` - applies right control to *kc*
19* `LALT(kc)` - applies left alt to *kc*
20* `RALT(kc)` - applies right alt to *kc*
21* `LGUI(kc)` - applies left gui (command/win) to *kc*
22* `RGUI(kc)` - applies right gui (command/win) to *kc*
23 27
24You can also use more than one, like this: 28* `LSFT(kc)` - applies left Shift to *kc* (keycode) - `S(kc)` is an alias
29* `RSFT(kc)` - applies right Shift to *kc*
30* `LCTL(kc)` - applies left Control to *kc*
31* `RCTL(kc)` - applies right Control to *kc*
32* `LALT(kc)` - applies left Alt to *kc*
33* `RALT(kc)` - applies right Alt to *kc*
34* `LGUI(kc)` - applies left GUI (command/win) to *kc*
35* `RGUI(kc)` - applies right GUI (command/win) to *kc*
25 36
26 LALT(LGUI(KC_ESC)) 37You can also chain these, like this:
27 38
28The following shortcuts automatically add `LSFT()` to keycodes to get commonly used symbols. Their long names (see `quantum/keymap_common.h`) are also availble. 39 LALT(LCTL(KC_DEL)) -- this makes a key that sends Alt, Control, and Delete in a single keypress.
40
41The following shortcuts automatically add `LSFT()` to keycodes to get commonly used symbols. Their long names are also available and documented in `/quantum/keymap_common.h`.
29 42
30 KC_TILD ~ 43 KC_TILD ~
31 KC_EXLM ! 44 KC_EXLM !
@@ -45,31 +58,71 @@ The following shortcuts automatically add `LSFT()` to keycodes to get commonly u
45 KC_PIPE | 58 KC_PIPE |
46 KC_COLN : 59 KC_COLN :
47 60
48### Function shortcuts 61`MT(mod, kc)` - is *mod* (modifier key - MOD_LCTL, MOD_LSFT) when held, and *kc* when tapped. In other words, you can have a key that sends Esc (or the letter O or whatever) when you tap it, but works as a Control key or a Shift key when you hold it down.
62
63These are the values you can use for the `mod` in `MT()` (right-hand modifiers are not available):
64
65 * MOD_LCTL
66 * MOD_LSFT
67 * MOD_LALT
68 * MOD_LGUI
49 69
50Instead of using `FNx`, you can use `F(x)` - the benefit here is being able to use more than 32 function layers (up to 4096), if you happen to need them. 70These can also be combined like `MOD_LCTL | MOD_LSFT` e.g. `MT(MOD_LCTL | MOD_LSFT, KC_ESC)` which would activate Control and Shift when held, and send Escape when tapped.
51 71
52There are also keycode shortcuts for common actions: 72We've added shortcuts to make common modifier/tap (mod-tap) mappings more compact:
53 73
54* `MO(layer)` - momentary switch to *layer*
55* `DF(layer)` - sets default layer to *layer*
56* `TG(layer)` - toggle between the current layer and *layer*
57* `MT(mod, kc)` - is *mod* when held, and *kc* when tapped
58 * `CTL_T(kc)` - is LCTL when held and *kc* when tapped 74 * `CTL_T(kc)` - is LCTL when held and *kc* when tapped
59 * `SFT_T(kc)` - is LSFT when held and *kc* when tapped 75 * `SFT_T(kc)` - is LSFT when held and *kc* when tapped
60 * `ALT_T(kc)` - is LALT when held and *kc* when tapped 76 * `ALT_T(kc)` - is LALT when held and *kc* when tapped
61 * `GUI_T(kc)` - is LGUI when held and *kc* when tapped 77 * `GUI_T(kc)` - is LGUI when held and *kc* when tapped
62 * `ALL_T(kc)` - is Hyper (all mods) when held and *kc* when tapped 78 * `ALL_T(kc)` - is Hyper (all mods) when held and *kc* when tapped. To read more about what you can do with a Hyper key, see [this blog post by Brett Terpstra](http://brettterpstra.com/2012/12/08/a-useful-caps-lock-key/)
63* `LT(layer, kc)` - momentary switch to *layer* when held, and *kc* when tapped 79
80### Temporarily setting the default layer
81
82`DF(layer)` - sets default layer to *layer*. The default layer is the one at the "bottom" of the layer stack - the ultimate fallback layer. This currently does not persist over power loss. When you plug the keyboard back in, layer 0 will always be the default. It is theoretically possible to work around that, but that's not what `DF` does.
83
84### Remember: These are just aliases
64 85
65These functions work the same way that their `ACTION_*` functions do, and will require KC_TRNS on the layer being switched to - check out the default keymap for an example. 86These functions work the same way that their `ACTION_*` functions do - they're just quick aliases. To dig into all of the tmk ACTION_* functions, please see the [TMK documentation](https://github.com/jackhumbert/qmk_firmware/blob/master/tmk_core/doc/keymap.md#2-action).
66 87
67### Additional keycodes for software-implemented layouts (Colemak, Dvorak, etc) 88Instead of using `FNx` when defining `ACTION_*` functions, you can use `F(x)` - the benefit here is being able to use more than 32 function actions (up to 4096), if you happen to need them.
89
90## Macro shortcuts: Send a whole string when pressing just one key
91
92Instead of using the `ACTION_MACRO` function, you can simply use `M(n)` to access macro *n* - *n* will get passed into the `action_get_macro` as the `id`, and you can use a switch statement to trigger it. This gets called on the keydown and keyup, so you'll need to use an if statement testing `record->event.pressed` (see keymaps/default.c).
93
94```c
95const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) // this is the function signature -- just copy/paste it into your keymap file as it is.
96{
97 switch(id) {
98 case 0: // this would trigger when you hit a key mapped as M(0)
99 if (record->event.pressed) {
100 return MACRO( I(255), T(H), T(E), T(L), T(L), W(255), T(O), END ); // this sends the string 'hello' when the macro executes
101 }
102 break;
103 }
104 return MACRO_NONE;
105};
106```
107A macro can include the following commands:
108
109* I() change interval of stroke in milliseconds.
110* D() press key.
111* U() release key.
112* T() type key(press and release).
113* W() wait (milliseconds).
114* END end mark.
115
116So above you can see the stroke interval changed to 255ms between each keystroke, then a bunch of keys being typed, waits a while, then the macro ends.
117
118Note: Using macros to have your keyboard send passwords for you is a bad idea.
119
120### Additional keycode aliases for software-implemented layouts (Colemak, Dvorak, etc)
68 121
69Everything is assuming you're in Qwerty (in software) by default, but there is built-in support for using a Colemak or Dvorak layout by including this at the top of your keymap: 122Everything is assuming you're in Qwerty (in software) by default, but there is built-in support for using a Colemak or Dvorak layout by including this at the top of your keymap:
70 123
71 #include "keymap_<layout>.h" 124 #include "keymap_<layout>.h"
72 125
73Where <layout> is "colemak" or "dvorak". After including this line, you will get access to: 126Where <layout> is "colemak" or "dvorak". After including this line, you will get access to:
74 127
75 * `CM_*` for all of the Colemak-equivalent characters 128 * `CM_*` for all of the Colemak-equivalent characters
@@ -79,19 +132,15 @@ These implementations assume you're using Colemak or Dvorak on your OS, not on y
79 132
80To give an example, if you're using software-implemented Colemak, and want to get an `F`, you would use `CM_F` - `KC_F` under these same circumstances would result in `T`. 133To give an example, if you're using software-implemented Colemak, and want to get an `F`, you would use `CM_F` - `KC_F` under these same circumstances would result in `T`.
81 134
82### Additional language support 135## Additional language support
83 136
84In `quantum/keymap_extras/`, you'll see various language files - these work the same way as the alternative layout ones do. Most are defined by their two letter country/language code followed by an underscore and a 4-letter abbrivation of its name. `FR_UGRV` which will result in a `ù` when using a software-implemented AZERTY layout. It's currently difficult to send such characters in just the firmware (but it's being worked on - see Unicode support). 137In `quantum/keymap_extras/`, you'll see various language files - these work the same way as the alternative layout ones do. Most are defined by their two letter country/language code followed by an underscore and a 4-letter abbreviation of its name. `FR_UGRV` which will result in a `ù` when using a software-implemented AZERTY layout. It's currently difficult to send such characters in just the firmware (but it's being worked on - see Unicode support).
85 138
86### Unicode support 139## Unicode support
87 140
88You can currently send 4 hex digits with your OS-specific modifier key (RALT for OSX with the "Unicode Hex Input" layout) - this is currently limited to supporting one OS at a time, and requires a recompile for switching. 8 digit hex codes are being worked on. The keycode function is `UC(n)`, where *n* is a 4 digit hexidecimal. Enable from the Makefile. 141You can currently send 4 hex digits with your OS-specific modifier key (RALT for OSX with the "Unicode Hex Input" layout) - this is currently limited to supporting one OS at a time, and requires a recompile for switching. 8 digit hex codes are being worked on. The keycode function is `UC(n)`, where *n* is a 4 digit hexidecimal. Enable from the Makefile.
89 142
90### Macro shortcuts 143## Other firmware shortcut keycodes
91
92Instead of using the `ACTION_MACRO` function, you can simply use `M(n)` to access macro *n* - *n* will get passed into the `action_get_macro` as the `id`, and you can use a switch statement to filter them. This gets called on the keydown and keyup, so you'll need to use an if statement testing `record->event.pressed` (see keymap_default.c).
93
94### Other keyboard shortcut keycodes
95 144
96* `RESET` - puts the MCU in DFU mode for flashing new firmware (with `make dfu`) 145* `RESET` - puts the MCU in DFU mode for flashing new firmware (with `make dfu`)
97* `DEBUG` - the firmware into debug mode - you'll need hid_listen to see things 146* `DEBUG` - the firmware into debug mode - you'll need hid_listen to see things
@@ -105,12 +154,11 @@ Instead of using the `ACTION_MACRO` function, you can simply use `M(n)` to acces
105 154
106Enable the backlight from the Makefile. 155Enable the backlight from the Makefile.
107 156
108 157## MIDI functionalty
109### MIDI functionalty
110 158
111This is still a WIP, but check out `quantum/keymap_midi.c` to see what's happening. Enable from the Makefile. 159This is still a WIP, but check out `quantum/keymap_midi.c` to see what's happening. Enable from the Makefile.
112 160
113### Bluetooth functionality 161## Bluetooth functionality
114 162
115This requires [some hardware changes](https://www.reddit.com/r/MechanicalKeyboards/comments/3psx0q/the_planck_keyboard_with_bluetooth_guide_and/?ref=search_posts), but can be enabled via the Makefile. The firmware will still output characters via USB, so be aware of this when charging via a computer. It would make sense to have a switch on the Bluefruit to turn it off at will. 163This requires [some hardware changes](https://www.reddit.com/r/MechanicalKeyboards/comments/3psx0q/the_planck_keyboard_with_bluetooth_guide_and/?ref=search_posts), but can be enabled via the Makefile. The firmware will still output characters via USB, so be aware of this when charging via a computer. It would make sense to have a switch on the Bluefruit to turn it off at will.
116 164
@@ -124,13 +172,13 @@ Depending on which keymap you would like to use, you will have to compile slight
124To build with the default keymap, simply run `make`. 172To build with the default keymap, simply run `make`.
125 173
126### Other Keymaps 174### Other Keymaps
127Several 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. 175Several 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 `<name>.c` and see keymap document (you can find in top README.md) and existent keymap files.
128 176
129To build the firmware binary hex file with a keymap just do `make` with `KEYMAP` option like: 177To build the firmware binary hex file with a keymap just do `make` with `KEYMAP` option like:
130``` 178```
131$ make KEYMAP=[default|jack|<name>] 179$ make KEYMAP=[default|jack|<name>]
132``` 180```
133Keymaps follow the format **__keymap\_\<name\>.c__** and are stored in the `keymaps` folder. 181Keymaps follow the format **__<name\>.c__** and are stored in the `keymaps` folder.
134 182
135### Notable forks (which some of the keymap files are from) 183### Notable forks (which some of the keymap files are from)
136- [Shane's Fork](https://github.com/shanecelis/tmk_keyboard/tree/master/keyboard/planck) 184- [Shane's Fork](https://github.com/shanecelis/tmk_keyboard/tree/master/keyboard/planck)
diff --git a/keyboard/planck/keymaps/keymap_alexey.c b/keyboard/planck/keymaps/alexey.c
index 89af4112c..89af4112c 100644
--- a/keyboard/planck/keymaps/keymap_alexey.c
+++ b/keyboard/planck/keymaps/alexey.c
diff --git a/keyboard/planck/keymaps/keymap_angerthosenear.c b/keyboard/planck/keymaps/angerthosenear.c
index cdf60632e..cdf60632e 100644
--- a/keyboard/planck/keymaps/keymap_angerthosenear.c
+++ b/keyboard/planck/keymaps/angerthosenear.c
diff --git a/keyboard/planck/keymaps/keymap_austin.c b/keyboard/planck/keymaps/austin.c
index 49fc98a58..49fc98a58 100644
--- a/keyboard/planck/keymaps/keymap_austin.c
+++ b/keyboard/planck/keymaps/austin.c
diff --git a/keyboard/planck/keymaps/keymap_charlie.c b/keyboard/planck/keymaps/charlie.c
index 88f454d78..88f454d78 100644
--- a/keyboard/planck/keymaps/keymap_charlie.c
+++ b/keyboard/planck/keymaps/charlie.c
diff --git a/keyboard/planck/keymaps/keymap_daniel.c b/keyboard/planck/keymaps/daniel.c
index 234e48ff4..234e48ff4 100644
--- a/keyboard/planck/keymaps/keymap_daniel.c
+++ b/keyboard/planck/keymaps/daniel.c
diff --git a/keyboard/planck/keymaps/keymap_david.c b/keyboard/planck/keymaps/david.c
index f48308480..f48308480 100644
--- a/keyboard/planck/keymaps/keymap_david.c
+++ b/keyboard/planck/keymaps/david.c
diff --git a/keyboard/planck/keymaps/keymap_default.c b/keyboard/planck/keymaps/default.c
index 49670dafd..49670dafd 100644
--- a/keyboard/planck/keymaps/keymap_default.c
+++ b/keyboard/planck/keymaps/default.c
diff --git a/keyboard/planck/keymaps/keymap_dzobert.c b/keyboard/planck/keymaps/dzobert.c
index 665e9c20b..665e9c20b 100644
--- a/keyboard/planck/keymaps/keymap_dzobert.c
+++ b/keyboard/planck/keymaps/dzobert.c
diff --git a/keyboard/planck/keymaps/keymap_gabriel.c b/keyboard/planck/keymaps/gabriel.c
index 805484488..805484488 100644
--- a/keyboard/planck/keymaps/keymap_gabriel.c
+++ b/keyboard/planck/keymaps/gabriel.c
diff --git a/keyboard/planck/keymaps/keymap_jack.c b/keyboard/planck/keymaps/jack.c
index 0b93bba33..0b93bba33 100644
--- a/keyboard/planck/keymaps/keymap_jack.c
+++ b/keyboard/planck/keymaps/jack.c
diff --git a/keyboard/planck/keymaps/keymap_joe.c b/keyboard/planck/keymaps/joe.c
index 5b7bbe2bb..5b7bbe2bb 100644
--- a/keyboard/planck/keymaps/keymap_joe.c
+++ b/keyboard/planck/keymaps/joe.c
diff --git a/keyboard/planck/keymaps/keymap_kyle.c b/keyboard/planck/keymaps/kyle.c
index da32b74f9..da32b74f9 100644
--- a/keyboard/planck/keymaps/keymap_kyle.c
+++ b/keyboard/planck/keymaps/kyle.c
diff --git a/keyboard/planck/keymaps/keymap_leo.c b/keyboard/planck/keymaps/leo.c
index 6d6644182..6d6644182 100644
--- a/keyboard/planck/keymaps/keymap_leo.c
+++ b/keyboard/planck/keymaps/leo.c
diff --git a/keyboard/planck/keymaps/keymap_lock.c b/keyboard/planck/keymaps/lock.c
index bc81adcf9..bc81adcf9 100644
--- a/keyboard/planck/keymaps/keymap_lock.c
+++ b/keyboard/planck/keymaps/lock.c
diff --git a/keyboard/planck/keymaps/keymap_max.c b/keyboard/planck/keymaps/max.c
index 7fb29bc7a..7fb29bc7a 100644
--- a/keyboard/planck/keymaps/keymap_max.c
+++ b/keyboard/planck/keymaps/max.c
diff --git a/keyboard/planck/keymaps/keymap_monkey.c b/keyboard/planck/keymaps/monkey.c
index 21a2c146a..21a2c146a 100644
--- a/keyboard/planck/keymaps/keymap_monkey.c
+++ b/keyboard/planck/keymaps/monkey.c
diff --git a/keyboard/planck/keymaps/keymap_numpad.c b/keyboard/planck/keymaps/numpad.c
index 7de4372ab..7de4372ab 100644
--- a/keyboard/planck/keymaps/keymap_numpad.c
+++ b/keyboard/planck/keymaps/numpad.c
diff --git a/keyboard/planck/keymaps/test/default.c b/keyboard/planck/keymaps/test/default.c
new file mode 100644
index 000000000..bc81adcf9
--- /dev/null
+++ b/keyboard/planck/keymaps/test/default.c
@@ -0,0 +1,123 @@
1// USING_MIDI
2// USING_BACKLIGHT
3#include "keymap_common.h"
4#include "backlight.h"
5#include "action_layer.h"
6#include "keymap_midi.h"
7#include <avr/boot.h>
8
9const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
10[0] = { /* Qwerty */
11 {KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC},
12 {KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT},
13 {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT},
14 {M(0), KC_LCTL, KC_LALT, KC_LGUI, FUNC(2), KC_SPC, KC_SPC, FUNC(1), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT}
15 // Space is repeated to accommadate for both spacebar wiring positions
16},
17[1] = { /* Colemak */
18 {KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC},
19 {KC_ESC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT},
20 {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT},
21 {KC_FN3, KC_LCTL, KC_LALT, KC_LGUI, FUNC(2), KC_SPC, KC_SPC, FUNC(1), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT}
22},
23[2] = { /* RAISE */
24 {KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC},
25 {KC_TRNS, FUNC(3), FUNC(4), RESET, KC_TRNS, KC_TRNS, KC_TRNS, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS},
26 {KC_TRNS, KC_F11, KC_F12, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS},
27 {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, FUNC(1), KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY}
28},
29[3] = { /* LOWER */
30 {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},
31 {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)},
32 {KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_TRNS},
33 {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, FUNC(2), KC_TRNS, KC_TRNS, KC_TRNS, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY}
34},
35[4] = { /* TENKEY */
36 {KC_TAB, N_C5, N_D5, N_E5, N_F5, N_G5, N_A5, KC_KP_7, KC_KP_8, KC_KP_9, KC_P, KC_BSPC},
37 {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},
38 {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},
39 {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}
40},
41[5] = {
42 { MIDI12 },
43 { MIDI12 },
44 { MIDI12 },
45 {M(0), KC_MS_L, KC_MS_D, KC_MS_U, KC_MS_R, KC_SPC, KC_SPC, FUNC(1), MIDI, MIDI, MIDI, MIDI}
46}
47};
48
49const uint16_t PROGMEM fn_actions[] = {
50 [1] = ACTION_LAYER_MOMENTARY(2), // to RAISE
51 [2] = ACTION_LAYER_MOMENTARY(3), // to LOWER
52
53 [3] = ACTION_DEFAULT_LAYER_SET(0),
54 [4] = ACTION_DEFAULT_LAYER_SET(1),
55
56};
57
58uint16_t hextokeycode(int hex) {
59 if (hex == 0x0) {
60 return KC_0;
61 } else if (hex < 0xA) {
62 return KC_1 + (hex - 0x1);
63 } else {
64 return KC_A + (hex - 0xA);
65 }
66}
67
68const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
69{
70 // MACRODOWN only works in this function
71 switch(id) {
72 case 0:
73 if (record->event.pressed) {
74 // play_note(440, 20);
75 // register_code(KC_RSFT);
76 backlight_set(BACKLIGHT_LEVELS);
77 default_layer_and(0);
78 default_layer_or((1<<5));
79
80 // uint8_t low = boot_lock_fuse_bits_get(0x0000);
81 // uint8_t high = boot_lock_fuse_bits_get(0x0003);
82 // uint8_t ext = boot_lock_fuse_bits_get(0x0002);
83 // uint8_t lock = boot_lock_fuse_bits_get(0x0001);
84
85 // register_code(hextokeycode((low & 0xF0) >> 4));
86 // unregister_code(hextokeycode((low & 0xF0) >> 4));
87 // register_code(hextokeycode((low & 0x0F)));
88 // unregister_code(hextokeycode((low & 0x0F)));
89
90
91 // register_code(hextokeycode((high & 0xF0) >> 4));
92 // unregister_code(hextokeycode((high & 0xF0) >> 4));
93 // register_code(hextokeycode((high & 0x0F)));
94 // unregister_code(hextokeycode((high & 0x0F)));
95
96
97 // register_code(hextokeycode((ext & 0xF0) >> 4));
98 // unregister_code(hextokeycode((ext & 0xF0) >> 4));
99 // register_code(hextokeycode((ext & 0x0F)));
100 // unregister_code(hextokeycode((ext & 0x0F)));
101
102
103 // register_code(hextokeycode((lock & 0xF0) >> 4));
104 // unregister_code(hextokeycode((lock & 0xF0) >> 4));
105 // register_code(hextokeycode((lock & 0x0F)));
106 // unregister_code(hextokeycode((lock & 0x0F)));
107
108 // note(0+12, 20);
109 // note(0+24, 20);
110 } else {
111 // unregister_code(KC_RSFT);
112 // stop_note();
113 backlight_set(0);
114 default_layer_and(0);
115 default_layer_or(0);
116 // note(0+24, 20);
117 // note(0, 20);
118 // play_note(4, 20);
119 }
120 break;
121 }
122 return MACRO_NONE;
123};