example_keyboards
Stephan Bösebeck 9 years ago
commit 0befb25739

@ -98,6 +98,27 @@ We've added shortcuts to make common modifier/tap (mod-tap) mappings more compac
`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.
### Prevent stuck modifiers
Consider the following scenario:
1. Layer 0 has a key defined as Shift.
2. The same key is defined on layer 1 as the letter A.
3. User presses Shift.
4. User switches to layer 1 for whatever reason.
5. User releases Shift, or rather the letter A.
6. User switches back to layer 0.
Shift was actually never released and is still considered pressed.
If such situation bothers you add this to your `config.h`:
#define PREVENT_STUCK_MODIFIERS
This option uses 5 bytes of memory per every 8 keys on the keyboard
rounded up (5 bits per key). For example on Planck (48 keys) it uses
(48/8)\*5 = 30 bytes.
### Remember: These are just aliases
These 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).

@ -0,0 +1,238 @@
#include "ergodox_ez.h"
#include "debug.h"
#include "action_layer.h"
#define BASE 0 // default layer
#define SYMB 1 // symbols
#define MDIA 2 // media keys
#define UNIC 3 // unicode entry layer
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Keymap 0: Basic layer
*
* ,--------------------------------------------------. ,--------------------------------------------------.
* | ESC | 1! | 2@ | 3# | 4$ | 5% | 6^ | | 7& | 8* | 9( | 0) | -_ | += | BkSp |
* |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
* | Tab | Q | W | E | R | T | { | | } | Y | U | I | O | P | |\ |
* |--------+------+------+------+------+------| [ | | ] |------+------+------+------+------+--------|
* | Win | A | S | D | F | G |------| |------| H | J | K | L | :; | '" |
* |--------+------+------+------+------+------| Home | | End |------+------+------+------+------+--------|
* | LShift |Z/Alt | X | C | V | B | | | | N | M | , | . | Alt | RShift |
* `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
* |LCtrl | COPY | PASTE| Left | Right| | Down | Up |Hyper | `~ | RCtrl |
* `----------------------------------' `----------------------------------'
* ,-------------. ,-------------.
* Hyper = Ctrl+Super+Alt+Shift | ~L3 | F5 | | F2 | ~L2 |
* ,------|------|------| |------+------+------.
* | | | PgUp | | Ins | | |
* | Enter| BkSp |------| |------| ~L1 |Space |
* | | | PgDn | | Del | | |
* `--------------------' `--------------------'
*/
// If it accepts an argument (i.e, is a function), it doesn't need KC_.
// Otherwise, it needs KC_*
[BASE] = KEYMAP( // layer 0 : default
// left hand
KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6,
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_LBRC,
KC_LGUI, KC_A, KC_S, KC_D, KC_F, KC_G,
KC_LSFT, ALT_T(KC_Z), KC_X, KC_C, KC_V, KC_B, KC_HOME,
KC_LCTRL, LCTL(KC_C), LCTL(KC_V), KC_LEFT,KC_RGHT,
KC_FN3, KC_F5,
KC_PGUP,
KC_ENT,KC_BSPC,KC_PGDN,
// right hand
KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC,
KC_RBRC, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLS,
KC_H, KC_J, KC_K, KC_L, KC_SCLN,KC_QUOT,
KC_END, KC_N, KC_M, KC_COMM,KC_DOT, KC_SLSH, KC_RSFT,
KC_DOWN,KC_UP, ALL_T(KC_NO),KC_GRV, KC_RCTRL,
KC_F2, KC_FN2,
KC_INS,
KC_DELT,KC_FN1, KC_SPC
),
/* Keymap 1: Symbol Layer
*
* ,--------------------------------------------------. ,--------------------------------------------------.
* | | F1 | F2 | F3 | F4 | F5 | F6 | | F7 | F8 | F9 | F10 | F11 | F12 |PrintScr|
* |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
* | | ! | @ | { | } | | | | | | Up | 7 | 8 | 9 | * | |
* |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
* | | # | $ | ( | ) | ` |------| |------| Down | 4 | 5 | 6 | + | |
* |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
* | | % | ^ | [ | ] | ~ | | | | & | 1 | 2 | 3 | \ | |
* `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
* | | £ | | | | | | . | 0 | = |Alt+F4|
* `----------------------------------' `----------------------------------'
* ,-------------. ,-------------.
* THERE! | | | | | |
* ,------|------|------| |------+------+------.
* CAD = Ctrl + Alt + Delete | | | | | | | |
* | | |------| |------| | |
* | | | | | CAD | | |
* `--------------------' `--------------------'
*/
// SYMBOLS
[SYMB] = KEYMAP(
// left hand
KC_TRNS,KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6,
KC_TRNS,KC_EXLM,KC_AT, KC_LCBR,KC_RCBR,KC_PIPE,KC_TRNS,
KC_TRNS,KC_HASH,KC_DLR, KC_LPRN,KC_RPRN,KC_GRV,
KC_TRNS,KC_PERC,KC_CIRC,KC_LBRC,KC_RBRC,KC_TILD,KC_TRNS,
KC_TRNS,M(3),KC_TRNS,KC_TRNS,KC_TRNS,
KC_TRNS,KC_TRNS,
KC_TRNS,
KC_TRNS,KC_TRNS,KC_TRNS,
// right hand
KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR,
KC_TRNS, KC_UP, KC_7, KC_8, KC_9, KC_ASTR, KC_TRNS,
KC_DOWN, KC_4, KC_5, KC_6, KC_PLUS, KC_TRNS,
KC_TRNS, KC_AMPR, KC_1, KC_2, KC_3, KC_BSLS, KC_TRNS,
KC_TRNS,KC_DOT, KC_0, KC_EQL, LALT(KC_F4),
KC_TRNS, KC_TRNS,
KC_TRNS,
LCTL(LALT(KC_DEL)), KC_TRNS, KC_TRNS
),
/* Keymap 2: Media and mouse keys
*
* ,--------------------------------------------------. ,--------------------------------------------------.
* | TEENSY | | | | | | | | | | | | | | |
* |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
* | | | | MsUp | | | | | | | | | | | |
* |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
* | | |MsLeft|MsDown|MsRght| |------| |------| | | | | | Play |
* |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
* | | | | | | | | | | | | Prev | Next | | |
* `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
* | | | | Lclk | Rclk | |VolDn |VolUp | Mute | | |
* `----------------------------------' `----------------------------------'
* ,-------------. ,-------------.
* | | | | | |
* ,------|------|------| |------+------+------.
* | | | | | | |Brwser|
* | | |------| |------| |Back |
* | | | | | | | |
* `--------------------' `--------------------'
*/
// MEDIA AND MOUSE
[MDIA] = KEYMAP(
RESET, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_MS_U, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_MS_L, KC_MS_D, KC_MS_R, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_BTN1, KC_BTN2,
KC_TRNS, KC_TRNS,
KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS,
// right hand
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MPLY,
KC_TRNS, KC_TRNS, KC_TRNS, KC_MPRV, KC_MNXT, KC_TRNS, KC_TRNS,
KC_VOLD, KC_VOLU, KC_MUTE, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS,
KC_TRNS,
KC_TRNS, KC_TRNS, KC_WBAK
),
/* Keymap 3: Unicode Entry
*
* ,--------------------------------------------------. ,--------------------------------------------------.
* | Alt | 1 | 2 | 3 | 4 | 5 | 6 | | 7 | 8 | 9 | 0 | + | + | |
* |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
* | Alt | | | E | | | | | | | 7 | 8 | 9 | + | |
* |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
* | Alt | A | | D | F | |------| |------| | 4 | 5 | 6 | + | |
* |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
* | Alt | | | C | | B | | | | | 1 | 2 | 3 | + | |
* `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
* | Alt | Alt | Alt | | | | 0 | 0 | 0 | + | |
* `----------------------------------' `----------------------------------'
* ,-------------. ,-------------.
* WINDOWS ONLY SETUP!! | ~L3 | | | | |
* ,------|------|------| |------+------+------.
* | | | | | | | |
* | Alt | Alt |------| |------| Alt | Alt |
* | | | | | | | |
* `--------------------' `--------------------'
*/
// If it accepts an argument (i.e, is a function), it doesn't need KC_.
// Otherwise, it needs KC_*
[UNIC] = KEYMAP( // layer 3 : Unicode Entry
// left hand
KC_LALT, KC_P1, KC_P2, KC_P3, KC_P4, KC_P5, KC_P6,
KC_LALT, KC_TRNS, KC_TRNS, KC_E, KC_TRNS, KC_TRNS, KC_TRNS,
KC_LALT, KC_A, KC_TRNS, KC_D, KC_F, KC_TRNS,
KC_LALT, KC_TRNS, KC_TRNS, KC_C, KC_TRNS, KC_B, KC_TRNS,
KC_LALT, KC_LALT, KC_LALT, KC_TRNS,KC_TRNS,
KC_TRNS, KC_TRNS,
KC_TRNS,
KC_LALT,KC_LALT, KC_TRNS,
// right hand
KC_P7, KC_P8, KC_P9, KC_P0, KC_PPLS,KC_PPLS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_P7, KC_P8, KC_P9, KC_PPLS, KC_TRNS,
KC_TRNS, KC_P4, KC_P5, KC_P6, KC_PPLS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_P1, KC_P2, KC_P3, KC_PPLS, KC_TRNS,
KC_P0, KC_P0, KC_P0, KC_PPLS, KC_TRNS,
KC_TRNS, KC_TRNS,
KC_TRNS,
KC_TRNS,KC_LALT, KC_LALT
),
};
const uint16_t PROGMEM fn_actions[] = {
[1] = ACTION_LAYER_TAP_TOGGLE(SYMB), // FN1 - Momentary Layer 1 (Symbols)
[2] = ACTION_LAYER_TAP_TOGGLE(MDIA), // FN2 - Momentary Layer 2 (Media)
[3] = ACTION_LAYER_TAP_TOGGLE(UNIC) // FN3 - Momentary Layer 3 (Unicode entry)
};
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
{
// MACRODOWN only works in this function
switch(id) {
case 0:
if (record->event.pressed) {
register_code(KC_RSFT);
} else {
unregister_code(KC_RSFT);
}
case 3: // this would trigger when you hit a key mapped as M(3)
if (record->event.pressed) {
return MACRO( I(255), D(LALT), T(P1), T(P5), T(P6), U(LALT), END );
}
break;
}
return MACRO_NONE;
};
// Runs just one time when the keyboard initializes.
void matrix_init_user(void) {
};
// Runs constantly in the background, in a loop.
void matrix_scan_user(void) {
uint8_t layer = biton32(layer_state);
ergodox_board_led_off();
ergodox_right_led_1_off();
ergodox_right_led_2_off();
ergodox_right_led_3_off();
switch (layer) {
// TODO: Make this relevant to the ErgoDox EZ.
case 1:
ergodox_right_led_1_on();
break;
case 2:
ergodox_right_led_2_on();
break;
case 3:
ergodox_right_led_3_on();
break;
default:
// none
break;
}
};

