Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ergodox EZ refactor #3171

Merged
merged 4 commits into from
Jun 13, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 30 additions & 31 deletions keyboards/ergodox_ez/ergodox_ez.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,12 @@ inline void ergodox_led_all_set(uint8_t n)
ergodox_right_led_3_set(n);
}

#define KEYMAP( \
/*
* LEFT HAND: LINES 115-122
* RIGHT HAND: LINES 124-131
*/
#define LAYOUT_ergodox( \
\
/* left hand, spatial positions */ \
k00,k01,k02,k03,k04,k05,k06, \
k10,k11,k12,k13,k14,k15,k16, \
k20,k21,k22,k23,k24,k25, \
Expand All @@ -118,7 +121,6 @@ inline void ergodox_led_all_set(uint8_t n)
k54, \
k53,k52,k51, \
\
/* right hand, spatial positions */ \
k07,k08,k09,k0A,k0B,k0C,k0D, \
k17,k18,k19,k1A,k1B,k1C,k1D, \
k28,k29,k2A,k2B,k2C,k2D, \
Expand Down Expand Up @@ -147,9 +149,12 @@ inline void ergodox_led_all_set(uint8_t n)
{ k0D, k1D, k2D, k3D, k4D, KC_NO } \
}

#define KEYMAP_80( \
/*
* LEFT HAND: LINES 158-165
* RIGHT HAND: LINES 167-174
*/
#define LAYOUT_ergodox_80( \
\
/* left hand, spatial positions */ \
k00,k01,k02,k03,k04,k05,k06, \
k10,k11,k12,k13,k14,k15,k16, \
k20,k21,k22,k23,k24,k25, \
Expand All @@ -159,7 +164,6 @@ inline void ergodox_led_all_set(uint8_t n)
k45,k46,k54, \
k53,k52,k51, \
\
/* right hand, spatial positions */ \
k07,k08,k09,k0A,k0B,k0C,k0D, \
k17,k18,k19,k1A,k1B,k1C,k1D, \
k28,k29,k2A,k2B,k2C,k2D, \
Expand Down Expand Up @@ -188,16 +192,16 @@ inline void ergodox_led_all_set(uint8_t n)
{ k0D, k1D, k2D, k3D, k4D, KC_NO } \
}

#define KEYMAP_PRETTY( \
/* left hand, spatial positions */ /* right hand, spatial positions */ \
L00,L01,L02,L03,L04,L05,L06, R00,R01,R02,R03,R04,R05,R06, \
L10,L11,L12,L13,L14,L15,L16, R10,R11,R12,R13,R14,R15,R16, \
L20,L21,L22,L23,L24,L25, R21,R22,R23,R24,R25,R26, \
L30,L31,L32,L33,L34,L35,L36, R30,R31,R32,R33,R34,R35,R36, \
L40,L41,L42,L43,L44, R42,R43,R44,R45,R46, \
L55,L56, R50,R51, \
L54, R52, \
L53,L52,L51, R55,R54,R53 ) \
/* ---------- LEFT HAND ----------- ---------- RIGHT HAND ---------- */
#define LAYOUT_ergodox_pretty( \
L00,L01,L02,L03,L04,L05,L06, R00,R01,R02,R03,R04,R05,R06, \
L10,L11,L12,L13,L14,L15,L16, R10,R11,R12,R13,R14,R15,R16, \
L20,L21,L22,L23,L24,L25, R21,R22,R23,R24,R25,R26, \
L30,L31,L32,L33,L34,L35,L36, R30,R31,R32,R33,R34,R35,R36, \
L40,L41,L42,L43,L44, R42,R43,R44,R45,R46, \
L55,L56, R50,R51, \
L54, R52, \
L53,L52,L51, R55,R54,R53 ) \
\
/* matrix positions */ \
{ \
Expand All @@ -218,16 +222,16 @@ inline void ergodox_led_all_set(uint8_t n)
{ R06, R16, R26, R36, R46, KC_NO } \
}

#define KEYMAP_PRETTY_80( \
/* left hand, spatial positions */ /* right hand, spatial positions */ \
L00,L01,L02,L03,L04,L05,L06, R00,R01,R02,R03,R04,R05,R06, \
L10,L11,L12,L13,L14,L15,L16, R10,R11,R12,R13,R14,R15,R16, \
L20,L21,L22,L23,L24,L25, R21,R22,R23,R24,R25,R26, \
L30,L31,L32,L33,L34,L35,L36, R30,R31,R32,R33,R34,R35,R36, \
L40,L41,L42,L43,L44, R42,R43,R44,R45,R46, \
L55,L56, R50,R51, \
L45,L46,L54, R52,R40,R41, \
L53,L52,L51, R55,R54,R53 ) \
/* ---------- LEFT HAND ----------- ---------- RIGHT HAND ---------- */
#define LAYOUT_ergodox_pretty_80( \
L00,L01,L02,L03,L04,L05,L06, R00,R01,R02,R03,R04,R05,R06, \
L10,L11,L12,L13,L14,L15,L16, R10,R11,R12,R13,R14,R15,R16, \
L20,L21,L22,L23,L24,L25, R21,R22,R23,R24,R25,R26, \
L30,L31,L32,L33,L34,L35,L36, R30,R31,R32,R33,R34,R35,R36, \
L40,L41,L42,L43,L44, R42,R43,R44,R45,R46, \
L55,L56, R50,R51, \
L45,L46,L54, R52,R40,R41, \
L53,L52,L51, R55,R54,R53 ) \
\
/* matrix positions */ \
{ \
Expand All @@ -248,9 +252,4 @@ inline void ergodox_led_all_set(uint8_t n)
{ R06, R16, R26, R36, R46, KC_NO } \
}

