diff options
author | William Chang <william@factual.com> | 2019-11-20 22:17:07 -0800 |
---|---|---|
committer | William Chang <william@factual.com> | 2019-11-20 22:17:07 -0800 |
commit | e7f4d56592b3975c38af329e77b4efd9108495e8 (patch) | |
tree | 0a416bccbf70bfdbdb9ffcdb3bf136b47378c014 /keyboards/ergodox_ez | |
parent | 71493b2f9bbd5f3d18373c518fa14ccafcbf48fc (diff) | |
parent | 8416a94ad27b3ff058576f09f35f0704a8b39ff3 (diff) |
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'keyboards/ergodox_ez')
30 files changed, 1570 insertions, 172 deletions
diff --git a/keyboards/ergodox_ez/config.h b/keyboards/ergodox_ez/config.h index d22836bd86..e60101e5e2 100644 --- a/keyboards/ergodox_ez/config.h +++ b/keyboards/ergodox_ez/config.h @@ -40,6 +40,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #define MOUSEKEY_MAX_SPEED 7 #define MOUSEKEY_WHEEL_DELAY 0 +#define DEBOUNCE 30 + #define TAPPING_TOGGLE 1 /* define if matrix has ghost */ @@ -73,17 +75,23 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. /* ws2812 RGB LED */ #define RGB_DI_PIN D7 #define RGBLIGHT_ANIMATIONS -#define RGBLED_NUM 15 // Number of LEDs #define RGBLIGHT_HUE_STEP 12 #define RGBLIGHT_SAT_STEP 255 #define RGBLIGHT_VAL_STEP 12 +// Pick one of the modes +// Defaults to 15 mirror, for legacy behavior + +// #define ERGODOX_LED_15 // Addresses 15 LEDs, but same position on both halves +// #define ERGODOX_LED_15_MIRROR // Addresses 15 LEDs, but are mirrored +// #define ERGODOX_LED_30 // Addresses all 30 LED individually + /* fix space cadet rollover issue */ #define DISABLE_SPACE_CADET_ROLLOVER -#define RGBW_BB_TWI +#define RGBW -#define RGBW 1 +#define RGBLIGHT_SLEEP /* * The debounce filtering reports a key/switch change directly, @@ -109,6 +117,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #define DRIVER_2_LED_TOTAL 24 #define DRIVER_LED_TOTAL (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL) +#define RGB_MATRIX_LED_PROCESS_LIMIT 5 +#define RGB_MATRIX_LED_FLUSH_LIMIT 26 + +#define RGB_DISABLE_WHEN_USB_SUSPENDED true + // #define RGBLIGHT_COLOR_LAYER_0 0x00, 0x00, 0xFF /* #define RGBLIGHT_COLOR_LAYER_1 0x00, 0x00, 0xFF */ /* #define RGBLIGHT_COLOR_LAYER_2 0xFF, 0x00, 0x00 */ diff --git a/keyboards/ergodox_ez/ergodox_ez.c b/keyboards/ergodox_ez/ergodox_ez.c index 947a173e36..d313f7d5d9 100644 --- a/keyboards/ergodox_ez/ergodox_ez.c +++ b/keyboards/ergodox_ez/ergodox_ez.c @@ -22,6 +22,8 @@ extern inline void ergodox_right_led_set(uint8_t led, uint8_t n); extern inline void ergodox_led_all_set(uint8_t n); +keyboard_config_t keyboard_config; + bool i2c_initialized = 0; i2c_status_t mcp23018_status = 0x20; @@ -43,6 +45,16 @@ void matrix_init_kb(void) { PORTD |= (1<<5 | 1<<4); PORTE |= (1<<6); + keyboard_config.raw = eeconfig_read_kb(); + ergodox_led_all_set((uint8_t)keyboard_config.led_level * 255 / 4 ); +#ifdef RGB_MATRIX_ENABLE + if (keyboard_config.rgb_matrix_enable) { + rgb_matrix_set_flags(LED_FLAG_ALL); + } else { + rgb_matrix_set_flags(LED_FLAG_NONE); + } +#endif + ergodox_blink_all_leds(); matrix_init_user(); @@ -305,6 +317,7 @@ led_config_t g_led_config = { { } }; void suspend_power_down_kb(void) { + rgb_matrix_set_color_all(0, 0, 0); rgb_matrix_set_suspend_state(true); suspend_power_down_user(); } @@ -314,4 +327,65 @@ void suspend_power_down_kb(void) { suspend_wakeup_init_user(); } +#ifdef ORYX_CONFIGURATOR +void keyboard_post_init_kb(void) { + rgb_matrix_enable_noeeprom(); + keyboard_post_init_user(); +} #endif +#endif + +#ifdef ORYX_CONFIGURATOR +bool process_record_kb(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case LED_LEVEL: + if (record->event.pressed) { + keyboard_config.led_level++; + if (keyboard_config.led_level > 4) { + keyboard_config.led_level = 0; + } + ergodox_led_all_set((uint8_t)keyboard_config.led_level * 255 / 4 ); + eeconfig_update_kb(keyboard_config.raw); + layer_state_set_kb(layer_state); + } + break; +#ifdef RGB_MATRIX_ENABLE + case TOGGLE_LAYER_COLOR: + if (record->event.pressed) { + keyboard_config.disable_layer_led ^= 1; + if (keyboard_config.disable_layer_led) + rgb_matrix_set_color_all(0, 0, 0); + eeconfig_update_kb(keyboard_config.raw); + } + break; + case RGB_TOG: + if (record->event.pressed) { + switch (rgb_matrix_get_flags()) { + case LED_FLAG_ALL: { + rgb_matrix_set_flags(LED_FLAG_NONE); + keyboard_config.rgb_matrix_enable = false; + rgb_matrix_set_color_all(0, 0, 0); + } + break; + default: { + rgb_matrix_set_flags(LED_FLAG_ALL); + keyboard_config.rgb_matrix_enable = true; + } + break; + } + eeconfig_update_kb(keyboard_config.raw); + } + return false; +#endif + } + return process_record_user(keycode, record); +} +#endif + +void eeconfig_init_kb(void) { // EEPROM is getting reset! + keyboard_config.raw = 0; + keyboard_config.led_level = 4; + keyboard_config.rgb_matrix_enable = true; + eeconfig_update_kb(keyboard_config.raw); + eeconfig_init_user(); +} diff --git a/keyboards/ergodox_ez/ergodox_ez.h b/keyboards/ergodox_ez/ergodox_ez.h index 383702b957..7ff62d38a1 100644 --- a/keyboards/ergodox_ez/ergodox_ez.h +++ b/keyboards/ergodox_ez/ergodox_ez.h @@ -107,6 +107,25 @@ inline void ergodox_led_all_set(uint8_t n) ergodox_right_led_3_set(n); } +#ifdef ORYX_CONFIGURATOR +enum ergodox_ez_keycodes { + LED_LEVEL = SAFE_RANGE, + TOGGLE_LAYER_COLOR, + EZ_SAFE_RANGE, +}; +#endif + +typedef union { + uint32_t raw; + struct { + uint8_t led_level :3; + bool disable_layer_led :1; + bool rgb_matrix_enable :1; + }; +} keyboard_config_t; + +extern keyboard_config_t keyboard_config; + /* * LEFT HAND: LINES 115-122 * RIGHT HAND: LINES 124-131 diff --git a/keyboards/ergodox_ez/keymaps/blakedietz/keymap.c b/keyboards/ergodox_ez/keymaps/blakedietz/keymap.c index 8facc6e925..28f45bc3c2 100644 --- a/keyboards/ergodox_ez/keymaps/blakedietz/keymap.c +++ b/keyboards/ergodox_ez/keymaps/blakedietz/keymap.c @@ -52,7 +52,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [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), + KC_DEL, KC_Q, KC_W, KC_E, KC_R, KC_T, TG(DEV), KC_BSPC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_LSFT, CTL_T(KC_Z), ALT_T(KC_X), GUI_T(KC_C), KC_V, KC_B, ALL_T(KC_NO), LT(SYMB,KC_GRV), KC_QUOT, LALT(KC_LSFT), KC_LEFT, KC_RGHT, diff --git a/keyboards/ergodox_ez/keymaps/colemak_es_osx/config.h b/keyboards/ergodox_ez/keymaps/colemak_es_osx/config.h new file mode 100644 index 0000000000..a1e4d79768 --- /dev/null +++ b/keyboards/ergodox_ez/keymaps/colemak_es_osx/config.h @@ -0,0 +1,20 @@ +#pragma once + +// Sets good default for the speed of the mouse. +#undef MOUSEKEY_INTERVAL +#undef MOUSEKEY_DELAY +#undef MOUSEKEY_TIME_TO_MAX +#undef MOUSEKEY_MAX_SPEED + +#define MOUSEKEY_INTERVAL 20 +#define MOUSEKEY_DELAY 100 +#define MOUSEKEY_TIME_TO_MAX 60 +#define MOUSEKEY_MAX_SPEED 7 + +#undef MOUSEKEY_WHEEL_MAX_SPEED +#undef MOUSEKEY_WHEEL_TIME_TO_MAX +#undef MOUSEKEY_WHEEL_DELAY + +#define MOUSEKEY_WHEEL_MAX_SPEED 5 +#define MOUSEKEY_WHEEL_TIME_TO_MAX 60 +#define MOUSEKEY_WHEEL_DELAY 100
\ No newline at end of file diff --git a/keyboards/ergodox_ez/keymaps/colemak_es_osx/keymap.c b/keyboards/ergodox_ez/keymaps/colemak_es_osx/keymap.c new file mode 100644 index 0000000000..0abd028a01 --- /dev/null +++ b/keyboards/ergodox_ez/keymaps/colemak_es_osx/keymap.c @@ -0,0 +1,397 @@ +/* + Copyright 2019 Mario Arias <mario@marioarias.org> + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#include QMK_KEYBOARD_H +#include "version.h" + +#include "keymap_spanish.h" + +enum layers { + BASE = 0, //Colemak + QWERTY, //Qwerty + FN, //Colemak but FN1 to FN12 instead of numbers + NUM, //Numpad + MOUSE, //Mouse and media controls + IDEA //Shortcuts for IDEA / Other tools +}; + +//Special paste +#define S_PASTE LSFT(LGUI(KC_V)) +//tmux prefix +#define T_PREFIX LCTL(KC_B) +// Column mode +#define I_COLUMN ALGR(LCTL(LGUI(ES_MINS))) +// Terminal +#define I_TERM ALGR(KC_F12) +// Line comment +#define I_LN_COM LCTL(LGUI(KC_7)) +// Block comment +#define I_BK_COM LCTL(LGUI(KC_8)) +// Reformat code +#define I_REFORM LALT(LGUI(KC_L)) +// Rename +#define I_RENAME LSFT(KC_F6) +// Find usages +#define I_FUSAGE LALT(KC_F7) +// Code for Packt +#define P_CODE LCTL(ALGR(KC_X)) +// Search +#define I_SEARCH LCTL(LSFT(KC_F)) + + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { +/* Keymap 0: Colemak MacOS Spanish layer + * ,--------------------------------------------------. ,--------------------------------------------------. + * | Esc | 1 ! | 2 " | 3 · | 4 $ | 5 % | º \ | | ¡ ¿ | 6 & | 7 / | 8 ( | 9 ) | 0 = | Backsp | + * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| + * | TAB | Q | W | F | P | G | Home | | End | J | L | U | Y | Ñ | ' ? | + * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| + * | CAPS | A | R | S | T | D |------| |------| H | N | E | I | O | ENT | + * |--------+------+------+------+------+------| <> | | -_ |------+------+------+------+------+--------| + * | Shift | Z | X | C | V | B | | | | K | M | , ; | . : | UP | Shift | + * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' + * | Del | PgUp |Ctl/PD|Alt/[ |Cmd/] | |Cmd/{ |Alt/} | LEFT | DOWN | RIGHT| + * `----------------------------------' `----------------------------------' + * ,--------------. ,--------------. + * | Num | Mouse | | Qwer | Ctrl | + * ,------|------|-------| |------+-------+------. + * | | | FN | |SPaste| | | + * |LShift|Backsp|-------| |------| ENT |Space | + * | | | IDEA | | T-pre| | | + * `---------------------' `---------------------' + */ +[BASE] = LAYOUT_ergodox( +// left hand + KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, ES_LESS, + KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_HOME, + KC_CAPS, KC_A, KC_R, KC_S, KC_T, KC_D, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_GRV, + KC_DEL, KC_PGUP, CTL_T(KC_PGDN), ALT_T(ES_GRV), GUI_T(ES_PLUS), + + DF(NUM), DF(MOUSE), + DF(FN), + KC_LSFT, KC_BSPC, MO(IDEA), + +// right hand + ES_IEXL, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, + KC_END, KC_J, KC_L, KC_U, KC_Y, ES_NTIL, ES_APOS, + KC_H, KC_N, KC_E, KC_I, KC_O, KC_ENT, + ES_MINS, KC_K, KC_M, KC_COMM, KC_DOT, KC_UP, KC_RSFT, + GUI_T(ES_ACUT), ALT_T(KC_BSLS), KC_LEFT, KC_DOWN, KC_RIGHT, + + DF(QWERTY), KC_RCTL, + S_PASTE, + T_PREFIX, KC_ENT, KC_SPC +), +/* Keymap 1: Spanish QWERTY layer (games) //Will probably change it for a Linux/Windows Colemak layer + * + * ,--------------------------------------------------. ,--------------------------------------------------. + * | | | | | | | | | | | | | | | | + * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| + * | | Q | W | E | R | T | | | | Y | U | I | O | P | | + * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| + * | | A | S | D | F | G |------| |------| H | J | K | L | Ñ | | + * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| + * | | Z | X | C | V | B | | | | N | M | | | | | + * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' + * | | | | | | | | | | | | + * `----------------------------------' `----------------------------------' + * ,-------------. ,-------------. + * | | | | Base | | + * ,------|------|------| |------+--------+------. + * | | | | | | | | + * | | |------| |------| | | + * | | | | | | | | + * `--------------------' `----------------------' + */ +[QWERTY] = LAYOUT_ergodox( + // left hand + _______, _______, _______, _______, _______, _______, _______, + _______, KC_Q, KC_W, KC_E, KC_R, KC_T, _______, + _______, KC_A, KC_S, KC_D, KC_F, KC_G, + _______, KC_Z, KC_X, KC_C, KC_V, KC_B, _______, + _______, _______, _______, _______, _______, + + _______, _______, + _______, + _______, _______, _______, + +// right hand + _______, _______, _______, _______, _______, _______, _______, + _______, KC_Y, KC_U, KC_I, KC_O, KC_P, _______, + KC_H, KC_J, KC_K, KC_L, KC_SCLN, _______, + _______, KC_N, KC_M, _______, _______, _______, _______, + _______, _______, _______, _______, _______, + DF(BASE), _______, + _______, + _______, _______, _______ +), +/* Keymap 2: Function Layer +* +* ,--------------------------------------------------. ,--------------------------------------------------. +* | | F1 | F2 | F3 | F4 | F5 | F6 | | F7 | F8 | F9 | F10 | F11 | F12 | | +* |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| +* | | | | | | | | | | | | | | | | +* |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| +* | | | | | | |------| |------| | | | | | | +* |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| +* | | | | | | | | | | | | | | | | +* `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' +* | | | | | | | | | | | | +* `----------------------------------' `----------------------------------' +* ,-------------. ,-------------. +* | | | | | | +* ,------|------|------| |------+------+------. +* | | | Base | | | | | +* | | |------| |------| | | +* | | | | | | | | +* `--------------------' `--------------------' +*/ +[FN] = LAYOUT_ergodox( + // left hand + _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, + _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, + + _______, _______, + DF(BASE), + _______, _______, _______, + +// right hand + KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, + _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, + + _______, _______, + _______, + _______, _______, _______ +), +/* Mouse and media controls + * + * ,--------------------------------------------------. ,--------------------------------------------------. + * | Esc | | | | | | Play | | Vol+ | | | | | | | + * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| + * | | | | Ms U | | | | | | | | Wh U | | | | + * |--------+------+------+------+------+------| Rwd | | Vol- |------+------+------+------+------+--------| + * | | | Ms L | Ms D | Ms R | |------| |------| | Wh L | Wh D | Wh R | | | + * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| + * | | | Acc0 | Acc1 | Acc2 | | Fwd | | Mute | | Btn1 | Btn2 | Btn3 | | | + * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' + * | | | | | | | | | | | | + * `----------------------------------' `----------------------------------' + * ,-------------. ,-------------. + * | Num | Base | | | | + * ,------|------|------| |------+------+------. + * | | | | | | | | + * | | |------ |------| | | + * | | | | | | | | + * `--------------------' `--------------------' + */ +[MOUSE] = LAYOUT_ergodox( +// left hand + KC_ESC, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_MPLY, + XXXXXXX, XXXXXXX, XXXXXXX, KC_MS_U, XXXXXXX, XXXXXXX, KC_MRWD, + XXXXXXX, XXXXXXX, KC_MS_L, KC_MS_D, KC_MS_R, XXXXXXX, + XXXXXXX, XXXXXXX, KC_ACL0, KC_ACL1, KC_ACL2, XXXXXXX, KC_MFFD, + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + + DF(NUM), DF(BASE), + XXXXXXX, + XXXXXXX, XXXXXXX, XXXXXXX, + +// right hand + KC_VOLU, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + KC_VOLD, XXXXXXX, XXXXXXX, KC_WH_U, XXXXXXX, XXXXXXX, XXXXXXX, + XXXXXXX, KC_WH_L, KC_WH_D, KC_WH_R, XXXXXXX, XXXXXXX, + KC_MUTE, XXXXXXX, KC_BTN1, KC_BTN2, KC_BTN3, XXXXXXX, XXXXXXX, + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + + XXXXXXX, XXXXXXX, + XXXXXXX, + XXXXXXX, XXXXXXX, XXXXXXX +), +/* Num pad + * + * ,--------------------------------------------------. ,--------------------------------------------------. + * | | | | | | | | | | ( | ) | = | / | * | | + * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| + * | | | | Up | | | | | | | 7 | 8 | 9 | - | | + * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| + * | | | Left | Down |Right | |------| |------| | 4 | 5 | 6 | + | | + * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| + * | | | | | | | | | | | 1 | 2 | 3 |Enter | | + * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' + * | | | | | | | 0 | 0 | , |Enter | . | + * `----------------------------------' `----------------------------------' + * ,-------------. ,-------------. + * | Base | | | | | + * ,------|------|------| |------+------+------. + * | | | | | | | | + * | | |------ |------| | | + * | | | | | | | | + * `--------------------' `--------------------' + */ +[NUM] = LAYOUT_ergodox( +// left hand + _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, KC_UP, _______, _______, _______, + _______, _______, KC_LEFT, KC_DOWN, KC_RIGHT, _______, + _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, + + DF(BASE), _______, + _______, + _______, _______, _______, + +// right hand + _______, LSFT(KC_8), LSFT(KC_9), KC_PEQL, KC_PSLS, KC_PAST, _______, + _______, _______, KC_P7, KC_P8, KC_P9, KC_PMNS, _______, + _______, KC_P4, KC_P5, KC_P6, KC_PPLS, _______, + _______, _______, KC_P1, KC_P2, KC_P3, KC_PENT, _______, + KC_P0, KC_P0, KC_PDOT, KC_PENT, KC_DOT, + + _______, _______, + _______, + _______, _______, _______ +), +/* IDEA + * + * ,--------------------------------------------------. ,--------------------------------------------------. + * | | | | | | | Renm | | Usag | | LnCm | BkCm | | Term | | + * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| + * | | | |Search| | | | | | | Refm | | | | | + * |--------+------+------+------+------+------| | | Col |------+------+------+------+------+--------| + * | | | | | | |------| |------| | | | | | | + * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| + * | | | Code | | | | | | | | | | | | | + * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' + * | | | | | | | | | | | | + * `----------------------------------' `----------------------------------' + * ,-------------. ,-------------. + * | | | | | | + * ,------|------|------| |------+------+------. + * | | | | | | | | + * | | |------ |------| | | + * | | | | | | | | + * `--------------------' `--------------------' + */ +[IDEA] = LAYOUT_ergodox( + +//Left hand + _______, _______, _______, _______, _______, _______, I_RENAME, + _______, _______, _______, I_SEARCH, _______, _______, _______, + _______, _______, _______, _______, _______, _______, + _______, _______, P_CODE, _______, _______, _______, _______, + _______, _______, _______, _______, _______, + + _______, DF(BASE), + _______, + _______, _______, _______, + +// right hand + I_FUSAGE, _______, I_LN_COM, I_BK_COM, _______, I_TERM, _______, + I_COLUMN, _______, I_REFORM, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, + + _______, _______, + _______, + _______, _______, _______ +) +}; + + +void led_1_off(void) { + ergodox_right_led_1_off(); +} + +void led_2_off(void) { + ergodox_right_led_2_off(); +} + +void led_3_off(void) { + ergodox_right_led_3_off(); +} + +//Runs just one time when the keyboard initializes +void matrix_init_use(void) { + led_1_off(); + led_2_off(); + led_3_off(); +} + +// Value to use to switch LEDs on. The default value of 255 is far too bright. +static const uint8_t max_led_value = 20; + + +void led_1_on(void) { + ergodox_right_led_1_on(); + ergodox_right_led_1_set(max_led_value); +} + +void led_2_on(void) { + ergodox_right_led_2_on(); + ergodox_right_led_2_set(max_led_value); +} + +void led_3_on(void) { + ergodox_right_led_3_on(); + ergodox_right_led_3_set(max_led_value); +} + +uint32_t layer_state_set_user(uint32_t state) { + + if(layer_state_cmp(state ,IDEA)) { + led_1_on(); + led_3_on(); + } else { + led_1_off(); + led_3_off(); + } + + return state; +}; + +void matrix_scan_user(void) { + + ergodox_board_led_off(); + led_1_off(); + led_2_off(); + led_3_off(); + + if(layer_state_cmp(default_layer_state, QWERTY)) { + led_3_on(); + } + + if(layer_state_cmp(default_layer_state, FN)) { + led_2_on(); + } + + if(layer_state_cmp(default_layer_state, NUM)) { + led_2_on(); + led_3_on(); + } + + if(layer_state_cmp(default_layer_state, MOUSE)) { + led_1_on(); + } +}; diff --git a/keyboards/ergodox_ez/keymaps/colemak_es_osx/readme.md b/keyboards/ergodox_ez/keymaps/colemak_es_osx/readme.md new file mode 100644 index 0000000000..b17ae015aa --- /dev/null +++ b/keyboards/ergodox_ez/keymaps/colemak_es_osx/readme.md @@ -0,0 +1,67 @@ +# ErgoDox EZ Spanish Colemak configuration + +## Description + +A Colemak keymap adapted for Spanish. + +### Base Layer - Spanish Colemak + +The Base Layer is a Colemak keymap with an additional "ñ" next to the "y" key. The arrow cluster has a proper T inverted shape. + +It includes almost all Spanish Symbols from a normal 100% keyboard thanks to the use of tap keys + + +| Pressed | Tap | Shift | Alt | +|---|---|---|---| +|Left Ctrl|PgDn||| +|Left Alt|`|ˆ|[| +|Left Cmd|+|*|]| +|Right Cmd|´|¨|{| +|Right Alt|ç|Ç|}| + +For example, if you want to type ```[]```, you keep pressing the "Left Alt" (To modify) and tap "Right Alt" and "Right Cmd" to send "[" and "]" + +### Qwerty Layer + +A Qwerty layer for gaming and maybe some VIM commands. It just modifies the few keys that are different between Colemak and Qwerty and keep all the others keys + +### Fn Layer + +A layer to change the number row including "º" and "¡" for "Fn1" to "Fn12". The rest is just the same as the Base layer + +### Mouse and media controls + +Mouse movement on the left hand, wheel and buttons on the right hand. "Play/Pause", "Rewind", "Forward" in the Left inner column. "Volume Up", "Volume Down" and "Mute" in the Right inner column + +### Numpad + +A complete numpad in the right hand, plus and Arrow cluster on the left hand + +### IDEA (JetBrains IDEs) + +A momentary layer for IDEA shortcuts that require more than two fingers or any Fn key + +## How to build it + +If you already have all the dependencies (Check QMK's documentation), you can run the command: + +```bash +make ergodox_ez:colemak_es_osx +``` + +On MacOS, if you're using MacPorts you can install the following dependencies: + +```bash +port install avr-binutils +port install avr-gcc +port install avr-libc +``` + +This isn't an exhaustive list and maybe there other dependencies that are technically necessary + +## Changelog + +* Jul 2019: + * Initial version for the new QMK version + +
\ No newline at end of file diff --git a/keyboards/ergodox_ez/keymaps/default/keymap.c b/keyboards/ergodox_ez/keymaps/default/keymap.c index 40d0a1eaf0..4936ab42c3 100644 --- a/keyboards/ergodox_ez/keymaps/default/keymap.c +++ b/keyboards/ergodox_ez/keymaps/default/keymap.c @@ -6,7 +6,11 @@ #define MDIA 2 // media keys enum custom_keycodes { +#ifdef ORYX_CONFIGURATOR + EPRM = EZ_SAFE_RANGE, +#else EPRM = SAFE_RANGE, +#endif VRSN, RGB_SLD }; @@ -36,7 +40,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [BASE] = LAYOUT_ergodox( // 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(SYMB), + KC_DEL, KC_Q, KC_W, KC_E, KC_R, KC_T, TG(SYMB), KC_BSPC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_LSFT, CTL_T(KC_Z), KC_X, KC_C, KC_V, KC_B, ALL_T(KC_NO), LT(SYMB,KC_GRV), KC_QUOT, LALT(KC_LSFT), KC_LEFT, KC_RGHT, @@ -164,7 +168,7 @@ void matrix_init_user(void) { }; // Runs whenever there is a layer state change. -uint32_t layer_state_set_user(uint32_t state) { +layer_state_t layer_state_set_user(layer_state_t state) { ergodox_board_led_off(); ergodox_right_led_1_off(); ergodox_right_led_2_off(); diff --git a/keyboards/ergodox_ez/keymaps/default_osx/keymap.c b/keyboards/ergodox_ez/keymaps/default_osx/keymap.c index 864c62a470..3f52528f8b 100644 --- a/keyboards/ergodox_ez/keymaps/default_osx/keymap.c +++ b/keyboards/ergodox_ez/keymaps/default_osx/keymap.c @@ -36,7 +36,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [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(SYMB), + KC_DEL, KC_Q, KC_W, KC_E, KC_R, KC_T, TG(SYMB), KC_BSPC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_LSFT, CTL_T(KC_Z), KC_X, KC_C, KC_V, KC_B, ALL_T(KC_NO), LT(SYMB,KC_GRV),KC_QUOT, LALT(KC_LSFT), KC_LEFT,KC_RGHT, @@ -138,21 +138,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ), }; -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); - } - break; - } - return MACRO_NONE; -}; - // Runs just one time when the keyboard initializes. void matrix_init_user(void) { diff --git a/keyboards/ergodox_ez/keymaps/dvorak_42_key/keymap.c b/keyboards/ergodox_ez/keymaps/dvorak_42_key/keymap.c index c342b90769..dc18edac8f 100644 --- a/keyboards/ergodox_ez/keymaps/dvorak_42_key/keymap.c +++ b/keyboards/ergodox_ez/keymaps/dvorak_42_key/keymap.c @@ -15,6 +15,12 @@ // pushing dev branch // git push origin dev:dev +// debounce settings +// remove these after getting a new keyboard +// #define DEBOUNCE 50 +// #define QMK_KEYS_PER_SCAN 4 + + enum custom_keycodes { PLACEHOLDER = SAFE_RANGE, // can always be here EPRM, @@ -43,7 +49,7 @@ enum custom_keycodes { SHELL_EXPAND_OE_LOGPATTERN, SHELL_EXPAND_OE_TRANPATTERN, - + // Cloud9 macros CLOUD9_TAB_LEFT, CLOUD9_TAB_RIGHT, @@ -52,6 +58,9 @@ enum custom_keycodes { CLOUD9_GOTO_LINE, CLOUD9_NAVIGATE, + // Windows 10 macros, + WINDOWS10_WORKSPACE_LEFT, + WINDOWS10_WORKSPACE_RIGHT, }; @@ -61,7 +70,7 @@ enum custom_keycodes { #define KEYSEL 3 // arrow navigation + shift (allow text selection) #define SHELL_NAV 4 // bash shortcuts #define SHELL_SCREEN 5 // linux screen shortcuts -#define SCREEN_NAV 6 // navigate between linux screen tabs +#define SCREEN_NAV 6 // navigate between linux screen tabs #define BROWSER_CONTROL 7 // control browser and mouse #define COMBINED 8 // combined numbers and symbols layer #define ANDROID_STUDIO 9 @@ -161,7 +170,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { MEH(KC_1), OSM(MOD_LSFT), OSM(MOD_LCTL), MO(KEYSEL), MO(BROWSER_CONTROL), // left thumb cluster - MEH(KC_4), MEH(KC_5), + WINDOWS10_WORKSPACE_LEFT, WINDOWS10_WORKSPACE_RIGHT, MEH(KC_6), MO(COMBINED),MO(KEYNAV), OSM(MOD_LALT), @@ -176,7 +185,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { MEH(KC_F5),MEH(KC_F6),MEH(KC_F7),MEH(KC_F8),KC_ENTER,KC_SPACE ), - + // alternate base layout [BASE_ALTERNATE] = LAYOUT_ergodox( // left hand @@ -201,7 +210,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS - ), + ), [KEYNAV] = LAYOUT_ergodox( // left hand @@ -381,8 +390,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_TRNS,KC_TRNS, KC_TRNS, KC_TRNS,KC_TRNS,KC_TRNS), - - + + [BROWSER_CONTROL] = LAYOUT_ergodox( // left hand KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, @@ -493,19 +502,19 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) if (record->event.pressed) { return MACRO( D(LCTL), T(A), U(LCTL), T(RBRC), END); } - break; + break; case DEL_TO_HOME: if (record->event.pressed) { - return MACRO( + return MACRO( // delete to the beginning of the line D(LSFT), T(HOME), U(LSFT), T(DELETE), END); - } - break; + } + break; + - } return MACRO_NONE; }; @@ -599,21 +608,21 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { case SHELL_HTCSTATUS: SEND_STRING("htcStatus -j "); return true; - break; + break; case SHELL_HTCBOUNCE: SEND_STRING("htcBounce -j "); return true; - break; + break; case SHELL_EXPAND_OE_LOGPATTERN: SEND_STRING(SS_TAP(X_LEFT)"*CQW_HKEX"SS_TAP(X_END)"*.log"SS_LCTRL("x")SS_LSFT("8")); - break; + break; case SHELL_EXPAND_OE_TRANPATTERN: SEND_STRING(SS_TAP(X_LEFT)"*CQW_HKEX"SS_TAP(X_END)"*.tran"SS_LCTRL("x")SS_LSFT("8")); - break; + break; case SHELL_DUMPTLOG: SEND_STRING(" | dumptlog - "); return true; - break; + break; // Cloud9 macros case CLOUD9_TAB_LEFT: SEND_STRING(SS_LCTRL("[")); @@ -639,6 +648,13 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { SEND_STRING(SS_LCTRL("e")); return true; break; + case WINDOWS10_WORKSPACE_LEFT: + SEND_STRING(SS_LGUI(SS_LCTRL(SS_TAP(X_LEFT)))); + return true; + break; + case WINDOWS10_WORKSPACE_RIGHT: + SEND_STRING(SS_LGUI(SS_LCTRL(SS_TAP(X_RIGHT)))); + break; } } diff --git a/keyboards/ergodox_ez/keymaps/kou/keymap.c b/keyboards/ergodox_ez/keymaps/kou/keymap.c index 98fafe8ce6..5e49dca252 100644 --- a/keyboards/ergodox_ez/keymaps/kou/keymap.c +++ b/keyboards/ergodox_ez/keymaps/kou/keymap.c @@ -47,7 +47,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [BASE] = LAYOUT_ergodox( // layer 0 : default // left hand KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_GRV, - KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_DELT, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_DEL, KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_LSFT, LT(NPAD, KC_Z), KC_X, KC_C, KC_V, KC_B, KC_ESC, MO(SYMB), KC_LALT, KC_LGUI, MO(SYMB), KC_SPC, diff --git a/keyboards/ergodox_ez/keymaps/profet_80/keymap.c b/keyboards/ergodox_ez/keymaps/profet_80/keymap.c index 29505b641e..85455fa9d9 100644 --- a/keyboards/ergodox_ez/keymaps/profet_80/keymap.c +++ b/keyboards/ergodox_ez/keymaps/profet_80/keymap.c @@ -34,7 +34,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [BASE] = LAYOUT_ergodox_80( // 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(SYMB), + KC_DEL, KC_Q, KC_W, KC_E, KC_R, KC_T, TG(SYMB), KC_BSPC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_LSFT, CTL_T(KC_Z), KC_X, KC_C, KC_V, KC_B, ALL_T(KC_NO), LT(SYMB,KC_GRV),KC_QUOT, LALT(KC_LSFT), KC_LEFT,KC_RGHT, diff --git a/keyboards/ergodox_ez/keymaps/rgb_layer/keymap.c b/keyboards/ergodox_ez/keymaps/rgb_layer/keymap.c index 384d7d0945..2c90c02a6b 100644 --- a/keyboards/ergodox_ez/keymaps/rgb_layer/keymap.c +++ b/keyboards/ergodox_ez/keymaps/rgb_layer/keymap.c @@ -49,7 +49,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [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(SYMB), + KC_DEL, KC_Q, KC_W, KC_E, KC_R, KC_T, TG(SYMB), KC_BSPC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_LSFT, CTL_T(KC_Z), KC_X, KC_C, KC_V, KC_B, ALL_T(KC_NO), LT(SYMB,KC_GRV),KC_QUOT, LALT(KC_LSFT), KC_LEFT,KC_RGHT, diff --git a/keyboards/ergodox_ez/keymaps/rishka/config.h b/keyboards/ergodox_ez/keymaps/rishka/config.h new file mode 100644 index 0000000000..c8f8180bcc --- /dev/null +++ b/keyboards/ergodox_ez/keymaps/rishka/config.h @@ -0,0 +1,17 @@ +#pragma once + +#define PERMISSIVE_HOLD + +#undef MOUSEKEY_TIME_TO_MAX +#define MOUSEKEY_TIME_TO_MAX 0 + +#undef MOUSEKEY_WHEEL_MAX_SPEED +#undef MOUSEKEY_WHEEL_TIME_TO_MAX + +#define MOUSEKEY_WHEEL_MAX_SPEED 1 +#define MOUSEKEY_WHEEL_TIME_TO_MAX 0 + +#define MK_C_OFFSET_1 20 +#define MK_C_OFFSET_2 30 + +#undef MK_MOMENTARY_ACCEL diff --git a/keyboards/ergodox_ez/keymaps/rishka/keymap.c b/keyboards/ergodox_ez/keymaps/rishka/keymap.c new file mode 100644 index 0000000000..102803e512 --- /dev/null +++ b/keyboards/ergodox_ez/keymaps/rishka/keymap.c @@ -0,0 +1,210 @@ + +#include QMK_KEYBOARD_H +#include "version.h" +#include "rishka.h" +enum layers { + BASE, // default layer + WIN, // Switch keys that are needed in windows + SYMB, // symbols + MDIA, // media keys + GAME, // Gamepad setup + FIRMWARE // Layer to trigger reset/refresh +}; +enum custom_keycodes { + VRSN = SAFE_RANGE, + RGB_SLD +}; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + +[BASE] = LAYOUT_ergodox_pretty_wrapper( + KC_EQL, ________________NUMBERS_L__________________, TG(WIN), OSX_LOCK, ________________NUMBERS_R__________________, KC_MINS, + KC_DELT, _________________QWERTY_L1_________________, TG(SYMB), TG(SYMB), _________________QWERTY_R1_________________, KC_BSLS, + KC_BSPC, _____________MOD_QWERTY_L2_________________, _____________MOD_QWERTY_R2_________________, LT(MDIA, KC_QUOT), + OS_LSFT, _________________QWERTY_L3_________________, ALL_T(KC_NO), TG(MDIA), _________________QWERTY_R3_________________, OS_RSFT, + LT(SYMB,KC_GRV), KC_QUOT, LALT(KC_LSFT), KC_LEFT, KC_RGHT, KC_UP, KC_DOWN, KC_LBRC, KC_RBRC, OSL(SYMB), + ALT_T(KC_APP), TG(GAME), KC_LALT, CTL_T(KC_ESC), + LT(FIRMWARE, KC_HOME), KC_PGUP, + KC_SPC, GUI_T(KC_BSPC), ALT_T(KC_END), GUI_T(KC_PGDN), CTL_T(KC_TAB), ALT_T(KC_ENT) +), + +[WIN] = LAYOUT_ergodox_pretty_wrapper( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + KC_F1, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + KC_TAB, _________________QWERTY_L2_________________, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, KC_LGUI, _______, _______, _______, _______, _______, _______, _______, + KC_LCTL, _______, KC_LALT, _______, _______, _______, _______, _______, _______, _______, + _______, KC_ESC, _______, _______, + _______, _______, + _______, KC_BSPC, KC_LALT, KC_PGDN, CTL_T(KC_TAB), _______ +), + +[SYMB] = LAYOUT_ergodox_pretty_wrapper( +VRSN, ______________________F_L__________________, KC_F11, KC_F12 , ______________________F_R__________________, KC_NLCK, +_______, _________________SYMBOL_L1_________________, _______, _______, _________________SYMBOL_R1_________________, _______, +_______, _________________SYMBOL_L2_________________, _________________SYMBOL_R2_________________, _______, +_______, _________________SYMBOL_L3_________________, _______, _______, _________________SYMBOL_R3_________________, _______, +_______, _______, _______, _______, _______, _______, KC_P0, KC_PDOT, KC_PSLS, _______, + RGB_MOD, RGB_VAI, RGB_HUI, RGB_SLD, + RGB_VAD, RGB_HUD, + _______, _______, _______, RGB_TOG, _______, _______ +), + +[MDIA] = LAYOUT_ergodox( + // left hand + _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, KC_MS_U, _______, KC_WH_U, _______, + _______, _______, KC_MS_L, KC_MS_D, KC_MS_R, KC_WH_D, + _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, KC_BTN1, KC_BTN2, + _______, KC_BTN5, + KC_BTN4, + KC_BTN1, KC_BTN2, KC_BTN3, + // right hand + _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, KC_WH_U, _______, _______, _______, + _______, KC_WH_L, KC_WH_D, KC_WH_R, _______, KC_MPLY, + _______, _______, _______, KC_MPRV, KC_MNXT, _______, _______, + KC_VOLU, KC_VOLD, KC_MUTE, _______, _______, + _______, _______, + _______, + KC_ACL2, KC_ACL1, KC_ACL0 +), + +[GAME] = LAYOUT_ergodox( + // left hand + KC_ESCAPE, KC_GRAVE, KC_1, KC_2, KC_3, KC_4, KC_5, + KC_F1, KC_Y, KC_Q, KC_W, KC_E, KC_R, KC_T, + KC_TAB, KC_LSHIFT, KC_A, KC_S, KC_D, KC_F, + KC_LCTRL, KC_B, KC_Z, KC_X, KC_C, KC_V, KC_G, + LT(BASE, KC_L), KC_J, KC_I, KC_O, KC_M, + KC_ESCAPE, _______, + KC_ENTER, + KC_SPACE, KC_LCTRL, KC_LALT, + // right hand + KC_RGHT, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, + TG(SYMB), KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLS, + KC_H, KC_J, KC_K, KC_L, LT(MDIA, KC_SCLN), GUI_T(KC_QUOT), + MEH_T(KC_NO), KC_N, KC_M, KC_COMM, KC_DOT, CTL_T(KC_SLSH), KC_RSFT, + KC_UP, KC_DOWN, KC_LBRC, KC_RBRC, TT(SYMB), + KC_LALT, CTL_T(KC_ESC), + KC_PGUP, + KC_PGDN, KC_TAB, KC_ENT +), + +[FIRMWARE] = LAYOUT_ergodox( + // left hand + _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, + _______, _______, + _______, + RESET, _______, _______, + // right hand + _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, + _______, _______, + _______, + _______, _______, EEP_RST +), +}; + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + if (record->event.pressed) { + switch (keycode) { + case VRSN: + SEND_STRING (QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION); + return false; + #ifdef RGBLIGHT_ENABLE + case RGB_SLD: + rgblight_mode(1); + return false; + #endif + } + } + return true; +} + +// Runs just one time when the keyboard initializes. +void keyboard_post_init_user(void) { +#ifdef RGBLIGHT_COLOR_LAYER_0 + rgblight_setrgb(RGBLIGHT_COLOR_LAYER_0); +#endif +}; + +// Runs whenever there is a layer state change. +uint32_t layer_state_set_user(layer_state_t state) { + ergodox_board_led_off(); + ergodox_right_led_1_off(); + ergodox_right_led_2_off(); + ergodox_right_led_3_off(); + + uint8_t layer = get_highest_layer(state); + switch (layer) { + case 0: + #ifdef RGBLIGHT_COLOR_LAYER_0 + rgblight_setrgb(RGBLIGHT_COLOR_LAYER_0); + #else + #ifdef RGBLIGHT_ENABLE + rgblight_init(); + #endif + #endif + break; + case 1: + ergodox_right_led_1_on(); + #ifdef RGBLIGHT_COLOR_LAYER_1 + rgblight_setrgb(RGBLIGHT_COLOR_LAYER_1); + #endif + break; + case 2: + ergodox_right_led_2_on(); + #ifdef RGBLIGHT_COLOR_LAYER_2 + rgblight_setrgb(RGBLIGHT_COLOR_LAYER_2); + #endif + break; + case 3: + ergodox_right_led_3_on(); + #ifdef RGBLIGHT_COLOR_LAYER_3 + rgblight_setrgb(RGBLIGHT_COLOR_LAYER_3); + #endif + break; + case 4: + ergodox_right_led_1_on(); + ergodox_right_led_2_on(); + #ifdef RGBLIGHT_COLOR_LAYER_4 + rgblight_setrgb(RGBLIGHT_COLOR_LAYER_4); + #endif + break; + case 5: + ergodox_right_led_1_on(); + ergodox_right_led_3_on(); + #ifdef RGBLIGHT_COLOR_LAYER_5 + rgblight_setrgb(RGBLIGHT_COLOR_LAYER_5); + #endif + break; + case 6: + ergodox_right_led_2_on(); + ergodox_right_led_3_on(); + #ifdef RGBLIGHT_COLOR_LAYER_6 + rgblight_setrgb(RGBLIGHT_COLOR_LAYER_6); + #endif + break; + case 7: + ergodox_right_led_1_on(); + ergodox_right_led_2_on(); + ergodox_right_led_3_on(); + #ifdef RGBLIGHT_COLOR_LAYER_7 + rgblight_setrgb(RGBLIGHT_COLOR_LAYER_7); + #endif + break; + default: + break; + } + + return state; +}; diff --git a/keyboards/ergodox_ez/keymaps/rishka/rules.mk b/keyboards/ergodox_ez/keymaps/rishka/rules.mk new file mode 100644 index 0000000000..c867f89718 --- /dev/null +++ b/keyboards/ergodox_ez/keymaps/rishka/rules.mk @@ -0,0 +1,2 @@ +# TAP_DANCE_ENABLE = yes +MOUSEKEY_ENABLE = yes diff --git a/keyboards/ergodox_ez/keymaps/skug/keymap.c b/keyboards/ergodox_ez/keymaps/skug/keymap.c index 6f9a577f7e..a9be5d55c4 100644 --- a/keyboards/ergodox_ez/keymaps/skug/keymap.c +++ b/keyboards/ergodox_ez/keymaps/skug/keymap.c @@ -27,6 +27,9 @@ #define MDIA 2 // media keys #define ARRW 3 // arrow + soon mouse +#define SE_LT SE_LESS +#define SE_GT LSFT(SE_LESS) + enum custom_keycodes { PLACEHOLDER = SAFE_RANGE, // can always be here EPRM, @@ -38,8 +41,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { /* Keymap 0: Basic layer * * ,--------------------------------------------------. ,--------------------------------------------------. - * | ½ | ! | " | # | # | % | Ins | | L1 | & | / | ( | ) | = | ? | - * | § | 1 | 2 @ | 3 £ | 4 $ | 5 | | | | 6 | 7 { | 8 [ | 9 ] | 0 } | + \ | + * | Esc | ! | " | # | # | % | Ins | | L1 | & | / | ( | ) | = | ? | + * | | 1 | 2 @ | 3 £ | 4 $ | 5 | | | | 6 | 7 { | 8 [ | 9 ] | 0 } | + \ | * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| * | Tab | Q | W | E | R | T | L2 | | L2 | Y | U | I | O | P | Å | * | | | | | | | | | | | | | | | | @@ -66,22 +69,22 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { // Otherwise, it needs KC_* [BASE] = LAYOUT_ergodox_80( // layer 0 : default // left hand - NO_HALF, KC_1, KC_2, KC_3, KC_4, KC_5, KC_INS, + KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_INS, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, TG(SYMB), MO(ARRW), KC_A, KC_S, KC_D, KC_F, KC_G, KC_LSPO, CTL_T(KC_Z), KC_X, KC_C, KC_V, KC_B, KC_WBAK, - CTL_T(NO_APOS), NO_ACUT, KC_LALT, KC_BSPC, KC_SPC, - NO_LESS, KC_END, + CTL_T(SE_APOS), SE_ACUT, KC_LALT, KC_BSPC, KC_SPC, + SE_LESS, KC_END, KC_LEFT, KC_RIGHT, KC_PGDN, CTL_T(KC_ENT), ALT_T(KC_ESC), KC_LGUI, // right hand - TO(ARRW), KC_6, KC_7, KC_8, KC_9, KC_0, NO_PLUS, - TG(SYMB), KC_Y, KC_U, KC_I, KC_O, KC_P, NO_AA, - KC_H, KC_J, KC_K, KC_L, LT(MDIA, NO_OSLH), LT(SYMB, NO_AE), - KC_WFWD, KC_N, KC_M, KC_COMM, KC_DOT, NO_MINS, KC_RSPC, - KC_SPC, KC_BSPC, KC_ALGR, NO_ASTR, CTL_T(NO_TILD), - KC_HOME, NO_CIRC, + TO(ARRW), KC_6, KC_7, KC_8, KC_9, KC_0, SE_PLUS, + TG(SYMB), KC_Y, KC_U, KC_I, KC_O, KC_P, SE_AA, + KC_H, KC_J, KC_K, KC_L, LT(MDIA, SE_OSLH), LT(SYMB, SE_AE), + KC_WFWD, KC_N, KC_M, KC_COMM, KC_DOT, SE_MINS, KC_RSPC, + KC_SPC, KC_BSPC, KC_ALGR, SE_ASTR, CTL_T(SE_TILD), + KC_HOME, SE_CIRC, KC_PGUP, KC_UP, KC_DOWN, KC_LGUI, ALT_T(KC_ESC), CTL_T(KC_ENT) ), @@ -96,7 +99,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| * | | % | ^ | [ | ] | ~ | | | | & | 1 | 2 | 3 | - | | * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' - * | | | | | | | | . | 0 | = | | + * | | | | < | > | | | . | 0 | = | | * `----------------------------------' `----------------------------------' * ,-------------. ,-------------. * | | | | | | @@ -110,19 +113,19 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [SYMB] = LAYOUT_ergodox_80( // left hand VRSN, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, _______, - _______,KC_EXLM,NO_AT, NO_LCBR,NO_RCBR,NO_PIPE,_______, - _______,KC_HASH,NO_DLR, NO_LPRN,NO_RPRN,NO_GRV, - _______,KC_PERC,NO_CIRC,NO_LBRC,NO_RBRC,NO_TILD,_______, - EPRM,_______,_______,_______,_______, + _______,KC_EXLM,SE_AT, SE_LCBR,SE_RCBR,SE_PIPE,_______, + _______,KC_HASH,SE_DLR, SE_LPRN,SE_RPRN,SE_GRV, + _______,KC_PERC,SE_CIRC,SE_LBRC,SE_RBRC,SE_TILD,_______, + EPRM, _______, _______, SE_LT , SE_GT, _______,_______, _______,_______,_______, _______,_______,_______, // right hand _______, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, - _______, KC_UP, KC_7, KC_8, KC_9, NO_ASTR, KC_F12, - KC_DOWN, KC_4, KC_5, KC_6, NO_PLUS, _______, - _______, NO_AMPR, KC_1, KC_2, KC_3, NO_MINS, _______, - _______,KC_DOT, KC_0, NO_EQL, _______, + _______, KC_UP, KC_7, KC_8, KC_9, SE_ASTR, KC_F12, + KC_DOWN, KC_4, KC_5, KC_6, SE_PLUS, _______, + _______, SE_AMPR, KC_1, KC_2, KC_3, SE_MINS, _______, + _______,KC_DOT, KC_0, SE_EQL, _______, _______, _______, _______, _______, _______, _______, _______, _______ @@ -171,7 +174,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ), // Keymap: Ducky Style arrows [ARRW] = LAYOUT_ergodox_80( - _______, _______, _______, _______, _______, _______, _______, + SE_HALF, _______, _______, _______, _______, _______, _______, _______, _______, KC_UP , _______, _______, _______, _______, _______, KC_LEFT, KC_DOWN, KC_RIGHT, _______, _______, _______, _______, _______, _______, _______, _______, _______, diff --git a/keyboards/ergodox_ez/keymaps/steno/keymap.c b/keyboards/ergodox_ez/keymaps/steno/keymap.c index 45fc9f8ba9..080d3f6cef 100644 --- a/keyboards/ergodox_ez/keymaps/steno/keymap.c +++ b/keyboards/ergodox_ez/keymaps/steno/keymap.c @@ -36,7 +36,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [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(SYMB), + KC_DEL, KC_Q, KC_W, KC_E, KC_R, KC_T, TG(SYMB), KC_BSPC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_LSFT, CTL_T(KC_Z), KC_X, KC_C, KC_V, KC_B, ALL_T(KC_NO), LT(SYMB,KC_GRV),KC_QUOT, LALT(KC_LSFT), KC_LEFT,KC_RGHT, diff --git a/keyboards/ergodox_ez/keymaps/testing/keymap.c b/keyboards/ergodox_ez/keymaps/testing/keymap.c index 2fdd122363..a90458cefe 100644 --- a/keyboards/ergodox_ez/keymaps/testing/keymap.c +++ b/keyboards/ergodox_ez/keymaps/testing/keymap.c @@ -28,19 +28,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { }; -// leaving this in place for compatibilty with old keymaps cloned and re-compiled. -const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) -{ - switch(id) { - case 0: - if (record->event.pressed) { - SEND_STRING (QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION); - } - break; - } - return MACRO_NONE; -}; - void matrix_init_user(void) { #ifdef RGBLIGHT_COLOR_LAYER_0 rgblight_setrgb(RGBLIGHT_COLOR_LAYER_0); diff --git a/keyboards/ergodox_ez/led_i2c.c b/keyboards/ergodox_ez/led_i2c.c new file mode 100644 index 0000000000..3e75a8cd08 --- /dev/null +++ b/keyboards/ergodox_ez/led_i2c.c @@ -0,0 +1,86 @@ +/* + * light weight WS2812 lib V2.0b + * + * Controls WS2811/WS2812/WS2812B RGB-LEDs + * Author: Tim (cpldcpu@gmail.com) + * + * Jan 18th, 2014 v2.0b Initial Version + * Nov 29th, 2015 v2.3 Added SK6812RGBW support + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ +#ifdef RGBLIGHT_ENABLE + +# include "ws2812.c" +# include "ergodox_ez.h" + +extern rgblight_config_t rgblight_config; + +/* + * Forward declare internal functions + * + * The functions take a byte-array and send to the data output as WS2812 bitstream. + * The length is the number of bytes to send - three per LED. + */ + +void ws2812_sendarray(uint8_t *array, uint16_t length); +void ws2812_sendarray_mask(uint8_t *array, uint16_t length, uint8_t pinmask); + + + + +void rgblight_set(void) { + if (!rgblight_config.enable) { + for (uint8_t i = 0; i < RGBLED_NUM; i++) { + led[i].r = 0; + led[i].g = 0; + led[i].b = 0; +#ifdef RGBW + led[i].w = 0; +#endif + } + } + + + uint8_t led_num = RGBLED_NUM; + i2c_init(); + i2c_start(0x84, ERGODOX_EZ_I2C_TIMEOUT); + int i = 0; +# if defined(ERGODOX_LED_30) + // prevent right-half code from trying to bitbang all 30 + // so with 30 LEDs, we count from 29 to 15 here, and the + // other half does 0 to 14. + led_num = RGBLED_NUM / 2; + for (i = led_num + led_num - 1; i >= led_num; --i) +# elif defined(ERGODOX_LED_15_MIRROR) + for (i = 0; i < led_num; ++i) +# else // ERGDOX_LED_15 non-mirrored + for (i = led_num - 1; i >= 0; --i) +# endif + { + uint8_t *data = (uint8_t *)(led + i); + i2c_write(*data++, ERGODOX_EZ_I2C_TIMEOUT); + i2c_write(*data++, ERGODOX_EZ_I2C_TIMEOUT); + i2c_write(*data++, ERGODOX_EZ_I2C_TIMEOUT); +#ifdef RGBW + i2c_write(*data++, ERGODOX_EZ_I2C_TIMEOUT); +#endif + } + i2c_stop(); + + ws2812_setleds(led, RGBLED_NUM); +} + + +#endif // RGBLIGHT_ENABLE diff --git a/keyboards/ergodox_ez/matrix.c b/keyboards/ergodox_ez/matrix.c index 2bfe27b9a3..4f11a0ad52 100644 --- a/keyboards/ergodox_ez/matrix.c +++ b/keyboards/ergodox_ez/matrix.c @@ -31,9 +31,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "matrix.h" #include "debounce.h" #include QMK_KEYBOARD_H -#ifdef DEBUG_MATRIX_SCAN_RATE -# include "timer.h" -#endif /* * This constant define not debouncing time in msecs, assuming eager_pr. @@ -47,10 +44,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. * that comment was written.) */ -#ifndef DEBOUNCE -# define DEBOUNCE 5 -#endif - /* matrix state(1:on, 0:off) */ static matrix_row_t raw_matrix[MATRIX_ROWS]; // raw values static matrix_row_t matrix[MATRIX_ROWS]; // debounced values @@ -63,11 +56,6 @@ static void select_row(uint8_t row); static uint8_t mcp23018_reset_loop; // static uint16_t mcp23018_reset_loop; -#ifdef DEBUG_MATRIX_SCAN_RATE -uint32_t matrix_timer; -uint32_t matrix_scan_count; -#endif - __attribute__((weak)) void matrix_init_user(void) {} __attribute__((weak)) void matrix_scan_user(void) {} @@ -94,10 +82,6 @@ void matrix_init(void) { raw_matrix[i] = 0; } -#ifdef DEBUG_MATRIX_SCAN_RATE - matrix_timer = timer_read32(); - matrix_scan_count = 0; -#endif debounce_init(MATRIX_ROWS); matrix_init_quantum(); } @@ -112,11 +96,6 @@ void matrix_power_up(void) { for (uint8_t i = 0; i < MATRIX_ROWS; i++) { matrix[i] = 0; } - -#ifdef DEBUG_MATRIX_SCAN_RATE - matrix_timer = timer_read32(); - matrix_scan_count = 0; -#endif } // Reads and stores a row, returning @@ -147,20 +126,6 @@ uint8_t matrix_scan(void) { } } -#ifdef DEBUG_MATRIX_SCAN_RATE - matrix_scan_count++; - - uint32_t timer_now = timer_read32(); - if (TIMER_DIFF_32(timer_now, matrix_timer) > 1000) { - print("matrix scan frequency: "); - pdec(matrix_scan_count); - print("\n"); - - matrix_timer = timer_now; - matrix_scan_count = 0; - } -#endif - #ifdef LEFT_LEDS mcp23018_status = ergodox_left_leds_update(); #endif // LEFT_LEDS diff --git a/keyboards/ergodox_ez/post_config.h b/keyboards/ergodox_ez/post_config.h new file mode 100644 index 0000000000..526cc8c417 --- /dev/null +++ b/keyboards/ergodox_ez/post_config.h @@ -0,0 +1,20 @@ +#pragma once + +#if !defined(ERGODOX_LED_15) && !defined(ERGODOX_LED_30) +// if no value is defined, assume previous behavior +// # define ERGODOX_LED_15 +// # define ERGODOX_LED_30 +# define ERGODOX_LED_15_MIRROR +#endif + +#if (defined(ERGODOX_LED_30) + defined(ERGODOX_LED_15) + defined(ERGODOX_LED_15_MIRROR)) != 1 +# error "You must only define one of the ERGODOX_LED options." +#endif + +#ifdef ERGODOX_LED_30 +// If using 30 LEDs, then define that many +# define RGBLED_NUM 30 // Number of LEDs +#else +// If not, then only define 15 +# define RGBLED_NUM 15 // Number of LEDs +#endif diff --git a/keyboards/ergodox_ez/rules.mk b/keyboards/ergodox_ez/rules.mk index 2882072a62..fd8f5722d3 100644 --- a/keyboards/ergodox_ez/rules.mk +++ b/keyboards/ergodox_ez/rules.mk @@ -1,68 +1,16 @@ -#---------------------------------------------------------------------------- -# On command line: -# -# make = Make software. -# -# make clean = Clean out built project files. -# -# That's pretty much all you need. To compile, always go make clean, -# followed by make. -# -# For advanced users only: -# make teensy = Download the hex file to the device, using teensy_loader_cli. -# (must have teensy_loader_cli installed). -# -#---------------------------------------------------------------------------- - -# # project specific files -SRC += matrix.c -QUANTUM_LIB_SRC += i2c_master.c - # MCU name MCU = atmega32u4 -# Processor frequency. -# This will define a symbol, F_CPU, in all source code files equal to the -# processor frequency in Hz. You can then use this symbol in your source code to -# calculate timings. Do NOT tack on a 'UL' at the end, this will be done -# automatically to create a 32-bit value in your source code. -# -# This will be an integer division of F_USB below, as it is sourced by -# F_USB after it has run through any CPU prescalers. Note that this value -# does not *change* the processor frequency - it should merely be updated to -# reflect the processor speed set externally so that the code can use accurate -# software delays. -F_CPU = 16000000 - - -# -# LUFA specific -# -# Target architecture (see library "Board Types" documentation). -ARCH = AVR8 - -# Input clock frequency. -# This will define a symbol, F_USB, in all source code files equal to the -# input clock frequency (before any prescaling is performed) in Hz. This value may -# differ from F_CPU if prescaling is used on the latter, and is required as the -# raw input clock is fed directly to the PLL sections of the AVR for high speed -# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL' -# at the end, this will be done automatically to create a 32-bit value in your -# source code. -# -# If no clock division is performed on the input clock inside the AVR (via the -# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU. -F_USB = $(F_CPU) - -# Bootloader -# This definition is optional, and if your keyboard supports multiple bootloaders of -# different sizes, comment this out, and the correct address will be loaded -# automatically (+60). See bootloader.mk for all options. +# Bootloader selection +# Teensy halfkay +# Pro Micro caterina +# Atmel DFU atmel-dfu +# LUFA DFU lufa-dfu +# QMK DFU qmk-dfu +# ATmega32A bootloadHID +# ATmega328P USBasp BOOTLOADER = halfkay -# Interrupt driven control endpoint task(+60) -OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT - # If you have Left LEDs (see # https://geekhack.org/index.php?topic=22780.msg873819#msg873819 for # details), include the following define: @@ -83,7 +31,14 @@ SWAP_HANDS_ENABLE= yes # Allow swapping hands of keyboard SLEEP_LED_ENABLE = no API_SYSEX_ENABLE = no RGBLIGHT_ENABLE = yes +RGBLIGHT_CUSTOM_DRIVER = yes + RGB_MATRIX_ENABLE = no # enable later DEBOUNCE_TYPE = eager_pr +# project specific files +SRC += matrix.c \ + led_i2c.c +QUANTUM_LIB_SRC += i2c_master.c + LAYOUTS = ergodox diff --git a/keyboards/ergodox_ez/util/compile_keymap.py b/keyboards/ergodox_ez/util/compile_keymap.py index f427d6fd80..f427d6fd80 100644..100755 --- a/keyboards/ergodox_ez/util/compile_keymap.py +++ b/keyboards/ergodox_ez/util/compile_keymap.py diff --git a/keyboards/ergodox_ez/util/keymap_beautifier/Dockerfile b/keyboards/ergodox_ez/util/keymap_beautifier/Dockerfile new file mode 100644 index 0000000000..fbee1d0df8 --- /dev/null +++ b/keyboards/ergodox_ez/util/keymap_beautifier/Dockerfile @@ -0,0 +1,8 @@ +FROM python:3.7.4-alpine3.10 + +WORKDIR /usr/src/app +COPY requirements.txt ./ +RUN pip install --no-cache-dir -r requirements.txt +COPY ./KeymapBeautifier.py ./KeymapBeautifier.py + +CMD [ "python", "./KeymapBeautifier.py", "-h" ] diff --git a/keyboards/ergodox_ez/util/keymap_beautifier/KeymapBeautifier.py b/keyboards/ergodox_ez/util/keymap_beautifier/KeymapBeautifier.py new file mode 100755 index 0000000000..b96e4c96cd --- /dev/null +++ b/keyboards/ergodox_ez/util/keymap_beautifier/KeymapBeautifier.py @@ -0,0 +1,399 @@ +#!/usr/bin/env python + +import argparse +import pycparser +import re + +class KeymapBeautifier: + justify_toward_center = False + filename_in = None + filename_out = None + output_layout = None + output = None + + column_max_widths = {} + + KEY_ALIASES = { + "KC_TRANSPARENT": "_______", + "KC_TRNS": "_______", + "KC_NO": "XXXXXXX", + } + KEYMAP_START = 'const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {\n' + KEYMAP_END = '};\n' + KEYMAP_START_REPLACEMENT = "const int keymaps[]={\n" + KEY_CHART = """ + /* + * ,--------------------------------------------------. ,--------------------------------------------------. + * | 0 | 1 | 2 | 3 | 4 | 5 | 6 | | 38 | 39 | 40 | 41 | 42 | 43 | 44 | + * |--------+------+------+------+------+------+------| |------+------+------+------+------+------+--------| + * | 7 | 8 | 9 | 10 | 11 | 12 | 13 | | 45 | 46 | 47 | 48 | 49 | 50 | 51 | + * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| + * | 14 | 15 | 16 | 17 | 18 | 19 |------| |------| 52 | 53 | 54 | 55 | 56 | 57 | + * |--------+------+------+------+------+------| 26 | | 58 |------+------+------+------+------+--------| + * | 20 | 21 | 22 | 23 | 24 | 25 | | | | 59 | 60 | 61 | 62 | 63 | 64 | + * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' + * | 27 | 28 | 29 | 30 | 31 | | 65 | 66 | 67 | 68 | 69 | + * `----------------------------------' `----------------------------------' + * ,-------------. ,-------------. + * | 32 | 33 | | 70 | 71 | + * ,------+------+------| |------+------+------. + * | | | 34 | | 72 | | | + * | 35 | 36 |------| |------| 74 | 75 | + * | | | 37 | | 73 | | | + * `--------------------' `--------------------' + */ +""" + KEY_COORDINATES = { + 'LAYOUT_ergodox': [ + # left hand + (0,0), (0,1), (0,2), (0,3), (0,4), (0,5), (0,6), + (1,0), (1,1), (1,2), (1,3), (1,4), (1,5), (1,6), + (2,0), (2,1), (2,2), (2,3), (2,4), (2,5), + (3,0), (3,1), (3,2), (3,3), (3,4), (3,5), (3,6), + (4,0), (4,1), (4,2), (4,3), (4,4), + # left thumb + (5,5), (5,6), + (6,6), + (7,4), (7,5), (7,6), + # right hand + (8,0), (8,1), (8,2), (8,3), (8,4), (8,5), (8,6), + (9,0), (9,1), (9,2), (9,3), (9,4), (9,5), (9,6), + (10,1), (10,2), (10,3), (10,4), (10,5), (10,6), + (11,0), (11,1), (11,2), (11,3), (11,4), (11,5), (11,6), + (12,2), (12,3), (12,4), (12,5), (12,6), + # right thumb + (13,0), (13,1), + (14,0), + (15,0), (15,1), (15,2) + ], + 'LAYOUT_ergodox_pretty': [ + # left hand and right hand + (0,0), (0,1), (0,2), (0,3), (0,4), (0,5), (0,6), (0,7), (0,8), (0,9), (0,10), (0,11), (0,12), (0,13), + (1,0), (1,1), (1,2), (1,3), (1,4), (1,5), (1,6), (1,7), (1,8), (1,9), (1,10), (1,11), (1,12), (1,13), + (2,0), (2,1), (2,2), (2,3), (2,4), (2,5), (2,8), (2,9), (2,10), (2,11), (2,12), (2,13), + (3,0), (3,1), (3,2), (3,3), (3,4), (3,5), (3,6), (3,7), (3,8), (3,9), (3,10), (3,11), (3,12), (3,13), + (4,0), (4,1), (4,2), (4,3), (4,4), (4,9), (4,10), (4,11), (4,12), (4,13), + + # left thumb and right thumb + (5,5), (5,6), (5,7), (5,8), + (6,6), (6,7), + (7,4), (7,5), (7,6), (7,7), (7,8), (7,9) + ], + } + current_converted_KEY_COORDINATES = [] + + # each column is aligned within each group (tuples of row indexes are inclusive) + KEY_ROW_GROUPS = { + 'LAYOUT_ergodox': [(0,4),(5,7),(8,12),(13,15)], + 'LAYOUT_ergodox_pretty': [(0,7)], + #'LAYOUT_ergodox_pretty': [(0,5),(6,7)], + #'LAYOUT_ergodox_pretty': [(0,3),(4,4),(5,7)], + #'LAYOUT_ergodox_pretty': [(0,4),(5,7)], + } + + + INDEX_CONVERSTION_LAYOUT_ergodox_pretty_to_LAYOUT_ergodox = [ + 0, 1, 2, 3, 4, 5, 6, 38,39,40,41,42,43,44, + 7, 8, 9,10,11,12,13, 45,46,47,48,49,50,51, + 14,15,16,17,18,19, 52,53,54,55,56,57, + 20,21,22,23,24,25,26, 58,59,60,61,62,63,64, + 27,28,29,30,31, 65,66,67,68,69, + 32,33, 70,71, + 34, 72, + 35,36,37, 73,74,75, + ] + + + def index_conversion_map_reversed(self, conversion_map): + return [conversion_map.index(i) for i in range(len(conversion_map))] + + + def __init__(self, source_code = "", output_layout="LAYOUT_ergodox", justify_toward_center = False): + self.output_layout = output_layout + self.justify_toward_center = justify_toward_center + # determine the conversion map + #if input_layout == self.output_layout: + # conversion_map = [i for i in range(len(self.INDEX_CONVERSTION_LAYOUT_ergodox_pretty_to_LAYOUT_ergodox))] + #conversion_map = self.INDEX_CONVERSTION_LAYOUT_ergodox_pretty_to_LAYOUT_ergodox + if self.output_layout == "LAYOUT_ergodox_pretty": + index_conversion_map = self.index_conversion_map_reversed(self.INDEX_CONVERSTION_LAYOUT_ergodox_pretty_to_LAYOUT_ergodox) + else: + index_conversion_map = list(range(len(self.INDEX_CONVERSTION_LAYOUT_ergodox_pretty_to_LAYOUT_ergodox))) + self.current_converted_KEY_COORDINATES = [ + self.KEY_COORDINATES[self.output_layout][index_conversion_map[i]] + for i in range(len(self.KEY_COORDINATES[self.output_layout])) + ] + + self.output = self.beautify_source_code(source_code) + + def beautify_source_code(self, source_code): + # to keep it simple for the parser, we only use the parser to parse the key definition part + src = { + "before": [], + "keys": [], + "after": [], + } + + current_section = "before" + for line in source_code.splitlines(True): + if current_section == 'before' and line == self.KEYMAP_START: + src[current_section].append("\n") + current_section = 'keys' + src[current_section].append(self.KEYMAP_START_REPLACEMENT) + continue + elif current_section == 'keys' and line == self.KEYMAP_END: + src[current_section].append(self.KEYMAP_END) + current_section = 'after' + continue + src[current_section].append(line) + output_lines = src['before'] + self.beautify_keys_section("".join(src['keys'])) + src['after'] + return "".join(output_lines) + + def beautify_keys_section(self, src): + parsed = self.parser(src) + layer_output = [] + + keymap = parsed.children()[0] + layers = keymap[1] + for layer in layers.init.exprs: + input_layout = layer.expr.name.name + + key_symbols = self.layer_expr(layer) + # re-order keys from input_layout to regular layout + if input_layout == "LAYOUT_ergodox_pretty": + key_symbols = [key_symbols[i] for i in self.index_conversion_map_reversed(self.INDEX_CONVERSTION_LAYOUT_ergodox_pretty_to_LAYOUT_ergodox)] + + padded_key_symbols = self.pad_key_symbols(key_symbols, input_layout) + current_pretty_output_layer = self.pretty_output_layer(layer.name[0].value, padded_key_symbols) + # strip trailing spaces from padding + layer_output.append(re.sub(r" +\n", "\n", current_pretty_output_layer)) + + return [self.KEYMAP_START + "\n", + self.KEY_CHART + "\n", + ",\n\n".join(layer_output) + "\n", + self.KEYMAP_END + "\n"] + + def get_row_group(self, row): + for low, high in self.KEY_ROW_GROUPS[self.output_layout]: + if low <= row <= high: + return (low, high) + raise Exception("Cannot find row groups in KEY_ROW_GROUPS") + + + def calculate_column_max_widths(self, key_symbols): + # calculate the max width for each column + self.column_max_widths = {} + for i in range(len(key_symbols)): + row_index, column_index = self.current_converted_KEY_COORDINATES[i] + row_group = self.get_row_group(row_index) + if (row_group, column_index) in self.column_max_widths: + self.column_max_widths[(row_group, column_index)] = max(self.column_max_widths[(row_group, column_index)], len(key_symbols[i])) + else: + self.column_max_widths[(row_group, column_index)] = len(key_symbols[i]) + + + def pad_key_symbols(self, key_symbols, input_layout, just='left'): + self.calculate_column_max_widths(key_symbols) + + padded_key_symbols = [] + # pad each key symbol + for i in range(len(key_symbols)): + key = key_symbols[i] + # look up column coordinate to determine number of spaces to pad + row_index, column_index = self.current_converted_KEY_COORDINATES[i] + row_group = self.get_row_group(row_index) + if just == 'left': + padded_key_symbols.append(key.ljust(self.column_max_widths[(row_group, column_index)])) + else: + padded_key_symbols.append(key.rjust(self.column_max_widths[(row_group, column_index)])) + return padded_key_symbols + + + layer_keys_pointer = 0 + layer_keys = None + def grab_next_n_columns(self, n_columns, input_layout, layer_keys = None, from_beginning = False): + if layer_keys: + self.layer_keys = layer_keys + if from_beginning: + self.layer_keys_pointer = 0 + + begin = self.layer_keys_pointer + end = begin + n_columns + return self.layer_keys[self.layer_keys_pointer-n_keys:self.layer_keys_pointer] + + key_coordinates_counter = 0 + def get_padded_line(self, source_keys, key_from, key_to, just="left"): + if just == "right": + keys = [k.strip().rjust(len(k)) for k in source_keys[key_from:key_to]] + else: + keys = [k for k in source_keys[key_from:key_to]] + + from_row, from_column = self.KEY_COORDINATES[self.output_layout][self.key_coordinates_counter] + row_group = self.get_row_group(from_row) + self.key_coordinates_counter += key_to - key_from + columns_before_key_from = sorted([col for row, col in self.KEY_COORDINATES[self.output_layout] if row == from_row and col < from_column]) + # figure out which columns in this row needs padding; only pad empty columns to the right of an existing column + columns_to_pad = { c: True for c in range(from_column) } + if columns_before_key_from: + for c in range(max(columns_before_key_from)+1): + columns_to_pad[c] = False + + # for rows with fewer columns that don't start with column 0, we need to insert leading spaces + spaces = 0 + for c, v in columns_to_pad.items(): + if not v: + continue + if (row_group,c) in self.column_max_widths: + spaces += self.column_max_widths[(row_group,c)] + len(", ") + else: + spaces += 0 + return " " * spaces + ", ".join(keys) + "," + + def pretty_output_layer(self, layer, keys): + self.key_coordinates_counter = 0 + if self.output_layout == "LAYOUT_ergodox": + formatted_key_symbols = """ +// left hand + +{} +{} +{} +{} +{} + +// left thumb + +{} +{} +{} + +// right hand + +{} +{} +{} +{} +{} + +// right thumb + +{} +{} +{} +""".format( + # left hand + self.get_padded_line(keys, 0, 7, just="left"), + self.get_padded_line(keys, 7, 14, just="left"), + self.get_padded_line(keys, 14, 20, just="left"), + self.get_padded_line(keys, 20, 27, just="left"), + self.get_padded_line(keys, 27, 32, just="left"), + # left thumb + self.get_padded_line(keys, 32, 34, just="left"), + self.get_padded_line(keys, 34, 35, just="left"), + self.get_padded_line(keys, 35, 38, just="left"), + # right hand + self.get_padded_line(keys, 38, 45, just="left"), + self.get_padded_line(keys, 45, 52, just="left"), + self.get_padded_line(keys, 52, 58, just="left"), + self.get_padded_line(keys, 58, 65, just="left"), + self.get_padded_line(keys, 65, 70, just="left"), + # right thumb + self.get_padded_line(keys, 70, 72, just="left"), + self.get_padded_line(keys, 72, 73, just="left"), + self.get_padded_line(keys, 73, 76, just="left"), + ) + elif self.output_layout == "LAYOUT_ergodox_pretty": + left_half_justification = "right" if self.justify_toward_center else "left" + formatted_key_symbols = """ +{} {} +{} {} +{} {} +{} {} +{} {} + +{} {} +{} {} +{} {} +""".format( + self.get_padded_line(keys, 0, 7, just=left_half_justification), self.get_padded_line(keys, 38, 45, just="left"), + self.get_padded_line(keys, 7, 14, just=left_half_justification), self.get_padded_line(keys, 45, 52, just="left"), + self.get_padded_line(keys, 14, 20, just=left_half_justification), self.get_padded_line(keys, 52, 58, just="left"), + self.get_padded_line(keys, 20, 27, just=left_half_justification), self.get_padded_line(keys, 58, 65, just="left"), + self.get_padded_line(keys, 27, 32, just=left_half_justification), self.get_padded_line(keys, 65, 70, just="left"), + + self.get_padded_line(keys, 32, 34, just=left_half_justification), self.get_padded_line(keys, 70, 72, just="left"), + self.get_padded_line(keys, 34, 35, just=left_half_justification), self.get_padded_line(keys, 72, 73, just="left"), + self.get_padded_line(keys, 35, 38, just=left_half_justification), self.get_padded_line(keys, 73, 76, just="left"), + + ) + else: + formatted_key_symbols = "" + + # rid of the trailing comma + formatted_key_symbols = formatted_key_symbols[0:len(formatted_key_symbols)-2] + "\n" + s = "[{}] = {}({})".format(layer, self.output_layout, formatted_key_symbols) + return s + + # helper functions for pycparser + def parser(self, src): + src = self.comment_remover(src) + return pycparser.CParser().parse(src) + def comment_remover(self, text): + # remove comments since pycparser cannot deal with them + # credit: https://stackoverflow.com/a/241506 + def replacer(match): + s = match.group(0) + if s.startswith('/'): + return " " # note: a space and not an empty string + else: + return s + pattern = re.compile( + r'//.*?$|/\*.*?\*/|\'(?:\\.|[^\\\'])*\'|"(?:\\.|[^\\"])*"', + re.DOTALL | re.MULTILINE + ) + return re.sub(pattern, replacer, text) + + def function_expr(self, f): + name = f.name.name + args = [] + for arg in f.args.exprs: + if type(arg) is pycparser.c_ast.Constant: + args.append(arg.value) + elif type(arg) is pycparser.c_ast.ID: + args.append(arg.name) + return "{}({})".format(name, ",".join(args)) + + def key_expr(self, raw): + if type(raw) is pycparser.c_ast.ID: + if raw.name in self.KEY_ALIASES: + return self.KEY_ALIASES[raw.name] + return raw.name + elif type(raw) is pycparser.c_ast.FuncCall: + return self.function_expr(raw) + + def layer_expr(self, layer): + transformed = [self.key_expr(k) for k in layer.expr.args.exprs] + return transformed + + +if __name__ == "__main__": + + parser = argparse.ArgumentParser(description="Beautify keymap.c downloaded from ErgoDox-Ez Configurator for easier customization.") + parser.add_argument("input_filename", help="input file: c source code file that has the layer keymaps") + parser.add_argument("-o", "--output-filename", help="output file: beautified c filename. If not given, output to STDOUT.") + parser.add_argument("-p", "--pretty-output-layout", action="store_true", help="use LAYOUT_ergodox_pretty for output instead of LAYOUT_ergodox") + parser.add_argument("-c", "--justify-toward-center", action="store_true", help="for LAYOUT_ergodox_pretty, align right for the left half, and align left for the right half. Default is align left for both halves.") + args = parser.parse_args() + if args.pretty_output_layout: + output_layout="LAYOUT_ergodox_pretty" + else: + output_layout="LAYOUT_ergodox" + with open(args.input_filename) as f: + source_code = f.read() + result = KeymapBeautifier(source_code, output_layout=output_layout, justify_toward_center=args.justify_toward_center).output + if args.output_filename: + with open(args.output_filename, "w") as f: + f.write(result) + else: + print(result) + diff --git a/keyboards/ergodox_ez/util/keymap_beautifier/README.md b/keyboards/ergodox_ez/util/keymap_beautifier/README.md new file mode 100644 index 0000000000..bd3d125a6d --- /dev/null +++ b/keyboards/ergodox_ez/util/keymap_beautifier/README.md @@ -0,0 +1,139 @@ +# keymap_beautifier.py + +## About +This Python 3 script, by [Tsan-Kuang Lee](https://github.com/tsankuanglee) takes the keymap.c downloaded from [ErgoDox EZ Configurator](https://configure.ergodox-ez.com/) and beautifies it for easier customization, allowing one to quickly draft a layout to build upon. + +## Features +For example, the original `keymap.c` looks like + +``` +[0] = LAYOUT_ergodox(KC_EQUAL,KC_1,KC_2,KC_3,KC_4,KC_5,LCTL(KC_MINUS),KC_DELETE,KC_Q,KC_W,KC_E,KC_R,KC_T,KC_LBRACKET,KC_BSPACE,KC_A,KC_S,KC_D,KC_F,KC_G,KC_LSPO,CTL_T(KC_Z),KC_X,KC_C,KC_V,KC_B,ALL_T(KC_NO),LT(1,KC_GRAVE),KC_QUOTE,LALT(KC_LSHIFT),KC_LEFT,KC_RIGHT,ALT_T(KC_APPLICATION),KC_LGUI,KC_HOME,KC_SPACE,KC_UNDS,KC_END,LCTL(KC_EQUAL),KC_6,KC_7,KC_8,KC_9,KC_0,KC_MINUS,KC_RBRACKET,KC_Y,KC_U,KC_I,KC_O,KC_P,KC_BSLASH,KC_H,ALT_T(KC_J),KC_K,KC_L,LT(2,KC_SCOLON),GUI_T(KC_QUOTE),MEH_T(KC_NO),KC_N,KC_M,KC_COMMA,KC_DOT,CTL_T(KC_SLASH),KC_RSPC,KC_UP,KC_DOWN,KC_LBRACKET,KC_RBRACKET,TT(1),KC_LALT,CTL_T(KC_ESCAPE),KC_PGUP,KC_PGDOWN,LT(1,KC_TAB),KC_ENTER), +``` + +The beautifier parses it and outputs: + +``` +[0] = LAYOUT_ergodox( +// left hand + +KC_EQUAL , KC_1 , KC_2 , KC_3 , KC_4 , KC_5, LCTL(KC_MINUS), +KC_DELETE , KC_Q , KC_W , KC_E , KC_R , KC_T, KC_LBRACKET , +KC_BSPACE , KC_A , KC_S , KC_D , KC_F , KC_G, +KC_LSPO , CTL_T(KC_Z), KC_X , KC_C , KC_V , KC_B, ALL_T(KC_NO) , +LT(1,KC_GRAVE), KC_QUOTE , LALT(KC_LSHIFT), KC_LEFT, KC_RIGHT, + +// left thumb + + ALT_T(KC_APPLICATION), KC_LGUI, + KC_HOME, +KC_SPACE, KC_UNDS , KC_END , + +// right hand + +LCTL(KC_EQUAL), KC_6, KC_7 , KC_8 , KC_9 , KC_0 , KC_MINUS , +KC_RBRACKET , KC_Y, KC_U , KC_I , KC_O , KC_P , KC_BSLASH , + KC_H, ALT_T(KC_J), KC_K , KC_L , LT(2,KC_SCOLON), GUI_T(KC_QUOTE), +MEH_T(KC_NO) , KC_N, KC_M , KC_COMMA, KC_DOT , CTL_T(KC_SLASH), KC_RSPC , + KC_UP , KC_DOWN , KC_LBRACKET, KC_RBRACKET , TT(1) , + +// right thumb + +KC_LALT , CTL_T(KC_ESCAPE), +KC_PGUP , +KC_PGDOWN, LT(1,KC_TAB) , KC_ENTER +) +``` + +Optionally, it can also render [LAYOUT_ergodox_pretty](https://github.com/qmk/qmk_firmware/blob/ee700b2e831067bdb7584425569b61bc6329247b/keyboards/ergodox_ez/keymaps/bpruitt-goddard/keymap.c#L49-L57): +``` +[0] = LAYOUT_ergodox_pretty( + KC_ESCAPE, KC_1, KC_2, KC_3, KC_4, KC_5, KC_LEAD, KC_LEAD, KC_6 , KC_7 , KC_8 , KC_9 , KC_0 , KC_BSPACE , + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_HYPR, KC_HYPR, KC_Y , KC_U , KC_I , KC_O , KC_P , KC_BSLASH , + KC_LCTRL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H , KC_J , KC_K , KC_L , KC_SCOLON , KC_QUOTE , + KC_LSHIFT, KC_Z, KC_X, KC_C, KC_V, KC_B, SH_MON, SH_MON , KC_N , KC_M , KC_COMMA , KC_DOT , KC_SLASH , KC_RSHIFT , +LT(6,KC_NO), LT(7,KC_NO), KC_LCTRL, KC_LGUI, KC_LALT, ALGR_T(KC_MINUS), RGUI_T(KC_EQUAL), RCTL_T(KC_LBRACKET), LT(10,KC_RBRACKET), LT(6,KC_APPLICATION), + + LT(6,KC_GRAVE), MEH_T(KC_NO), KC_LEFT, KC_RIGHT , + LT(10,KC_DELETE), KC_UP , + KC_SPACE, LT(8,KC_ENTER), LT(7,KC_BSPACE), KC_DOWN, LT(7,KC_SPACE), LT(8,KC_ENTER) +) +``` + +We can also align everythng t othe left (easier editing in my opinon): +``` +[0] = LAYOUT_ergodox_pretty( +KC_ESCAPE , KC_1 , KC_2 , KC_3 , KC_4 , KC_5 , KC_LEAD , KC_LEAD, KC_6 , KC_7 , KC_8 , KC_9 , KC_0 , KC_BSPACE , +KC_TAB , KC_Q , KC_W , KC_E , KC_R , KC_T , KC_HYPR , KC_HYPR, KC_Y , KC_U , KC_I , KC_O , KC_P , KC_BSLASH , +KC_LCTRL , KC_A , KC_S , KC_D , KC_F , KC_G , KC_H , KC_J , KC_K , KC_L , KC_SCOLON , KC_QUOTE , +KC_LSHIFT , KC_Z , KC_X , KC_C , KC_V , KC_B , SH_MON , SH_MON , KC_N , KC_M , KC_COMMA , KC_DOT , KC_SLASH , KC_RSHIFT , +LT(6,KC_NO), LT(7,KC_NO), KC_LCTRL, KC_LGUI, KC_LALT , ALGR_T(KC_MINUS), RGUI_T(KC_EQUAL), RCTL_T(KC_LBRACKET), LT(10,KC_RBRACKET), LT(6,KC_APPLICATION), + + LT(6,KC_GRAVE), MEH_T(KC_NO) , KC_LEFT, KC_RIGHT , + LT(10,KC_DELETE), KC_UP , + KC_SPACE, LT(8,KC_ENTER), LT(7,KC_BSPACE) , KC_DOWN, LT(7,KC_SPACE), LT(8,KC_ENTER) +) +``` + +## Usage + +### With docker +This is the cleaner way. `Docker` is the only requirement. The program executes within a container that has all dependencies installed. + +First build the images. (Run once) +``` +cd QMK_GIT_REPO_dir/keyboards/ergodox_ez/util/keymap_beautifier +docker build -t keymapbeautifier:1.0 . +``` +Run it +``` +cd QMK_GIT_REPO_dir/keyboards/ergodox_ez/util/keymap_beautifier +cp PATH_TO_YOUR_C_SOURCE_FILE.c input.c +./docker_run.sh input.c -p -c -o output.c +``` +The prettified file is written to `output.c`. See the section Tweaks for non-default settings. + +### Without docker +Requirements: +* python3 (tested on 3.7.4) +* python module `pycparser` installed (with `pip install pycparser`) + +To run: +``` +cd QMK_GIT_REPO_dir/keyboards/ergodox_ez/util/keymap_beautifier +cp PATH_TO_YOUR_C_SOURCE_FILE.c input.c +./KeymapBeautifier.py input.c -p -c -o output.c +``` +The prettified file is written to `output.c`. See the section Tweaks for non-default settings. + +## Tweaks +``` +usage: KeymapBeautifier.py [-h] [-o OUTPUT_FILENAME] [-p] [-c] input_filename + +Beautify keymap.c downloaded from ErgoDox-Ez Configurator for easier +customization. + +positional arguments: + input_filename input file: c source code file that has the layer + keymaps + +optional arguments: + -h, --help show this help message and exit + -o OUTPUT_FILENAME, --output-filename OUTPUT_FILENAME + output file: beautified c filename. If not given, + output to STDOUT. + -p, --pretty-output-layout + use LAYOUT_ergodox_pretty for output instead of + LAYOUT_ergodox + -c, --justify-toward-center + for LAYOUT_ergodox_pretty, align right for the left + half, and align left for the right half. Default is + align left for both halves. +``` +For example, +``` +./docker_run.sh input.c -p -c -o output.c +# or if you don't want to use docker: +#./KeymapBeautifier.py input.c -p -c -o output.c +``` +will read `input.c`, and produce `output.c` with LAYOUT_ergodox_pretty, and have the key symbols gravitating toward the center. + diff --git a/keyboards/ergodox_ez/util/keymap_beautifier/docker_run.sh b/keyboards/ergodox_ez/util/keymap_beautifier/docker_run.sh new file mode 100755 index 0000000000..1ce43a6dde --- /dev/null +++ b/keyboards/ergodox_ez/util/keymap_beautifier/docker_run.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +docker run --mount type=bind,source="${PWD}",target=/usr/src/app --name keymapbeautifier --rm keymapbeautifier:1.0 ./KeymapBeautifier.py $* diff --git a/keyboards/ergodox_ez/util/keymap_beautifier/requirements.txt b/keyboards/ergodox_ez/util/keymap_beautifier/requirements.txt new file mode 100644 index 0000000000..dc1c9e101a --- /dev/null +++ b/keyboards/ergodox_ez/util/keymap_beautifier/requirements.txt @@ -0,0 +1 @@ +pycparser diff --git a/keyboards/ergodox_ez/util/readme.md b/keyboards/ergodox_ez/util/readme.md index 26c5e5d99c..deb0cad5db 100644 --- a/keyboards/ergodox_ez/util/readme.md +++ b/keyboards/ergodox_ez/util/readme.md @@ -1,3 +1,11 @@ # ErgoDox EZ Utilities +## compile_keymap.py + The Python script in this directory, by [mbarkhau](https://github.com/mbarkhau) allows you to write out a basic ErgoDox EZ keymap using Markdown notation, and then transpile it to C, which you can then compile. It's experimental, but if you're not comfortable using C, it's a nice option. + +## keymap_beautifier.py + +This Python 3 script, by [Tsan-Kuang Lee](https://github.com/tsankuanglee) takes the keymap.c downloaded from [ErgoDox EZ Configurator](https://configure.ergodox-ez.com/) and beautifies it for easier customization, allowing one to quickly draft a layout to build upon. + +See [README.md](./keymap_beautifier/README.md) for this utility for more details. |