File diff suppressed because it is too large Load Diff

@ -0,0 +1,179 @@
Englishman in New York
===========================
:microphone: :tea:
About
------
After using the massdrop configurator to get the basics, I wanted to add a
little extra to my ergodox. Notably the Hyper hotkey, the press and hold,
and a way to have my beloved £ :pound: symbol available<sup>[1](#unicode)</sup>. Why not switch to a GB
layout? Well the computers I use are US keymap'd and I can't always change
that. Plus I've got used to 2/@ and 3/# and moving to the ergodox was hard
enough. :sweat_smile:
I started from the default and edited from there as I needed. It's somewhat
similar to a regular layout, particularly R1 and shift/controls. I ended up
with a few keys that were blank, so I'm testing out some shortcuts. Alt+F4 for
quitting things in Windows, is one example, but I felt it was better placed on
the 1st layer - in case of fat fingers.
Layout
-------
![Layout](rl-layout.jpg "Isn't it lovely")
### Base Layer
```
,--------------------------------------------------. ,--------------------------------------------------.
| ESC | 1! | 2@ | 3# | 4$ | 5% | 6^ | | 7& | 8* | 9( | 0) | -_ | += | BkSp |
|--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
| Tab | Q | W | E | R | T | { | | } | Y | U | I | O | P | |\ |
|--------+------+------+------+------+------| [ | | ] |------+------+------+------+------+--------|
| Win | A | S | D | F | G |------| |------| H | J | K | L | :; | '" |
|--------+------+------+------+------+------| Home | | End |------+------+------+------+------+--------|
| LShift |Z/Alt | X | C | V | B | | | | N | M | , | . | Alt | RShift |
`--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
|LCtrl | COPY | PASTE| Left | Right| | Down | Up |Hyper | `~ | RCtrl |
`----------------------------------' `----------------------------------'
,-------------. ,-------------.
Hyper = Ctrl+Super+Alt+Shift | ~L3 | F5 | | F2 | ~L2 |
,------|------|------| |------+------+------.
| | | PgUp | | Ins | | |
| Enter| BkSp |------| |------| ~L1 |Space |
| | | PgDn | | Del | | |
`--------------------' `--------------------'
```
### Symbol Layer
```
,--------------------------------------------------. ,--------------------------------------------------.
| | F1 | F2 | F3 | F4 | F5 | F6 | | F7 | F8 | F9 | F10 | F11 | F12 |PrintScr|
|--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
| | ! | @ | { | } | | | | | | Up | 7 | 8 | 9 | * | |
|--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
| | # | $ | ( | ) | ` |------| |------| Down | 4 | 5 | 6 | + | |
|--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
| | % | ^ | [ | ] | ~ | | | | & | 1 | 2 | 3 | \ | |
`--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
| | £ | | | | | | . | 0 | = |Alt+F4|
`----------------------------------' `----------------------------------'
↑ ,-------------. ,-------------.
THERE! | | | | | |
,------|------|------| |------+------+------.
CAD = Ctrl + Alt + Delete | | | | | | | |
| | |------| |------| | |
| | | | | CAD | | |
`--------------------' `--------------------'
```
### Media Layer
Not touched this, not used either.
```
,--------------------------------------------------. ,--------------------------------------------------.
| TEENSY | | | | | | | | | | | | | | |
|--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
| | | | MsUp | | | | | | | | | | | |
|--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
| | |MsLeft|MsDown|MsRght| |------| |------| | | | | | Play |
|--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
| | | | | | | | | | | | Prev | Next | | |
`--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
| | | | Lclk | Rclk | |VolDn |VolUp | Mute | | |
`----------------------------------' `----------------------------------'
,-------------. ,-------------.
| | | | | |
,------|------|------| |------+------+------.
| | | | | | |Brwser|
| | |------| |------| |Back |
| | | | | | | |
`--------------------' `--------------------'
```
### Unicode Layer
Used to enter/test unicode input on Windows. All numbers are numpad keys.
```
,--------------------------------------------------. ,--------------------------------------------------.
| Alt | 1 | 2 | 3 | 4 | 5 | 6 | | 7 | 8 | 9 | 0 | + | + | |
|--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
| Alt | | | E | | | | | | | 7 | 8 | 9 | + | |
|--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
| Alt | A | | D | F | |------| |------| | 4 | 5 | 6 | + | |
|--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
| Alt | | | C | | B | | | | | 1 | 2 | 3 | + | |
`--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
| Alt | Alt | Alt | | | | 0 | 0 | 0 | + | |
`----------------------------------' `----------------------------------'
,-------------. ,-------------.
WINDOWS ONLY SETUP!! | ~L3 | | | | |
,------|------|------| |------+------+------.
| | | | | | | |
| Alt | Alt |------| |------| Alt | Alt |
| | | | | | | |
`--------------------' `--------------------'
```
Usage
------
~L1 / L2 / L3 will momentarily switch to a layer if held and another key is pressed.
If pressed and released will remain on layer until pressed again.
### Unicode
This layout is for Windows only. To enter a character Press and Hold Alt, type + and hex code then release Alt.
Changelog
-----------
### [0.2.1] - 2016-04-05
* Changed £ to alt code in Windows. Windows sucks at unicode.
### [0.2.0] - 2016-03-27
* Added unicode layer
* Moved Copy/Paste to left hand side
* Switched Enter and Space (again)
* Added L3 (unicode layer) toggle
* Removed Press and Hold for Alt on right hand size (/)
* Swapped Volume Up/Down to match arrows
* Tried fixing £ macro
* Removed * in the matrix function things (upstream change)
### [0.1.1] - 2016-03-23
* Changed £ input to a macro
### [0.1.0] - 2016-03-22
After actually using the keyboard, I've made some changes:
* Swapped Enter and Space
* Moved backspace to thumb keys (top right still remains)
* Added Ctrl+Alt+Delete
* Added Teensy Reset on 2nd layer
* Switched Up and Down
* Changed copy/paste to be Ctrl+c and Ctrl+v as KC_COPY/PASTE didn't work (in Windows)
* Moved ~L2 to replace +L1 after learning how the function works (notes above)
* Hopefully fixed GBP symbol (unicode enabled in MakeFile)
### [0.0.1] - 2016-03-21
First version
Issues
-------
Space for feedback and notes for future improvements
----
<sup><a name="unicode">1</a></sup>: For Windows only, and you have to edit the [registry](https://en.wikipedia.org/wiki/Unicode_input#Hexadecimal_code_input).

Binary file not shown.

After

Width:  |  Height:  |  Size: 814 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 93 KiB

After

Width:  |  Height:  |  Size: 92 KiB

@ -1,8 +1,8 @@
[{x:3.5},"#\n3",{x:10.5},"*\n8"],
[{y:-0.875,x:2.5},"@\n2",{x:1},"$\n4",{x:8.5},"&\n7",{x:1},"(\n9"],
[{y:-0.875,x:5.5},"%\n5",{c:"#ff4444"},"Esc",{x:4.5,c:"#cccccc"},"_\n\n\n\n\n\n-","^\n6"],
[{y:-0.875,c:"#73ab6a",w:1.5},"~\n\n\n\n\n\n`",{c:"#cccccc"},"!\n1",{x:14.5},")\n0",{t:"#000000\n\n\n\n#0000ff",w:1.5},"+\n\n\n\n\n\n="],
[{y:-0.375,x:3.5,t:"#000000"},"E",{x:10.5},"I"],
[{y:-0.875,c:"#73ab6a",w:1.5},"~\n\n\n\n\n\n`",{c:"#cccccc"},"!\n1",{x:14.5},")\n0",{w:1.5},"+\n\n\n\n\n\n="],
[{y:-0.375,x:3.5},"E",{x:10.5},"I"],
[{y:-0.875,x:2.5},"W",{x:1},"R",{x:8.5},"U",{x:1},"O"],
[{y:-0.875,x:5.5},"T",{h:1.5},"{\n\n\n\n\n\n[",{x:4.5,h:1.5},"}\n\n\n\n\n\n]","Y"],
[{y:-0.875,c:"#73ab6a",w:1.5},"Tab",{c:"#cccccc"},"Q",{x:14.5},"P",{c:"#2277ff",fa:[0,0,0,1],w:1.5},"|\n\\\nMedia\nL2"],
@ -14,7 +14,7 @@
[{y:-0.75,x:3.5,c:"#cccccc"},"C",{x:10.5},"<\n,"],
[{y:-0.875,x:2.5},"X",{x:1},"V",{x:8.5},"M",{x:1},">\n."],
[{y:-0.875,x:5.5},"B",{x:6.5},"N"],
[{y:-0.875,c:"#2277ff",w:1.5},"Capitals\n\n\nShift",{c:"#cccccc"},"Z\n\nCtrl",{x:14.5},"?\n/\nCtrl",{c:"#2277ff",w:1.5},"\n\nCapitals\nShift"],
[{y:-0.875,c:"#2277ff",w:1.5},"Capitals\n\n\nShift",{c:"#cccccc"},"Z",{x:14.5},"?\n/",{c:"#2277ff",w:1.5},"\n\nCapitals\nShift"],
[{y:-0.375,x:3.5,c:"#77aaff"},"Option\n\n\nLAlt",{x:10.5},"Option\n\n\nRAlt"],
[{y:-0.875,x:2.5},"Hyper",{x:1},"Cmd\n\n\nSuper",{x:8.5},"Cmd\n\n\nSuper",{x:1},"Hyper"],
[{y:-0.75,x:0.5},"Ctrl\n\n\nLCtrl","Meh",{x:14.5},"Meh","Ctrl\n\n\nRCtrl"],

@ -1,9 +1,63 @@
# The Ordinary Layout, a familiar and powerful layout
# The Ordinary Layout, a familiar and powerful layout #
The Ordinary Layout is intended to be unremarkably mundane and remarkably useful. This layout maintains most key positions from common QWERTY keyboards and features enhanced Symbol and Media layers compared to the default Ergodox EZ layout.
The Ordinary Layout is intended to be unremarkably mundane and remarkably useful. This layout maintains most key positions from common QWERTY keyboards, and it features enhanced Symbol and Media layers compared to the default Ergodox EZ layout.
Full details about the rationale behind this layout [are available](http://nicholas.rinard.us/2016/03/ergodox-ez-layout.html).
The Ordinary Layout is supposed to look mostly like a normal keyboard, except in the ways that the Ergodox key arrangement is unique. The thumbs are responsible for space, enter, plus both forward and backward delete; with only a couple exceptions, all other keys are in the same place they are found on traditional keyboards.
Nicholas Keene
ordinarylayout@nicholaskeene.com
no rights reserved, use for any purposes, credit me if you are a nice person
## The Base Layout ##
* The yellow keys are text navigation and manipulation
* The dark blue keys are shift keys: case shift (traditional shift), symbol shift, and media shift
* The light blue keys are modifiers: traditional Control, Option, and C ommand keys, plus Hyper and Meh
* The two green keys, tab and tilde, are in the typical places to ease use of the Application Switcher
* The red keys is Escape, one of the few buttons which is in an atypical position
![Ordinary base layout](ordinary-base.png)
This layout puts the modifier keys along the bottom of the keyboard where they are on most layouts. They are in the regular order, with the addition of Hyper and Meh keys. The shift key (case shift) is in the prevalent location. The primo slots usually wasted on Caps Lock and Enter are instead used for the Symbol Shift key which promotes use of the Symbols layer. On the right side of the layout, the Symbol and Media shift keys also double as character keys -- quote and backslash, respectively -- so that touch typists can continue to find those punctuation marks in the right place.
Other than the yellow keys, the only buttons which move to new locations are the Brackets and Dash and Escape. Most touch typists dont touch-type brackets or dash anyway, so only Escape really requires retraining of muscle memory.
The four big yellow keys are arranged differently than in the default Ergodox EZ layout. The Ordinary Layout here copies the design of the old Fingerworks TouchStream keyboard, but also reflects the natural presumptions of the author -- me!; I type the space character with my right hand, and to me it makes sense for the two delete keys to be next to one another.
The Forward Tab and Backward Tab keys are there mostly because I ended up with two extra buttons and needed something to do with them. My muscle memory from using the Truly Ergonomic Keyboard makes me look for the Tab key with my right index finger, so it is handy to have this redundant Tab, and the idea with the Backward Tab key is that it becomes easy to navigate text fields in forms, or to indent/unindent code.
## The Symbols Layout ##
* The periwinkle keys are the eponymous symbols
* The gray keys are F-Keys
* The green keys are a proper number pad
* The red Escape key is found in the "right" location on this layer
* The yellow keys are the *reverse* of the yellow keys on the base layer
* The dark blue Media key means that the Media layer is accessible with the left hand
![Ordinary symbol layout](ordinary-symbol.png)
The Ergodox EZ ships with the "Coder Layer" which I like to call the Symbols layer. There are some significant improvements in The Ordinary Layout over the default layout.
The symbol keys are mostly the same as on the default layout, which did a good job in this regard, but with a few enhancements:
* Angle brackets on this layer mean that curly, square, and angle brackets are all available on different layers of the same two buttons. Also, they mean that all kinds of brackets, including parentheses, are available on both the Base and Symbols layers.
* The slash, backslash, and pipe characters are grouped together as a memory aid.
* The & and | symbols are juxtaposed as a memory aid
The number pad area here, in green, includes all four arithmetic operations in the same order found on most number pads. This layout also has an Enter key, and importantly the key codes emitted by this number pad are *number pad specific key codes*, not regular keyboard key codes. Some software distinguishes keypad codes so users now have access to a fully realized number pad when using The Ordinary Layout.
The Escape key's true home is in the top left corner of the keyboard, so on this layer it can be found there. And on the Symbols layer, the Tab key switches to become a Media key, so press Symbols then Media to access the Media layer using the left hand.
Finally, consider the yellow text-nav keys. In the Symbols layer, these are *reversed* from the base layer, with most keys mirrored, but the Delete keys shifted to maintain the directional significance of their arrangement. This is powerful! Often I find myself using the mouse with my right hand, and the left hand needs to press Enter. Instead of reaching the left hand over to the right side of the keyboard, now I simply tap Symbols to reverse the yellow keys, and Enter is right where it should be.
## The Media Layout ##
* The light turquoise keys move the mouse or the text cursor
* The dark turquoise keys scroll
* The light purple keys signal Web and Audio applications
* The dark purple keys signal the operating system
* The red Escape key is, again, found in the "right" location
![Ordinary media layout](ordinary-media.png)
This layer was inspired by the Media layer on the Ergodox EZ but takes it farther. The Fingerworks TouchStream had a very useful feature for controlling the text cursor easily and this layer does something similar. The left hand can move the mouse, the right hand moves the text cursor, in all four directions, in small or large increments. This greatly enhances navigation in text documents.

@ -60,13 +60,9 @@ const uint16_t PROGMEM fn_actions[] = {
float start_up[][2] = {
{440.0*pow(2.0,(67)/12.0), 600},
{0, 50},
{440.0*pow(2.0,(64)/12.0), 400},
{0, 50},
{440.0*pow(2.0,(55)/12.0), 400},
{0, 50},
{440.0*pow(2.0,(60)/12.0), 400},
{0, 50},
{440.0*pow(2.0,(64)/12.0), 1000},
};
@ -91,6 +87,6 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
void matrix_init_user(void) {
#ifdef AUDIO_ENABLE
init_notes();
play_notes(&start_up, 9, false);
play_notes(&start_up, 5, false);
#endif
}

@ -0,0 +1,34 @@
# The Default Planck Layout
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_QW] = { /* Qwerty */
{KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC},
{KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT},
{KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT },
{M(0), KC_LCTL, KC_LALT, KC_LGUI, MO(_LW), KC_SPC, KC_SPC, MO(_RS), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT}
},
[_CM] = { /* Colemak */
{KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC},
{KC_ESC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT},
{KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT },
{M(0), KC_LCTL, KC_LALT, KC_LGUI, MO(_LW), KC_SPC, KC_SPC, MO(_RS), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT}
},
[_DV] = { /* Dvorak */
{KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_BSPC},
{KC_ESC, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_SLSH},
{KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_ENT },
{M(0), KC_LCTL, KC_LALT, KC_LGUI, MO(_LW), KC_SPC, KC_SPC, MO(_RS), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT}
},
[_RS] = { /* RAISE */
{KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC},
{KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS},
{KC_TRNS, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, DF(_QW), DF(_CM), DF(_DV), RESET, KC_TRNS},
{KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY}
},
[_LW] = { /* LOWER */
{KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC},
{KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE},
{KC_TRNS, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, DF(_QW), DF(_CM), DF(_DV), RESET, KC_TRNS},
{KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY}
}
};

@ -0,0 +1,117 @@
// This is the canonical layout file for the Quantum project. If you want to add another keyboard,
// this is the style you want to emulate.
#include "preonic.h"
#ifdef BACKLIGHT_ENABLE
#include "backlight.h"
#endif
// Each layer gets a name for readability, which is then used in the keymap matrix below.
// The underscores don't mean anything - you can have a layer called STUFF or any other name.
// Layer names don't all need to be of the same length, obviously, and you can also skip them
// entirely and just use numbers.
#define _QW 0
#define _CM 1
#define _DV 2
#define _LW 3
#define _RS 4
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_QW] = { /* Qwerty */
{KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC},
{KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC},
{KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT},
{KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT },
{M(0), KC_LCTL, KC_LALT, KC_LGUI, MO(_LW), KC_SPC, KC_SPC, MO(_RS), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT}
},
[_CM] = { /* Colemak */
{KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC},
{KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC},
{KC_ESC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT},
{KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT },
{M(0), KC_LCTL, KC_LALT, KC_LGUI, MO(_LW), KC_SPC, KC_SPC, MO(_RS), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT}
},
[_DV] = { /* Dvorak */
{KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC},
{KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_BSPC},
{KC_ESC, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_SLSH},
{KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_ENT },
{M(0), KC_LCTL, KC_LALT, KC_LGUI, MO(_LW), KC_SPC, KC_SPC, MO(_RS), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT}
},
[_RS] = { /* RAISE */
{KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC},
{KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC},
{KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS},
{KC_TRNS, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, DF(_QW), DF(_CM), DF(_DV), RESET, KC_TRNS},
{KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY}
},
[_LW] = { /* LOWER */
{KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC},
{KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC},
{KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE},
{KC_TRNS, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, DF(_QW), DF(_CM), DF(_DV), RESET, KC_TRNS},
{KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY}
}
};
const uint16_t PROGMEM fn_actions[] = {
};
// Guitar Notes
#define N_E 13180.5
#define N_B 9870.8
#define N_G 15680.0
#define N_D 11740.7
#define N_E 13180.5
float start_up[][2] = {
{ N_E, 500 },
{ 0, 50 },
{ N_E, 500 },
{ 0, 50 },
{ N_E, 500 },
{ 0, 50 },
{ N_B, 500 },
{ 0, 50 },
{ N_E, 1000 },
{ 0, 50 },
{ N_G, 1500 },
{ 0, 50 },
};
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
{
// MACRODOWN only works in this function
switch(id) {
case 0:
if (record->event.pressed) {
register_code(KC_RSFT);
#ifdef BACKLIGHT_ENABLE
backlight_step();
#endif
} else {
unregister_code(KC_RSFT);
}
break;
}
return MACRO_NONE;
};
void matrix_init_user(void) {
#ifdef AUDIO_ENABLE
init_notes();
play_notes(&start_up, 12, false);
#endif
}
void process_action_user(keyrecord_t *record) {
#ifdef AUDIO_ENABLE
if (record->event.pressed) {
float keypress[][2] = {
{440.0*pow(2.0,(record->event.key.col*7)/12.0), 600}
};
play_notes(&keypress, 1, false);
}
#endif
}