#define LAYOUT_ergodox KEYMAP
#define LAYOUT_ergodox_pretty KEYMAP_PRETTY
#define LAYOUT_ergodox_80 KEYMAP_80
#define LAYOUT_ergodox_pretty_80 KEYMAP_PRETTY_80

#endif
14 changes: 7 additions & 7 deletions keyboards/ergodox_ez/keymaps/bepo_tm_style/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ enum {

const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
// Layer 0: basic keys.
[BASE] = KEYMAP(
[BASE] = LAYOUT_ergodox(
/* left hand */
BP_DLR, BP_DQOT, BP_LGIL, BP_RGIL, BP_LPRN, BP_RPRN, KC_DEL,
KC_TAB, BP_B, BP_ECUT, BP_P, BP_O, BP_EGRV, KC_BSPC,
Expand All @@ -73,7 +73,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_DOWN, TD(TAP_MACRO), TT(MOUSE)),

// Layer 1: function and media keys.
[FN] = KEYMAP(
[FN] = LAYOUT_ergodox(
/* left hand */
KC_SLEP, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, ___,
___, ___, ___, ___, ___, ___, ___,
Expand All @@ -96,7 +96,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
// the MOUSE layer below (except for the arrow keys).

// Layer 2: Mouse control.
[MOUSE] = KEYMAP(
[MOUSE] = LAYOUT_ergodox(
/* left hand */
KC_SLEP, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, ___,
___, ___, KC_BTN4, KC_MS_U, KC_BTN5, ___, ___,
Expand All @@ -117,7 +117,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
___, ___, ___),

// Layer 3: Numeric keypad and system keys.
[NUMS] = KEYMAP(
[NUMS] = LAYOUT_ergodox(
/* left hand */
KC_PSCR, KC_INS, KC_PAUS, ___, ___, ___, ___,
___, ___, ___, ___, ___, ___, ___,
Expand All @@ -140,7 +140,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
// Layer 4: hand swap, all keys are mirrored to the other side of the keyboard
// except for the layer toggle itself (so there is no right arrow when this
// layer is activated).
[SWAP] = KEYMAP(
[SWAP] = LAYOUT_ergodox(
/* left hand */
___, ___, ___, ___, ___, ___, ___,
___, ___, ___, ___, ___, ___, ___,
Expand All @@ -159,11 +159,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
___, TT(SWAP),
___,
___, ___, ___),

// Layer 5: The LEDs are showing the "standard" caps/num/scroll lock indicator
// instead of their default which shows the currently active layers (FN, NUMS,
// and MOUSE in that order).
[SYSLEDS] = KEYMAP(
[SYSLEDS] = LAYOUT_ergodox(
/* left hand */
___, ___, ___, ___, ___, ___, ___,
___, ___, ___, ___, ___, ___, ___,
Expand Down
10 changes: 5 additions & 5 deletions keyboards/ergodox_ez/keymaps/blakedietz/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
*/
// If it accepts an argument (i.e, is a function), it doesn't need KC_.
// Otherwise, it needs KC_*
[BASE] = KEYMAP( // layer 0 : default
[BASE] = LAYOUT_ergodox( // layer 0 : default
// left hand
KC_EQL, KC_1, KC_2, KC_3, KC_4, KC_5, KC_LEFT,
KC_DELT, KC_Q, KC_W, KC_E, KC_R, KC_T, TG(DEV),
Expand Down Expand Up @@ -94,7 +94,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* `--------------------' `--------------------'
*/
// SYMBOLS
[SYMB] = KEYMAP(
[SYMB] = LAYOUT_ergodox(
// left hand
KC_TRNS,KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_TRNS,
KC_TRNS,KC_EXLM,KC_AT, KC_LCBR,KC_RCBR,KC_PIPE,KC_TRNS,
Expand Down Expand Up @@ -136,7 +136,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* `--------------------' `--------------------'
*/
// MEDIA
[MDIA] = KEYMAP(
[MDIA] = LAYOUT_ergodox(
// left 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,
Expand All @@ -156,7 +156,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS
),
[MOUSE] = KEYMAP(
[MOUSE] = LAYOUT_ergodox(
// left hand
KC_TRNS, 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,
Expand All @@ -176,7 +176,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS
),
[DEV] = KEYMAP(
[DEV] = LAYOUT_ergodox(
// left hand
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_F12, KC_F13, KC_F14, KC_F15, KC_F16, KC_TRNS,
Expand Down
Loading