From c37dd4d96f54edac2216527cd84b4e722ed64ac2 Mon Sep 17 00:00:00 2001 From: Daniel Flanagan Date: Wed, 10 May 2017 11:46:19 -0500 Subject: [PATCH] Clean up source, add editorconfig, improve makefile errors --- .editorconfig | 17 ++++ ergodox-infinity/Makefile | 17 +++- ergodox-infinity/keymap.c | 154 ++++++++++++++++++------------------- ergodox-infinity/readme.md | 2 +- 4 files changed, 107 insertions(+), 83 deletions(-) create mode 100644 .editorconfig diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..4f7367e --- /dev/null +++ b/.editorconfig @@ -0,0 +1,17 @@ +root = true + +[*] +end_of_line = lf +insert_final_newline = true + +[*.{md,markdown}] +indent_style = tab +indent_size = 2 + +[Makefile] +indent_style = tab +indent_size = 2 + +[*.c] +indent_style = space +indent_size = 4 diff --git a/ergodox-infinity/Makefile b/ergodox-infinity/Makefile index 10d9c38..b0f941f 100644 --- a/ergodox-infinity/Makefile +++ b/ergodox-infinity/Makefile @@ -1,6 +1,17 @@ -ifndef QMK_DIR - $(error QMK_DIR is not defined) -endif +# Check that given variables are set and all have non-empty values, +# die with an error otherwise. +# +# Params: +# 1. Variable name(s) to test. +# 2. (optional) Error message to print. +check_defined = \ + $(strip $(foreach 1,$1, \ + $(call __check_defined,$1,$(strip $(value 2))))) +__check_defined = \ + $(if $(value $1),, \ + $(error Undefined $1$(if $2, ($2)))) + +$(call check_defined, QMK_DIR) KEYMAP_NAME = "lytedev" ERGODOX_DIR = "${QMK_DIR}/keyboards/ergodox" diff --git a/ergodox-infinity/keymap.c b/ergodox-infinity/keymap.c index 4cb7ccc..d7e0ac4 100644 --- a/ergodox-infinity/keymap.c +++ b/ergodox-infinity/keymap.c @@ -9,38 +9,37 @@ #define MOUS 3 // mouse enum custom_keycodes { - PLACEHOLDER = SAFE_RANGE, // can always be here - EPRM, - VRSN, - RGB_SLD + PLACEHOLDER = SAFE_RANGE, // can always be here + EPRM, + VRSN, + RGB_SLD }; const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { -/* Layer 0: Basic - * - * ,--------------------------------------------------. ,--------------------------------------------------. - * | ` | 1 | 2 | 3 | 4 | 5 | F11 | | F12 | 6 | 7 | 8 | 9 | 0 | Back | - * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| - * | Tab | Q | W | E | R | T | [ | | ] | Y | U | I | O | P | Back | - * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| - * | Escape | A | S | D | F | G |------| |------| H | J | K | L | ; | ' | - * |--------+------+------+------+------+------| ( | | ) |------+------+------+------+------+--------| - * | LShift | Z | X | C | V | B | | | | N | M | , | . | / | Enter | - * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' - * | Ctrl | Ctrl | Alt | Meta | L2 | | L1 | Left | Down | Up | Right | - * `----------------------------------' `------------------------------------' - * ,-------------. ,-------------. - * | Vol- | Menu | | Ins | Vol+ | - * ,------+------+------| |------+------+------. - * | | | Home | | End | | | - * | Spce | Back |------| |------| Enter| Spce | - * | | | NmLk | | Prnt | | | - * `--------------------' `--------------------' - */ - -[BASE] = KEYMAP( + /* Layer 0: Basic + * + * ,--------------------------------------------------. ,--------------------------------------------------. + * | ` | 1 | 2 | 3 | 4 | 5 | F11 | | F12 | 6 | 7 | 8 | 9 | 0 | Back | + * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| + * | Tab | Q | W | E | R | T | [ | | ] | Y | U | I | O | P | Back | + * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| + * | Escape | A | S | D | F | G |------| |------| H | J | K | L | ; | ' | + * |--------+------+------+------+------+------| ( | | ) |------+------+------+------+------+--------| + * | LShift | Z | X | C | V | B | | | | N | M | , | . | / | Enter | + * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' + * | Ctrl | Ctrl | Alt | Meta | L2 | | L1 | Left | Down | Up | Right | + * `----------------------------------' `------------------------------------' + * ,-------------. ,-------------. + * | Vol- | Menu | | Ins | Vol+ | + * ,------+------+------| |------+------+------. + * | | | Home | | End | | | + * | Spce | Back |------| |------| Enter| Spce | + * | | | NmLk | | Prnt | | | + * `--------------------' `--------------------' + */ + [BASE] = KEYMAP( // Left Hand KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_F11, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_LBRC, @@ -66,31 +65,29 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_PSCR, KC_ENT, KC_SPC ), + /* Layer 1: Symbols1 + * + * ,--------------------------------------------------. ,--------------------------------------------------. + * | ~ | ! | @ | # | $ | % | F11 | | F12 | ^ | & | * | ( | ) | Back | + * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| + * | ` | 1 | 2 | 3 | 4 | 5 | { | | } | 6 | 7 | 8 | 9 | 0 | Back | + * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| + * | Escape | F1 | F2 | F3 | F4 | F5 |------| |------| F6 | - | = | [ | ] | \ | + * |--------+------+------+------+------+------| < | | > |------+------+------+------+------+--------| + * | LShift | F7 | F8 | F9 | F10 | F11 | | | | F12 | Ins | , | . | / | Enter | + * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' + * | Ctrl | Ctrl | Alt | Meta | () | | () | Left | Down | Up | Right | + * `----------------------------------' `------------------------------------' + * ,-------------. ,-------------. + * | Vol- | Menu | | Ins | Vol+ | + * ,------+------+------| |------+------+------. + * | | | Home | | End | | | + * | Spce | Back |------| |------| Enter| Spce | + * | | | FLSH | | FLSH | | | + * `--------------------' `--------------------' + */ -/* Layer 1: Symbols1 - * - * ,--------------------------------------------------. ,--------------------------------------------------. - * | ~ | ! | @ | # | $ | % | F11 | | F12 | ^ | & | * | ( | ) | Back | - * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| - * | ` | 1 | 2 | 3 | 4 | 5 | { | | } | 6 | 7 | 8 | 9 | 0 | Back | - * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| - * | Escape | F1 | F2 | F3 | F4 | F5 |------| |------| F6 | - | = | [ | ] | \ | - * |--------+------+------+------+------+------| < | | > |------+------+------+------+------+--------| - * | LShift | F7 | F8 | F9 | F10 | F11 | | | | F12 | Ins | , | . | / | Enter | - * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' - * | Ctrl | Ctrl | Alt | Meta | () | | () | Left | Down | Up | Right | - * `----------------------------------' `------------------------------------' - * ,-------------. ,-------------. - * | Vol- | Menu | | Ins | Vol+ | - * ,------+------+------| |------+------+------. - * | | | Home | | End | | | - * | Spce | Back |------| |------| Enter| Spce | - * | | | FLSH | | FLSH | | | - * `--------------------' `--------------------' - */ - -[SYM1] = KEYMAP( - + [SYM1] = KEYMAP( // Left Hand KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_F11, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_LCBR, @@ -116,30 +113,29 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { RESET, KC_ENT, KC_SPC ), -/* Layer 2: Symbols2 - * - * ,--------------------------------------------------. ,--------------------------------------------------. - * | ` | F1 | F2 | F3 | F4 | F5 | F6 | | F7 | F8 | F9 | F10 | F11 | F12 | Back | - * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| - * | ~ | ! | @ | # | $ | % | { | | } | ^ | & | * | ( | ) | Back | - * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| - * | Escape | F1 | F2 | F3 | F4 | F5 |------| |------| F6 | _ | + | { | } | | | - * |--------+------+------+------+------+------| < | | > |------+------+------+------+------+--------| - * | LShift | F7 | F8 | F9 | F10 | F11 | | | | F12 | Ins | < | > | / | Enter | - * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' - * | Ctrl | Ctrl | Alt | Meta | () | | () | Left | Down | Up | Right | - * `----------------------------------' `------------------------------------' - * ,-------------. ,-------------. - * | Vol- | Menu | | Ins | Vol+ | - * ,------+------+------| |------+------+------. - * | | | Home | | End | | | - * | Spce | Back |------| |------| Enter| Spce | - * | | | FLSH | | FLSH | | | - * `--------------------' `--------------------' - */ - -[SYM2] = KEYMAP( + /* Layer 2: Symbols2 + * + * ,--------------------------------------------------. ,--------------------------------------------------. + * | ` | F1 | F2 | F3 | F4 | F5 | F6 | | F7 | F8 | F9 | F10 | F11 | F12 | Back | + * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| + * | ~ | ! | @ | # | $ | % | { | | } | ^ | & | * | ( | ) | Back | + * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| + * | Escape | F1 | F2 | F3 | F4 | F5 |------| |------| F6 | _ | + | { | } | | | + * |--------+------+------+------+------+------| < | | > |------+------+------+------+------+--------| + * | LShift | F7 | F8 | F9 | F10 | F11 | | | | F12 | Ins | < | > | / | Enter | + * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' + * | Ctrl | Ctrl | Alt | Meta | () | | () | Left | Down | Up | Right | + * `----------------------------------' `------------------------------------' + * ,-------------. ,-------------. + * | Vol- | Menu | | Ins | Vol+ | + * ,------+------+------| |------+------+------. + * | | | Home | | End | | | + * | Spce | Back |------| |------| Enter| Spce | + * | | | FLSH | | FLSH | | | + * `--------------------' `--------------------' + */ + [SYM2] = KEYMAP( // Left Hand KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_LCBR, @@ -147,17 +143,17 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_LSFT, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_LABK, KC_LCTL, KC_LCTL, KC_LALT, KC_LGUI, KC_TRNS, - // Thumb Cluster - KC_VOLD, KC_APP, - /* vv */ /* vv */ KC_HOME, - KC_SPC, KC_BSPC, RESET, + // Thumb Cluster + KC_VOLD, KC_APP, + /* vv */ /* vv */ KC_HOME, + KC_SPC, KC_BSPC, RESET, // Right Hand KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_BSPC, KC_RCBR, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC, /* ^^ */ KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_BSLS, KC_RABK, KC_F12, KC_INS, KC_LABK, KC_RABK, KC_QUES, KC_ENT, - KC_TRNS, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, + KC_TRNS, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, // Thumb Cluster KC_INS, KC_VOLU, diff --git a/ergodox-infinity/readme.md b/ergodox-infinity/readme.md index 5baa430..ede5680 100644 --- a/ergodox-infinity/readme.md +++ b/ergodox-infinity/readme.md @@ -25,7 +25,7 @@ This contains my `qmk_firmware`-compatible Infinity Ergodox keymap. **Note**: You may need to run the `make dfu-left` and `make dfu-right` commands as root. In this case, use `sudo -E make dfu-{left,right}` so that you preserve -the `QMK_DIR` environment variable. +the `QMK_DIR` environment variable you set previously. **Tip**: If you don't have an extra keyboard to send the `make dfu` command, just prepend `sleep 10 &&` to it to give yourself 10 seconds to hit the flash