@ -10,6 +10,11 @@ void matrix_scan_user(void) {
};
__attribute__ ((weak))
void process_action_user(keyrecord_t *record) {
};
void matrix_init_kb(void) {
#ifdef BACKLIGHT_ENABLE
backlight_init_ports();
@ -30,3 +35,7 @@ void matrix_init_kb(void) {
void matrix_scan_kb(void) {
matrix_scan_user();
};
void process_action_kb(keyrecord_t *record) {
process_action_user(record);
}

@ -46,5 +46,6 @@
void matrix_init_user(void);
void matrix_scan_user(void);
void process_action_kb(keyrecord_t *record);
#endif

@ -247,6 +247,9 @@ ISR(TIMER3_COMPA_vect) {
if (note_frequency > 0) {
ICR3 = (int)(((double)F_CPU) / note_frequency); // Set max to the period
OCR3A = (int)(((double)F_CPU) / note_frequency) >> 1; // Set compare to half the period
} else {
ICR3 = 0;
OCR3A = 0;
}
#endif

@ -53,6 +53,22 @@ void action_exec(keyevent_t event)
#endif
}
#if !defined(NO_ACTION_LAYER) && defined(PREVENT_STUCK_MODIFIERS)
bool disable_action_cache = false;
void process_action_nocache(keyrecord_t *record)
{
disable_action_cache = true;
process_action(record);
disable_action_cache = false;
}
#else
void process_action_nocache(keyrecord_t *record)
{
process_action(record);
}
#endif
__attribute__ ((weak))
void process_action_kb(keyrecord_t *record) {}
@ -67,7 +83,7 @@ void process_action(keyrecord_t *record)
process_action_kb(record);
action_t action = layer_switch_get_action(event.key);
action_t action = store_or_get_action(event.pressed, event.key);
dprint("ACTION: "); debug_action(action);
#ifndef NO_ACTION_LAYER
dprint(" layer_state: "); layer_debug();
@ -88,14 +104,24 @@ void process_action(keyrecord_t *record)
action.key.mods<<4;
if (event.pressed) {
if (mods) {
add_weak_mods(mods);
if (IS_MOD(action.key.code)) {
// e.g. LSFT(KC_LGUI): we don't want the LSFT to be weak as it would make it useless.
// this also makes LSFT(KC_LGUI) behave exactly the same as LGUI(KC_LSFT)
add_mods(mods);
} else {
add_weak_mods(mods);
}
send_keyboard_report();
}
register_code(action.key.code);
} else {
unregister_code(action.key.code);
if (mods) {
del_weak_mods(mods);
if (IS_MOD(action.key.code)) {
del_mods(mods);
} else {
del_weak_mods(mods);
}
send_keyboard_report();
}
}

@ -62,6 +62,10 @@ void action_function(keyrecord_t *record, uint8_t id, uint8_t opt);
void process_action_kb(keyrecord_t *record);
/* Utilities for actions. */
#if !defined(NO_ACTION_LAYER) && defined(PREVENT_STUCK_MODIFIERS)
extern bool disable_action_cache;
#endif
void process_action_nocache(keyrecord_t *record);
void process_action(keyrecord_t *record);
void register_code(uint8_t code);
void unregister_code(uint8_t code);

@ -110,9 +110,71 @@ void layer_debug(void)
}
#endif
#if !defined(NO_ACTION_LAYER) && defined(PREVENT_STUCK_MODIFIERS)
uint8_t source_layers_cache[MAX_LAYER_BITS][(MATRIX_ROWS * MATRIX_COLS + 7) / 8] = {0};
void update_source_layers_cache(keypos_t key, uint8_t layer)
{
const uint8_t key_number = key.col + (key.row * MATRIX_COLS);
const uint8_t storage_row = key_number / 8;
const uint8_t storage_bit = key_number % 8;
action_t layer_switch_get_action(keypos_t key)
for (uint8_t bit_number = 0; bit_number < MAX_LAYER_BITS; bit_number++) {
source_layers_cache[bit_number][storage_row] ^=
(-((layer & (1U << bit_number)) != 0)
^ source_layers_cache[bit_number][storage_row])
& (1U << storage_bit);
}
}
uint8_t read_source_layers_cache(keypos_t key)
{
const uint8_t key_number = key.col + (key.row * MATRIX_COLS);
const uint8_t storage_row = key_number / 8;
const uint8_t storage_bit = key_number % 8;
uint8_t layer = 0;
for (uint8_t bit_number = 0; bit_number < MAX_LAYER_BITS; bit_number++) {
layer |=
((source_layers_cache[bit_number][storage_row]
& (1U << storage_bit)) != 0)
<< bit_number;
}
return layer;
}
#endif
/*
* Make sure the action triggered when the key is released is the same
* one as the one triggered on press. It's important for the mod keys
* when the layer is switched after the down event but before the up
* event as they may get stuck otherwise.
*/
action_t store_or_get_action(bool pressed, keypos_t key)
{
#if !defined(NO_ACTION_LAYER) && defined(PREVENT_STUCK_MODIFIERS)
if (disable_action_cache) {
return layer_switch_get_action(key);
}
uint8_t layer;
if (pressed) {
layer = layer_switch_get_layer(key);
update_source_layers_cache(key, layer);
}
else {
layer = read_source_layers_cache(key);
}
return action_for_key(layer, key);
#else
return layer_switch_get_action(key);
#endif
}
int8_t layer_switch_get_layer(keypos_t key)
{
action_t action;
action.code = ACTION_TRANSPARENT;
@ -124,15 +186,18 @@ action_t layer_switch_get_action(keypos_t key)
if (layers & (1UL<<i)) {
action = action_for_key(i, key);
if (action.code != ACTION_TRANSPARENT) {
return action;
return i;
}
}
}
/* fall back to layer 0 */
action = action_for_key(0, key);
return action;
return 0;
#else
action = action_for_key(biton32(default_layer_state), key);
return action;
return biton32(default_layer_state);
#endif
}
action_t layer_switch_get_action(keypos_t key)
{
return action_for_key(layer_switch_get_layer(key), key);
}

@ -70,6 +70,17 @@ void layer_xor(uint32_t state);
#define layer_debug()
#endif
/* pressed actions cache */
#if !defined(NO_ACTION_LAYER) && defined(PREVENT_STUCK_MODIFIERS)
/* The number of bits needed to represent the layer number: log2(32). */
#define MAX_LAYER_BITS 5
void update_source_layers_cache(keypos_t key, uint8_t layer);
uint8_t read_source_layers_cache(keypos_t key);
#endif
action_t store_or_get_action(bool pressed, keypos_t key);
/* return the topmost non-transparent layer currently associated with key */
int8_t layer_switch_get_layer(keypos_t key);
/* return action depending on current layer status */
action_t layer_switch_get_action(keypos_t key);

Loading…
Cancel
Save