From 0e11b511e4a3c48a67de6414b0907ec26dfcdf49 Mon Sep 17 00:00:00 2001 From: Joel Challis Date: Tue, 31 May 2022 03:08:56 +0100 Subject: Convert ergodone to use core mcp23018 driver (#17005) --- keyboards/ktec/ergodone/config.h | 77 +--- keyboards/ktec/ergodone/ergodone.c | 57 +-- keyboards/ktec/ergodone/ergodone.h | 158 +-------- keyboards/ktec/ergodone/ergodox_compat.h | 94 +++++ keyboards/ktec/ergodone/expander.c | 104 ------ keyboards/ktec/ergodone/expander.h | 45 --- keyboards/ktec/ergodone/info.json | 428 ++++++++++++++++++----- keyboards/ktec/ergodone/keymaps/default/keymap.c | 38 +- keyboards/ktec/ergodone/keymaps/via/config.h | 18 - keyboards/ktec/ergodone/keymaps/via/readme.md | 5 - keyboards/ktec/ergodone/matrix.c | 388 ++++++++++---------- keyboards/ktec/ergodone/rules.mk | 30 +- 12 files changed, 653 insertions(+), 789 deletions(-) create mode 100644 keyboards/ktec/ergodone/ergodox_compat.h delete mode 100644 keyboards/ktec/ergodone/expander.c delete mode 100644 keyboards/ktec/ergodone/expander.h delete mode 100644 keyboards/ktec/ergodone/keymaps/via/config.h delete mode 100644 keyboards/ktec/ergodone/keymaps/via/readme.md diff --git a/keyboards/ktec/ergodone/config.h b/keyboards/ktec/ergodone/config.h index ee51e4c055..afe1512aa4 100644 --- a/keyboards/ktec/ergodone/config.h +++ b/keyboards/ktec/ergodone/config.h @@ -1,77 +1,8 @@ -#pragma once - -#include "config_common.h" +// Copyright 2022 QMK +// SPDX-License-Identifier: GPL-2.0-or-later -/* USB Device descriptor parameter */ -#define VENDOR_ID 0x1209 -#define PRODUCT_ID 0x2328 -// The official ErgoDone VID and PID are documented at http://pid.codes/1209/2328/. -#define DEVICE_VER 0x0001 -#define MANUFACTURER K.T.E.C. -#define PRODUCT ErgoDone +#pragma once -/* key matrix size */ +// TODO: handle matrix_size.cols and matrix_size.rows for custom matrix #define MATRIX_ROWS 6 #define MATRIX_COLS 14 - -#define MOUSEKEY_INTERVAL 20 -#define MOUSEKEY_DELAY 0 -#define MOUSEKEY_TIME_TO_MAX 60 -#define MOUSEKEY_MAX_SPEED 7 -#define MOUSEKEY_WHEEL_DELAY 0 - -#define TAPPING_TOGGLE 1 - -/* define if matrix has ghost */ -//#define MATRIX_HAS_GHOST - -#define TAPPING_TERM 200 -#define IGNORE_MOD_TAP_INTERRUPT // this makes it possible to do rolling combos (zx) with keys that convert to other keys on hold (z becomes ctrl when you hold it, and when this option isn't enabled, z rapidly followed by x actually sends Ctrl-x. That's bad.) - -/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ -#define LOCKING_SUPPORT_ENABLE -/* Locking resynchronize hack */ -#define LOCKING_RESYNC_ENABLE - -/* key combination for command */ -#define IS_COMMAND() ( \ - get_mods() == (MOD_BIT(KC_LCTL) | MOD_BIT(KC_RCTL)) || \ - get_mods() == (MOD_BIT(KC_LSFT) | MOD_BIT(KC_RSFT)) \ -) - -/* number of backlight levels */ -#define BACKLIGHT_LEVELS 3 - -#define LED_BRIGHTNESS_LO 15 -#define LED_BRIGHTNESS_HI 255 - -/* fix space cadet rollover issue */ -#define DISABLE_SPACE_CADET_ROLLOVER - -/* Set 0 if debouncing isn't needed */ -#define DEBOUNCE 5 - -#define USB_MAX_POWER_CONSUMPTION 500 - -/* NKRO */ -#ifndef FORCE_NKRO - #define FORCE_NKRO // Depends on NKRO_ENABLE. -#endif - -/* - * Feature disable options - * These options are also useful to firmware size reduction. - */ - -/* disable debug print */ -// #define NO_DEBUG - -/* disable print */ -// #define NO_PRINT - -/* disable action features */ -//#define NO_ACTION_LAYER -//#define NO_ACTION_TAPPING -//#define NO_ACTION_ONESHOT - -//#define DEBUG_MATRIX_SCAN_RATE diff --git a/keyboards/ktec/ergodone/ergodone.c b/keyboards/ktec/ergodone/ergodone.c index e0579408e5..53ff8c9844 100644 --- a/keyboards/ktec/ergodone/ergodone.c +++ b/keyboards/ktec/ergodone/ergodone.c @@ -1,54 +1,11 @@ -#include "ergodone.h" - -extern inline void ergodox_board_led_on(void); -extern inline void ergodox_right_led_1_on(void); -extern inline void ergodox_right_led_2_on(void); -extern inline void ergodox_right_led_3_on(void); -extern inline void ergodox_right_led_on(uint8_t led); - -extern inline void ergodox_board_led_off(void); -extern inline void ergodox_right_led_1_off(void); -extern inline void ergodox_right_led_2_off(void); -extern inline void ergodox_right_led_3_off(void); -extern inline void ergodox_right_led_off(uint8_t led); - -extern inline void ergodox_led_all_off(void); +// Copyright 2022 QMK +// SPDX-License-Identifier: GPL-2.0-or-later -void ergodox_led_init(void); -void ergodox_blink_all_leds(void); - -void matrix_init_kb(void) { - ergodox_led_init(); - ergodox_blink_all_leds(); - matrix_init_user(); -} +#include "ergodone.h" -void ergodox_led_init(void) - { - DDRB |= (1< -#include - -void init_ergodox(void); - -inline void ergodox_right_led_1_off(void) { DDRB &= ~(1< +#include "gpio.h" +#include "wait.h" + +// All this for ergodox led compatibility... +#ifdef CONVERT_TO_PROTON_C +# define ERGODOX_BOARD_LED_ON_STATE 1 +#else +# define ERGODOX_BOARD_LED_ON_STATE 0 +#endif +#define LED_BRIGHTNESS_LO 15 +#define LED_BRIGHTNESS_HI 255 +static inline void ergodox_right_led_1_off(void) { setPinOutput(LED_NUM_LOCK_PIN); writePin(LED_NUM_LOCK_PIN, 0); } +static inline void ergodox_right_led_1_on(void) { setPinOutput(LED_NUM_LOCK_PIN); writePin(LED_NUM_LOCK_PIN, 1); } +static inline void ergodox_right_led_2_off(void) { setPinOutput(LED_CAPS_LOCK_PIN); writePin(LED_CAPS_LOCK_PIN, 0); } +static inline void ergodox_right_led_2_on(void) { setPinOutput(LED_CAPS_LOCK_PIN); writePin(LED_CAPS_LOCK_PIN, 1); } +static inline void ergodox_right_led_3_off(void) { setPinOutput(LED_SCROLL_LOCK_PIN); writePin(LED_SCROLL_LOCK_PIN, 0); } +static inline void ergodox_right_led_3_on(void) { setPinOutput(LED_SCROLL_LOCK_PIN); writePin(LED_SCROLL_LOCK_PIN, 1); } +static inline void ergodox_right_led_on(uint8_t l) { + switch (l) { + case 1: + ergodox_right_led_1_on(); + break; + case 2: + ergodox_right_led_2_on(); + break; + case 3: + ergodox_right_led_3_on(); + break; + default: + break; + } +} +static inline void ergodox_right_led_off(uint8_t l) { + switch (l) { + case 1: + ergodox_right_led_1_off(); + break; + case 2: + ergodox_right_led_2_off(); + break; + case 3: + ergodox_right_led_3_off(); + break; + default: + break; + } +} +static inline void ergodox_board_led_off(void) { setPinOutput(D5); writePin(D5, !ERGODOX_BOARD_LED_ON_STATE); } +static inline void ergodox_board_led_on(void) { setPinOutput(D5); writePin(D5, ERGODOX_BOARD_LED_ON_STATE); } +static inline void ergodox_led_all_on(void) { + ergodox_right_led_1_on(); + ergodox_right_led_2_on(); + ergodox_right_led_3_on(); + ergodox_board_led_on(); +} +static inline void ergodox_led_all_off(void) { + ergodox_right_led_1_off(); + ergodox_right_led_2_off(); + ergodox_right_led_3_off(); + ergodox_board_led_off(); +} +static inline void ergodox_right_led_1_set(uint8_t n) {} +static inline void ergodox_right_led_2_set(uint8_t n) {} +static inline void ergodox_right_led_3_set(uint8_t n) {} +static inline void ergodox_right_led_set(uint8_t l, uint8_t n) {} +static inline void ergodox_led_all_set(uint8_t n) {} +static inline void ergodox_led_init(void) {} +static inline void ergodox_blink_all_leds(void) { + ergodox_led_all_off(); + ergodox_board_led_on(); + wait_ms(50); + ergodox_right_led_1_on(); + wait_ms(50); + ergodox_right_led_2_on(); + wait_ms(50); + ergodox_right_led_3_on(); + wait_ms(50); + ergodox_right_led_1_off(); + wait_ms(50); + ergodox_right_led_2_off(); + wait_ms(50); + ergodox_right_led_3_off(); + wait_ms(50); + ergodox_board_led_off(); + //ergodox_led_all_on(); + //wait_ms(333); + ergodox_led_all_off(); +} \ No newline at end of file diff --git a/keyboards/ktec/ergodone/expander.c b/keyboards/ktec/ergodone/expander.c deleted file mode 100644 index a4d48e9edb..0000000000 --- a/keyboards/ktec/ergodone/expander.c +++ /dev/null @@ -1,104 +0,0 @@ -#include -#include "action.h" -#include "i2c_master.h" -#include "expander.h" -#include "debug.h" - -#define I2C_TIMEOUT 100 - -static uint8_t expander_status = 0; -static uint8_t expander_input = 0; - -void expander_config(void); -uint8_t expander_write(uint8_t reg, uint8_t data); -uint8_t expander_read(uint8_t reg, uint8_t *data); - -void expander_init(void) -{ - i2c_init(); - expander_scan(); -} - -void expander_scan(void) -{ - dprintf("expander status: %d ... ", expander_status); - uint8_t ret = i2c_start(EXPANDER_ADDR | I2C_WRITE, I2C_TIMEOUT); - if (ret == 0) { - i2c_stop(); - if (expander_status == 0) { - dprintf("attached\n"); - expander_status = 1; - expander_config(); - clear_keyboard(); - } - } - else { - if (expander_status == 1) { - dprintf("detached\n"); - expander_status = 0; - clear_keyboard(); - } - } - dprintf("%d\n", expander_status); -} - -void expander_read_cols(void) -{ - expander_read(EXPANDER_REG_GPIOA, &expander_input); -} - -uint8_t expander_get_col(uint8_t col) -{ - if (col > 4) { - col++; - } - return expander_input & (1< -#include "matrix.h" - -#define MCP23017 -#define MCP23017_A0 0 -#define MCP23017_A1 0 -#define MCP23017_A2 0 - -#ifdef MCP23017 -#define EXPANDER_ADDR ((0x20|(MCP23017_A0<<0)|(MCP23017_A1<<1)|(MCP23017_A2<<2)) << 1) -enum EXPANDER_REG_BANK0 { - EXPANDER_REG_IODIRA = 0, - EXPANDER_REG_IODIRB, - EXPANDER_REG_IPOLA, - EXPANDER_REG_IPOLB, - EXPANDER_REG_GPINTENA, - EXPANDER_REG_GPINTENB, - EXPANDER_REG_DEFVALA, - EXPANDER_REG_DEFVALB, - EXPANDER_REG_INTCONA, - EXPANDER_REG_INTCONB, - EXPANDER_REG_IOCONA, - EXPANDER_REG_IOCONB, - EXPANDER_REG_GPPUA, - EXPANDER_REG_GPPUB, - EXPANDER_REG_INTFA, - EXPANDER_REG_INTFB, - EXPANDER_REG_INTCAPA, - EXPANDER_REG_INTCAPB, - EXPANDER_REG_GPIOA, - EXPANDER_REG_GPIOB, - EXPANDER_REG_OLATA, - EXPANDER_REG_OLATB -}; -#endif - -void expander_init(void); -void expander_scan(void); -void expander_read_cols(void); -uint8_t expander_get_col(uint8_t col); -matrix_row_t expander_read_row(void); -void expander_unselect_rows(void); -void expander_select_row(uint8_t row); diff --git a/keyboards/ktec/ergodone/info.json b/keyboards/ktec/ergodone/info.json index e8f8b2bc89..e2b2d4305a 100644 --- a/keyboards/ktec/ergodone/info.json +++ b/keyboards/ktec/ergodone/info.json @@ -1,104 +1,354 @@ { "keyboard_name": "Ergodone", + "manufacturer": "K.T.E.C.", "maintainer": "Yu He", + "processor": "atmega32u4", + "bootloader": "caterina", + "usb": { + "vid": "0x1209", + "pid": "0x2328", + "device_version": "0.0.1" + }, + "features": { + "bootmagic": true, + "extrakey": true, + "mousekey": true, + "nkro": true + }, + "indicators": { + "num_lock": "B5", + "caps_lock": "B6", + "scroll_lock": "B3" + }, + "community_layouts": ["ergodox"], "layouts": { "LAYOUT_ergodox": { - "layout": [ - {"x":0, "y":0.375, "w":1.5}, {"x":1.5, "y":0.375}, {"x":2.5, "y":0.125}, {"x":3.5, "y":0}, {"x":4.5, "y":0.125}, {"x":5.5, "y":0.25}, {"x":6.5, "y":0.25}, - {"x":0, "y":1.375, "w":1.5}, {"x":1.5, "y":1.375}, {"x":2.5, "y":1.125}, {"x":3.5, "y":1}, {"x":4.5, "y":1.125}, {"x":5.5, "y":1.25}, {"x":6.5, "y":1.25, "h":1.5}, - {"x":0, "y":2.375, "w":1.5}, {"x":1.5, "y":2.375}, {"x":2.5, "y":2.125}, {"x":3.5, "y":2}, {"x":4.5, "y":2.125}, {"x":5.5, "y":2.25}, - {"x":0, "y":3.375, "w":1.5}, {"x":1.5, "y":3.375}, {"x":2.5, "y":3.125}, {"x":3.5, "y":3}, {"x":4.5, "y":3.125}, {"x":5.5, "y":3.25}, {"x":6.5, "y":2.75, "h":1.5}, - {"x":0.5, "y":4.375}, {"x":1.5, "y":4.375}, {"x":2.5, "y":4.125}, {"x":3.5, "y":4}, {"x":4.5, "y":4.125}, - - {"x":6, "y":5}, {"x":7, "y":5}, - {"x":7, "y":6}, - {"x":5, "y":6, "h":2}, {"x":6, "y":6, "h":2}, {"x":7, "y":7}, - - - {"x":9.5, "y":0.25}, {"x":10.5, "y":0.25}, {"x":11.5, "y":0.125}, {"x":12.5, "y":0}, {"x":13.5, "y":0.125}, {"x":14.5, "y":0.375}, {"x":15.5, "y":0.375, "w":1.5}, - {"x":9.5, "y":1.25, "h":1.5}, {"x":10.5, "y":1.25}, {"x":11.5, "y":1.125}, {"x":12.5, "y":1}, {"x":13.5, "y":1.125}, {"x":14.5, "y":1.375}, {"x":15.5, "y":1.375, "w":1.5}, - {"x":10.5, "y":2.25}, {"x":11.5, "y":2.125}, {"x":12.5, "y":2}, {"x":13.5, "y":2.125}, {"x":14.5, "y":2.375}, {"x":15.5, "y":2.375, "w":1.5}, - {"x":9.5, "y":2.75, "h":1.5}, {"x":10.5, "y":3.25}, {"x":11.5, "y":3.125}, {"x":12.5, "y":3}, {"x":13.5, "y":3.125}, {"x":14.5, "y":3.375}, {"x":15.5, "y":3.375, "w":1.5}, - {"x":11.5, "y":4.125}, {"x":12.5, "y":4}, {"x":13.5, "y":4.125}, {"x":14.5, "y":4.375}, {"x":15.5, "y":4.375}, - - - {"x":9, "y":5}, {"x":10, "y":5}, - {"x":9, "y":6}, - {"x":9, "y":7}, {"x":10, "y":6, "h":2}, {"x":11, "y":6, "h":2} + { "label": "k00", "matrix": [0, 0], "w": 1.5, "x": 0, "y": 0.375 }, + { "label": "k01", "matrix": [0, 1], "w": 1, "x": 1.5, "y": 0.375 }, + { "label": "k02", "matrix": [0, 2], "w": 1, "x": 2.5, "y": 0.125 }, + { "label": "k03", "matrix": [0, 3], "w": 1, "x": 3.5, "y": 0 }, + { "label": "k04", "matrix": [0, 4], "w": 1, "x": 4.5, "y": 0.125 }, + { "label": "k05", "matrix": [0, 5], "w": 1, "x": 5.5, "y": 0.25 }, + { "label": "k06", "matrix": [0, 6], "w": 1, "x": 6.5, "y": 0.25 }, + { "label": "k10", "matrix": [1, 0], "w": 1.5, "x": 0, "y": 1.375 }, + { "label": "k11", "matrix": [1, 1], "w": 1, "x": 1.5, "y": 1.375 }, + { "label": "k12", "matrix": [1, 2], "w": 1, "x": 2.5, "y": 1.125 }, + { "label": "k13", "matrix": [1, 3], "w": 1, "x": 3.5, "y": 1 }, + { "label": "k14", "matrix": [1, 4], "w": 1, "x": 4.5, "y": 1.125 }, + { "label": "k15", "matrix": [1, 5], "w": 1, "x": 5.5, "y": 1.25 }, + { "label": "k16", "matrix": [1, 6], "w": 1, "x": 6.5, "y": 1.25, "h": 1.5 }, + { "label": "k20", "matrix": [2, 0], "w": 1.5, "x": 0, "y": 2.375 }, + { "label": "k21", "matrix": [2, 1], "w": 1, "x": 1.5, "y": 2.375 }, + { "label": "k22", "matrix": [2, 2], "w": 1, "x": 2.5, "y": 2.125 }, + { "label": "k23", "matrix": [2, 3], "w": 1, "x": 3.5, "y": 2 }, + { "label": "k24", "matrix": [2, 4], "w": 1, "x": 4.5, "y": 2.125 }, + { "label": "k25", "matrix": [2, 5], "w": 1, "x": 5.5, "y": 2.25 }, + { "label": "k30", "matrix": [3, 0], "w": 1.5, "x": 0, "y": 3.375 }, + { "label": "k31", "matrix": [3, 1], "w": 1, "x": 1.5, "y": 3.375 }, + { "label": "k32", "matrix": [3, 2], "w": 1, "x": 2.5, "y": 3.125 }, + { "label": "k33", "matrix": [3, 3], "w": 1, "x": 3.5, "y": 3 }, + { "label": "k34", "matrix": [3, 4], "w": 1, "x": 4.5, "y": 3.125 }, + { "label": "k35", "matrix": [3, 5], "w": 1, "x": 5.5, "y": 3.25 }, + { "label": "k36", "matrix": [3, 6], "w": 1, "x": 6.5, "y": 2.75, "h": 1.5 }, + { "label": "k40", "matrix": [4, 0], "w": 1, "x": 0.5, "y": 4.375 }, + { "label": "k41", "matrix": [4, 1], "w": 1, "x": 1.5, "y": 4.375 }, + { "label": "k42", "matrix": [4, 2], "w": 1, "x": 2.5, "y": 4.125 }, + { "label": "k43", "matrix": [4, 3], "w": 1, "x": 3.5, "y": 4 }, + { "label": "k44", "matrix": [4, 4], "w": 1, "x": 4.5, "y": 4.125 }, + { "label": "k55", "matrix": [5, 5], "w": 1, "x": 6, "y": 5 }, + { "label": "k56", "matrix": [5, 6], "w": 1, "x": 7, "y": 5 }, + { "label": "k54", "matrix": [5, 4], "w": 1, "x": 7, "y": 6 }, + { "label": "k53", "matrix": [5, 3], "w": 1, "x": 5, "y": 6, "h": 2 }, + { "label": "k52", "matrix": [5, 2], "w": 1, "x": 6, "y": 6, "h": 2 }, + { "label": "k51", "matrix": [5, 1], "w": 1, "x": 7, "y": 7 }, + { "label": "k07", "matrix": [0, 7], "w": 1, "x": 9.5, "y": 0.25 }, + { "label": "k08", "matrix": [0, 8], "w": 1, "x": 10.5, "y": 0.25 }, + { "label": "k09", "matrix": [0, 9], "w": 1, "x": 11.5, "y": 0.125 }, + { "label": "k0A", "matrix": [0, 10], "w": 1, "x": 12.5, "y": 0 }, + { "label": "k0B", "matrix": [0, 11], "w": 1, "x": 13.5, "y": 0.125 }, + { "label": "k0C", "matrix": [0, 12], "w": 1, "x": 14.5, "y": 0.375 }, + { "label": "k0D", "matrix": [0, 13], "w": 1.5, "x": 15.5, "y": 0.375 }, + { "label": "k17", "matrix": [1, 7], "w": 1, "x": 9.5, "y": 1.25, "h": 1.5 }, + { "label": "k18", "matrix": [1, 8], "w": 1, "x": 10.5, "y": 1.25 }, + { "label": "k19", "matrix": [1, 9], "w": 1, "x": 11.5, "y": 1.125 }, + { "label": "k1A", "matrix": [1, 10], "w": 1, "x": 12.5, "y": 1 }, + { "label": "k1B", "matrix": [1, 11], "w": 1, "x": 13.5, "y": 1.125 }, + { "label": "k1C", "matrix": [1, 12], "w": 1, "x": 14.5, "y": 1.375 }, + { "label": "k1D", "matrix": [1, 13], "w": 1.5, "x": 15.5, "y": 1.375 }, + { "label": "k28", "matrix": [2, 8], "w": 1, "x": 10.5, "y": 2.25 }, + { "label": "k29", "matrix": [2, 9], "w": 1, "x": 11.5, "y": 2.125 }, + { "label": "k2A", "matrix": [2, 10], "w": 1, "x": 12.5, "y": 2 }, + { "label": "k2B", "matrix": [2, 11], "w": 1, "x": 13.5, "y": 2.125 }, + { "label": "k2C", "matrix": [2, 12], "w": 1, "x": 14.5, "y": 2.375 }, + { "label": "k2D", "matrix": [2, 13], "w": 1.5, "x": 15.5, "y": 2.375 }, + { "label": "k37", "matrix": [3, 7], "w": 1, "x": 9.5, "y": 2.75, "h": 1.5 }, + { "label": "k38", "matrix": [3, 8], "w": 1, "x": 10.5, "y": 3.25 }, + { "label": "k39", "matrix": [3, 9], "w": 1, "x": 11.5, "y": 3.125 }, + { "label": "k3A", "matrix": [3, 10], "w": 1, "x": 12.5, "y": 3 }, + { "label": "k3B", "matrix": [3, 11], "w": 1, "x": 13.5, "y": 3.125 }, + { "label": "k3C", "matrix": [3, 12], "w": 1, "x": 14.5, "y": 3.375 }, + { "label": "k3D", "matrix": [3, 13], "w": 1.5, "x": 15.5, "y": 3.375 }, + { "label": "k49", "matrix": [4, 9], "w": 1, "x": 11.5, "y": 4.125 }, + { "label": "k4A", "matrix": [4, 10], "w": 1, "x": 12.5, "y": 4 }, + { "label": "k4B", "matrix": [4, 11], "w": 1, "x": 13.5, "y": 4.125 }, + { "label": "k4C", "matrix": [4, 12], "w": 1, "x": 14.5, "y": 4.375 }, + { "label": "k4D", "matrix": [4, 13], "w": 1, "x": 15.5, "y": 4.375 }, + { "label": "k57", "matrix": [5, 7], "w": 1, "x": 9, "y": 5 }, + { "label": "k58", "matrix": [5, 8], "w": 1, "x": 10, "y": 5 }, + { "label": "k59", "matrix": [5, 9], "w": 1, "x": 9, "y": 6 }, + { "label": "k5C", "matrix": [5, 12], "w": 1, "x": 9, "y": 7 }, + { "label": "k5B", "matrix": [5, 11], "w": 1, "x": 10, "y": 6, "h": 2 }, + { "label": "k5A", "matrix": [5, 10], "w": 1, "x": 11, "y": 6, "h": 2 } + ] + }, + "LAYOUT_ergodox_80": { + "layout": [ + { "label": "k00", "matrix": [0, 0], "w": 1.5, "x": 0, "y": 0.375 }, + { "label": "k01", "matrix": [0, 1], "w": 1, "x": 1.5, "y": 0.375 }, + { "label": "k02", "matrix": [0, 2], "w": 1, "x": 2.5, "y": 0.125 }, + { "label": "k03", "matrix": [0, 3], "w": 1, "x": 3.5, "y": 0 }, + { "label": "k04", "matrix": [0, 4], "w": 1, "x": 4.5, "y": 0.125 }, + { "label": "k05", "matrix": [0, 5], "w": 1, "x": 5.5, "y": 0.25 }, + { "label": "k06", "matrix": [0, 6], "w": 1, "x": 6.5, "y": 0.25 }, + { "label": "k10", "matrix": [1, 0], "w": 1.5, "x": 0, "y": 1.375 }, + { "label": "k11", "matrix": [1, 1], "w": 1, "x": 1.5, "y": 1.375 }, + { "label": "k12", "matrix": [1, 2], "w": 1, "x": 2.5, "y": 1.125 }, + { "label": "k13", "matrix": [1, 3], "w": 1, "x": 3.5, "y": 1 }, + { "label": "k14", "matrix": [1, 4], "w": 1, "x": 4.5, "y": 1.125 }, + { "label": "k15", "matrix": [1, 5], "w": 1, "x": 5.5, "y": 1.25 }, + { "label": "k16", "matrix": [1, 6], "w": 1, "x": 6.5, "y": 1.25, "h": 1.5 }, + { "label": "k20", "matrix": [2, 0], "w": 1.5, "x": 0, "y": 2.375 }, + { "label": "k21", "matrix": [2, 1], "w": 1, "x": 1.5, "y": 2.375 }, + { "label": "k22", "matrix": [2, 2], "w": 1, "x": 2.5, "y": 2.125 }, + { "label": "k23", "matrix": [2, 3], "w": 1, "x": 3.5, "y": 2 }, + { "label": "k24", "matrix": [2, 4], "w": 1, "x": 4.5, "y": 2.125 }, + { "label": "k25", "matrix": [2, 5], "w": 1, "x": 5.5, "y": 2.25 }, + { "label": "k30", "matrix": [3, 0], "w": 1.5, "x": 0, "y": 3.375 }, + { "label": "k31", "matrix": [3, 1], "w": 1, "x": 1.5, "y": 3.375 }, + { "label": "k32", "matrix": [3, 2], "w": 1, "x": 2.5, "y": 3.125 }, + { "label": "k33", "matrix": [3, 3], "w": 1, "x": 3.5, "y": 3 }, + { "label": "k34", "matrix": [3, 4], "w": 1, "x": 4.5, "y": 3.125 }, + { "label": "k35", "matrix": [3, 5], "w": 1, "x": 5.5, "y": 3.25 }, + { "label": "k36", "matrix": [3, 6], "w": 1, "x": 6.5, "y": 2.75, "h": 1.5 }, + { "label": "k40", "matrix": [4, 0], "w": 1, "x": 0.5, "y": 4.375 }, + { "label": "k41", "matrix": [4, 1], "w": 1, "x": 1.5, "y": 4.375 }, + { "label": "k42", "matrix": [4, 2], "w": 1, "x": 2.5, "y": 4.125 }, + { "label": "k43", "matrix": [4, 3], "w": 1, "x": 3.5, "y": 4 }, + { "label": "k44", "matrix": [4, 4], "w": 1, "x": 4.5, "y": 4.125 }, + { "label": "k55", "matrix": [5, 5], "w": 1, "x": 6, "y": 5 }, + { "label": "k56", "matrix": [5, 6], "w": 1, "x": 7, "y": 5 }, + { "label": "k45", "matrix": [4, 5], "w": 1, "x": 5, "y": 6 }, + { "label": "k46", "matrix": [4, 6], "w": 1, "x": 6, "y": 6 }, + { "label": "k54", "matrix": [5, 4], "w": 1, "x": 7, "y": 6 }, + { "label": "k53", "matrix": [5, 3], "w": 1, "x": 5, "y": 7 }, + { "label": "k52", "matrix": [5, 2], "w": 1, "x": 6, "y": 7 }, + { "label": "k51", "matrix": [5, 1], "w": 1, "x": 7, "y": 7 }, + { "label": "k07", "matrix": [0, 7], "w": 1, "x": 9.5, "y": 0.25 }, + { "label": "k08", "matrix": [0, 8], "w": 1, "x": 10.5, "y": 0.25 }, + { "label": "k09", "matrix": [0, 9], "w": 1, "x": 11.5, "y": 0.125 }, + { "label": "k0A", "matrix": [0, 10], "w": 1, "x": 12.5, "y": 0 }, + { "label": "k0B", "matrix": [0, 11], "w": 1, "x": 13.5, "y": 0.125 }, + { "label": "k0C", "matrix": [0, 12], "w": 1, "x": 14.5, "y": 0.375 }, + { "label": "k0D", "matrix": [0, 13], "w": 1.5, "x": 15.5, "y": 0.375 }, + { "label": "k17", "matrix": [1, 7], "w": 1, "x": 9.5, "y": 1.25, "h": 1.5 }, + { "label": "k18", "matrix": [1, 8], "w": 1, "x": 10.5, "y": 1.25 }, + { "label": "k19", "matrix": [1, 9], "w": 1, "x": 11.5, "y": 1.125 }, + { "label": "k1A", "matrix": [1, 10], "w": 1, "x": 12.5, "y": 1 }, + { "label": "k1B", "matrix": [1, 11], "w": 1, "x": 13.5, "y": 1.125 }, + { "label": "k1C", "matrix": [1, 12], "w": 1, "x": 14.5, "y": 1.375 }, + { "label": "k1D", "matrix": [1, 13], "w": 1.5, "x": 15.5, "y": 1.375 }, + { "label": "k28", "matrix": [2, 8], "w": 1, "x": 10.5, "y": 2.25 }, + { "label": "k29", "matrix": [2, 9], "w": 1, "x": 11.5, "y": 2.125 }, + { "label": "k2A", "matrix": [2, 10], "w": 1, "x": 12.5, "y": 2 }, + { "label": "k2B", "matrix": [2, 11], "w": 1, "x": 13.5, "y": 2.125 }, + { "label": "k2C", "matrix": [2, 12], "w": 1, "x": 14.5, "y": 2.375 }, + { "label": "k2D", "matrix": [2, 13], "w": 1.5, "x": 15.5, "y": 2.375 }, + { "label": "k37", "matrix": [3, 7], "w": 1, "x": 9.5, "y": 2.75, "h": 1.5 }, + { "label": "k38", "matrix": [3, 8], "w": 1, "x": 10.5, "y": 3.25 }, + { "label": "k39", "matrix": [3, 9], "w": 1, "x": 11.5, "y": 3.125 }, + { "label": "k3A", "matrix": [3, 10], "w": 1, "x": 12.5, "y": 3 }, + { "label": "k3B", "matrix": [3, 11], "w": 1, "x": 13.5, "y": 3.125 }, + { "label": "k3C", "matrix": [3, 12], "w": 1, "x": 14.5, "y": 3.375 }, + { "label": "k3D", "matrix": [3, 13], "w": 1.5, "x": 15.5, "y": 3.375 }, + { "label": "k49", "matrix": [4, 9], "w": 1, "x": 11.5, "y": 4.125 }, + { "label": "k4A", "matrix": [4, 10], "w": 1, "x": 12.5, "y": 4 }, + { "label": "k4B", "matrix": [4, 11], "w": 1, "x": 13.5, "y": 4.125 }, + { "label": "k4C", "matrix": [4, 12], "w": 1, "x": 14.5, "y": 4.375 }, + { "label": "k4D", "matrix": [4, 13], "w": 1, "x": 15.5, "y": 4.375 }, + { "label": "k57", "matrix": [5, 7], "w": 1, "x": 9, "y": 5 }, + { "label": "k58", "matrix": [5, 8], "w": 1, "x": 10, "y": 5 }, + { "label": "k59", "matrix": [5, 9], "w": 1, "x": 9, "y": 6 }, + { "label": "k47", "matrix": [4, 7], "w": 1, "x": 10, "y": 6 }, + { "label": "k48", "matrix": [4, 8], "w": 1, "x": 11, "y": 6 }, + { "label": "k5C", "matrix": [5, 12], "w": 1, "x": 9, "y": 7 }, + { "label": "k5B", "matrix": [5, 11], "w": 1, "x": 10, "y": 7 }, + { "label": "k5A", "matrix": [5, 10], "w": 1, "x": 11, "y": 7 } ] }, "LAYOUT_ergodox_pretty": { "layout": [ - {"x":0, "y":0.375, "w":1.5}, {"x":1.5, "y":0.375}, {"x":2.5, "y":0.125}, {"x":3.5, "y":0}, {"x":4.5, "y":0.125}, {"x":5.5, "y":0.25}, {"x":6.5, "y":0.25}, - {"x":9.5, "y":0.25}, {"x":10.5, "y":0.25}, {"x":11.5, "y":0.125}, {"x":12.5, "y":0}, {"x":13.5, "y":0.125}, {"x":14.5, "y":0.375}, {"x":15.5, "y":0.375, "w":1.5}, - - {"x":0, "y":1.375, "w":1.5}, {"x":1.5, "y":1.375}, {"x":2.5, "y":1.125}, {"x":3.5, "y":1}, {"x":4.5, "y":1.125}, {"x":5.5, "y":1.25}, {"x":6.5, "y":1.25, "h":1.5}, - {"x":9.5, "y":1.25, "h":1.5}, {"x":10.5, "y":1.25}, {"x":11.5, "y":1.125}, {"x":12.5, "y":1}, {"x":13.5, "y":1.125}, {"x":14.5, "y":1.375}, {"x":15.5, "y":1.375, "w":1.5}, - - {"x":0, "y":2.375, "w":1.5}, {"x":1.5, "y":2.375}, {"x":2.5, "y":2.125}, {"x":3.5, "y":2}, {"x":4.5, "y":2.125}, {"x":5.5, "y":2.25}, - {"x":10.5, "y":2.25}, {"x":11.5, "y":2.125}, {"x":12.5, "y":2}, {"x":13.5, "y":2.125}, {"x":14.5, "y":2.375}, {"x":15.5, "y":2.375, "w":1.5}, - - {"x":0, "y":3.375, "w":1.5}, {"x":1.5, "y":3.375}, {"x":2.5, "y":3.125}, {"x":3.5, "y":3}, {"x":4.5, "y":3.125}, {"x":5.5, "y":3.25}, {"x":6.5, "y":2.75, "h":1.5}, - {"x":9.5, "y":2.75, "h":1.5}, {"x":10.5, "y":3.25}, {"x":11.5, "y":3.125}, {"x":12.5, "y":3}, {"x":13.5, "y":3.125}, {"x":14.5, "y":3.375}, {"x":15.5, "y":3.375, "w":1.5}, - - {"x":0.5, "y":4.375}, {"x":1.5, "y":4.375}, {"x":2.5, "y":4.125}, {"x":3.5, "y":4}, {"x":4.5, "y":4.125}, - {"x":11.5, "y":4.125}, {"x":12.5, "y":4}, {"x":13.5, "y":4.125}, {"x":14.5, "y":4.375}, {"x":15.5, "y":4.375}, - - {"x":6, "y":5}, {"x":7, "y":5}, {"x":9, "y":5}, {"x":10, "y":5}, - {"x":7, "y":6}, {"x":9, "y":6}, - {"x":5, "y":6, "h":2}, {"x":6, "y":6, "h":2}, {"x":7, "y":7}, {"x":9, "y":7}, {"x":10, "y":6, "h":2}, {"x":11, "y":6, "h":2} + { "label": "L00", "matrix": [0, 0], "w": 1.5, "x": 0, "y": 0.375 }, + { "label": "L01", "matrix": [0, 1], "w": 1, "x": 1.5, "y": 0.375 }, + { "label": "L02", "matrix": [0, 2], "w": 1, "x": 2.5, "y": 0.125 }, + { "label": "L03", "matrix": [0, 3], "w": 1, "x": 3.5, "y": 0 }, + { "label": "L04", "matrix": [0, 4], "w": 1, "x": 4.5, "y": 0.125 }, + { "label": "L05", "matrix": [0, 5], "w": 1, "x": 5.5, "y": 0.25 }, + { "label": "L06", "matrix": [0, 6], "w": 1, "x": 6.5, "y": 0.25 }, + { "label": "R00", "matrix": [0, 7], "w": 1, "x": 9.5, "y": 0.25 }, + { "label": "R01", "matrix": [0, 8], "w": 1, "x": 10.5, "y": 0.25 }, + { "label": "R02", "matrix": [0, 9], "w": 1, "x": 11.5, "y": 0.125 }, + { "label": "R03", "matrix": [0, 10], "w": 1, "x": 12.5, "y": 0 }, + { "label": "R04", "matrix": [0, 11], "w": 1, "x": 13.5, "y": 0.125 }, + { "label": "R05", "matrix": [0, 12], "w": 1, "x": 14.5, "y": 0.375 }, + { "label": "R06", "matrix": [0, 13], "w": 1.5, "x": 15.5, "y": 0.375 }, + { "label": "L10", "matrix": [1, 0], "w": 1.5, "x": 0, "y": 1.375 }, + { "label": "L11", "matrix": [1, 1], "w": 1, "x": 1.5, "y": 1.375 }, + { "label": "L12", "matrix": [1, 2], "w": 1, "x": 2.5, "y": 1.125 }, + { "label": "L13", "matrix": [1, 3], "w": 1, "x": 3.5, "y": 1 }, + { "label": "L14", "matrix": [1, 4], "w": 1, "x": 4.5, "y": 1.125 }, + { "label": "L15", "matrix": [1, 5], "w": 1, "x": 5.5, "y": 1.25 }, + { "label": "L16", "matrix": [1, 6], "w": 1, "x": 6.5, "y": 1.25, "h": 1.5 }, + { "label": "R10", "matrix": [1, 7], "w": 1, "x": 9.5, "y": 1.25, "h": 1.5 }, + { "label": "R11", "matrix": [1, 8], "w": 1, "x": 10.5, "y": 1.25 }, + { "label": "R12", "matrix": [1, 9], "w": 1, "x": 11.5, "y": 1.125 }, + { "label": "R13", "matrix": [1, 10], "w": 1, "x": 12.5, "y": 1 }, + { "label": "R14", "matrix": [1, 11], "w": 1, "x": 13.5, "y": 1.125 }, + { "label": "R15", "matrix": [1, 12], "w": 1, "x": 14.5, "y": 1.375 }, + { "label": "R16", "matrix": [1, 13], "w": 1.5, "x": 15.5, "y": 1.375 }, + { "label": "L20", "matrix": [2, 0], "w": 1.5, "x": 0, "y": 2.375 }, + { "label": "L21", "matrix": [2, 1], "w": 1, "x": 1.5, "y": 2.375 }, + { "label": "L22", "matrix": [2, 2], "w": 1, "x": 2.5, "y": 2.125 }, + { "label": "L23", "matrix": [2, 3], "w": 1, "x": 3.5, "y": 2 }, + { "label": "L24", "matrix": [2, 4], "w": 1, "x": 4.5, "y": 2.125 }, + { "label": "L25", "matrix": [2, 5], "w": 1, "x": 5.5, "y": 2.25 }, + { "label": "R21", "matrix": [2, 8], "w": 1, "x": 10.5, "y": 2.25 }, + { "label": "R22", "matrix": [2, 9], "w": 1, "x": 11.5, "y": 2.125 }, + { "label": "R23", "matrix": [2, 10], "w": 1, "x": 12.5, "y": 2 }, + { "label": "R24", "matrix": [2, 11], "w": 1, "x": 13.5, "y": 2.125 }, + { "label": "R25", "matrix": [2, 12], "w": 1, "x": 14.5, "y": 2.375 }, + { "label": "R26", "matrix": [2, 13], "w": 1.5, "x": 15.5, "y": 2.375 }, + { "label": "L30", "matrix": [3, 0], "w": 1.5, "x": 0, "y": 3.375 }, + { "label": "L31", "matrix": [3, 1], "w": 1, "x": 1.5, "y": 3.375 }, + { "label": "L32", "matrix": [3, 2], "w": 1, "x": 2.5, "y": 3.125 }, + { "label": "L33", "matrix": [3, 3], "w": 1, "x": 3.5, "y": 3 }, + { "label": "L34", "matrix": [3, 4], "w": 1, "x": 4.5, "y": 3.125 }, + { "label": "L35", "matrix": [3, 5], "w": 1, "x": 5.5, "y": 3.25 }, + { "label": "L36", "matrix": [3, 6], "w": 1, "x": 6.5, "y": 2.75, "h": 1.5 }, + { "label": "R30", "matrix": [3, 7], "w": 1, "x": 9.5, "y": 2.75, "h": 1.5 }, + { "label": "R31", "matrix": [3, 8], "w": 1, "x": 10.5, "y": 3.25 }, + { "label": "R32", "matrix": [3, 9], "w": 1, "x": 11.5, "y": 3.125 }, + { "label": "R33", "matrix": [3, 10], "w": 1, "x": 12.5, "y": 3 }, + { "label": "R34", "matrix": [3, 11], "w": 1, "x": 13.5, "y": 3.125 }, + { "label": "R35", "matrix": [3, 12], "w": 1, "x": 14.5, "y": 3.375 }, + { "label": "R36", "matrix": [3, 13], "w": 1.5, "x": 15.5, "y": 3.375 }, + { "label": "L40", "matrix": [4, 0], "w": 1, "x": 0.5, "y": 4.375 }, + { "label": "L41", "matrix": [4, 1], "w": 1, "x": 1.5, "y": 4.375 }, + { "label": "L42", "matrix": [4, 2], "w": 1, "x": 2.5, "y": 4.125 }, + { "label": "L43", "matrix": [4, 3], "w": 1, "x": 3.5, "y": 4 }, + { "label": "L44", "matrix": [4, 4], "w": 1, "x": 4.5, "y": 4.125 }, + { "label": "R42", "matrix": [4, 9], "w": 1, "x": 11.5, "y": 4.125 }, + { "label": "R43", "matrix": [4, 10], "w": 1, "x": 12.5, "y": 4 }, + { "label": "R44", "matrix": [4, 11], "w": 1, "x": 13.5, "y": 4.125 }, + { "label": "R45", "matrix": [4, 12], "w": 1, "x": 14.5, "y": 4.375 }, + { "label": "R46", "matrix": [4, 13], "w": 1, "x": 15.5, "y": 4.375 }, + { "label": "L55", "matrix": [5, 5], "w": 1, "x": 6, "y": 5 }, + { "label": "L56", "matrix": [5, 6], "w": 1, "x": 7, "y": 5 }, + { "label": "R50", "matrix": [5, 7], "w": 1, "x": 9, "y": 5 }, + { "label": "R51", "matrix": [5, 8], "w": 1, "x": 10, "y": 5 }, + { "label": "L54", "matrix": [5, 4], "w": 1, "x": 7, "y": 6 }, + { "label": "R52", "matrix": [5, 9], "w": 1, "x": 9, "y": 6 }, + { "label": "L53", "matrix": [5, 3], "w": 1, "x": 5, "y": 6,"h": 2 }, + { "label": "L52", "matrix": [5, 2], "w": 1, "x": 6, "y": 6,"h": 2 }, + { "label": "L51", "matrix": [5, 1], "w": 1, "x": 7, "y": 7 }, + { "label": "R55", "matrix": [5, 12], "w": 1, "x": 9, "y": 7 }, + { "label": "R54", "matrix": [5, 11], "w": 1, "x": 10, "y": 6, "h": 2 }, + { "label": "R53", "matrix": [5, 10], "w": 1, "x": 11, "y": 6, "h": 2 } ] }, - "LAYOUT_ergodox_80": { - - "layout": [ - {"x":0, "y":0.375, "w":1.5}, {"x":1.5, "y":0.375}, {"x":2.5, "y":0.125}, {"x":3.5, "y":0}, {"x":4.5, "y":0.125}, {"x":5.5, "y":0.25}, {"x":6.5, "y":0.25}, - {"x":0, "y":1.375, "w":1.5}, {"x":1.5, "y":1.375}, {"x":2.5, "y":1.125}, {"x":3.5, "y":1}, {"x":4.5, "y":1.125}, {"x":5.5, "y":1.25}, {"x":6.5, "y":1.25, "h":1.5}, - {"x":0, "y":2.375, "w":1.5}, {"x":1.5, "y":2.375}, {"x":2.5, "y":2.125}, {"x":3.5, "y":2}, {"x":4.5, "y":2.125}, {"x":5.5, "y":2.25}, - {"x":0, "y":3.375, "w":1.5}, {"x":1.5, "y":3.375}, {"x":2.5, "y":3.125}, {"x":3.5, "y":3}, {"x":4.5, "y":3.125}, {"x":5.5, "y":3.25}, {"x":6.5, "y":2.75, "h":1.5}, - {"x":0.5, "y":4.375}, {"x":1.5, "y":4.375}, {"x":2.5, "y":4.125}, {"x":3.5, "y":4}, {"x":4.5, "y":4.125}, - - {"x":6, "y":5}, {"x":7, "y":5}, - - {"x":5, "y":6}, {"x":6, "y":6}, {"x":7, "y":6}, - {"x":5, "y":7}, {"x":6, "y":7}, {"x":7, "y":7}, - - - {"x":9.5, "y":0.25}, {"x":10.5, "y":0.25}, {"x":11.5, "y":0.125}, {"x":12.5, "y":0}, {"x":13.5, "y":0.125}, {"x":14.5, "y":0.375}, {"x":15.5, "y":0.375, "w":1.5}, - {"x":9.5, "y":1.25, "h":1.5}, {"x":10.5, "y":1.25}, {"x":11.5, "y":1.125}, {"x":12.5, "y":1}, {"x":13.5, "y":1.125}, {"x":14.5, "y":1.375}, {"x":15.5, "y":1.375, "w":1.5}, - {"x":10.5, "y":2.25}, {"x":11.5, "y":2.125}, {"x":12.5, "y":2}, {"x":13.5, "y":2.125}, {"x":14.5, "y":2.375}, {"x":15.5, "y":2.375, "w":1.5}, - {"x":9.5, "y":2.75, "h":1.5}, {"x":10.5, "y":3.25}, {"x":11.5, "y":3.125}, {"x":12.5, "y":3}, {"x":13.5, "y":3.125}, {"x":14.5, "y":3.375}, {"x":15.5, "y":3.375, "w":1.5}, - {"x":11.5, "y":4.125}, {"x":12.5, "y":4}, {"x":13.5, "y":4.125}, {"x":14.5, "y":4.375}, {"x":15.5, "y":4.375}, - - - {"x":9, "y":5}, {"x":10, "y":5}, - {"x":9, "y":6}, {"x":10, "y":6}, {"x":11, "y":6}, - {"x":9, "y":7}, {"x":10, "y":7}, {"x":11, "y":7} - ] - }, "LAYOUT_ergodox_pretty_80": { - - "layout": [ - {"x":0, "y":0.375, "w":1.5}, {"x":1.5, "y":0.375}, {"x":2.5, "y":0.125}, {"x":3.5, "y":0}, {"x":4.5, "y":0.125}, {"x":5.5, "y":0.25}, {"x":6.5, "y":0.25}, - {"x":9.5, "y":0.25}, {"x":10.5, "y":0.25}, {"x":11.5, "y":0.125}, {"x":12.5, "y":0}, {"x":13.5, "y":0.125}, {"x":14.5, "y":0.375}, {"x":15.5, "y":0.375, "w":1.5}, - - {"x":0, "y":1.375, "w":1.5}, {"x":1.5, "y":1.375}, {"x":2.5, "y":1.125}, {"x":3.5, "y":1}, {"x":4.5, "y":1.125}, {"x":5.5, "y":1.25}, {"x":6.5, "y":1.25, "h":1.5}, - {"x":9.5, "y":1.25, "h":1.5}, {"x":10.5, "y":1.25}, {"x":11.5, "y":1.125}, {"x":12.5, "y":1}, {"x":13.5, "y":1.125}, {"x":14.5, "y":1.375}, {"x":15.5, "y":1.375, "w":1.5}, - - {"x":0, "y":2.375, "w":1.5}, {"x":1.5, "y":2.375}, {"x":2.5, "y":2.125}, {"x":3.5, "y":2}, {"x":4.5, "y":2.125}, {"x":5.5, "y":2.25}, - {"x":10.5, "y":2.25}, {"x":11.5, "y":2.125}, {"x":12.5, "y":2}, {"x":13.5, "y":2.125}, {"x":14.5, "y":2.375}, {"x":15.5, "y":2.375, "w":1.5}, - - {"x":0, "y":3.375, "w":1.5}, {"x":1.5, "y":3.375}, {"x":2.5, "y":3.125}, {"x":3.5, "y":3}, {"x":4.5, "y":3.125}, {"x":5.5, "y":3.25}, {"x":6.5, "y":2.75, "h":1.5}, - {"x":9.5, "y":2.75, "h":1.5}, {"x":10.5, "y":3.25}, {"x":11.5, "y":3.125}, {"x":12.5, "y":3}, {"x":13.5, "y":3.125}, {"x":14.5, "y":3.375}, {"x":15.5, "y":3.375, "w":1.5}, - - {"x":0.5, "y":4.375}, {"x":1.5, "y":4.375}, {"x":2.5, "y":4.125}, {"x":3.5, "y":4}, {"x":4.5, "y":4.125}, - {"x":11.5, "y":4.125}, {"x":12.5, "y":4}, {"x":13.5, "y":4.125}, {"x":14.5, "y":4.375}, {"x":15.5, "y":4.375}, - - {"x":6, "y":5}, {"x":7, "y":5}, {"x":9, "y":5}, {"x":10, "y":5}, - {"x":5, "y":6}, {"x":6, "y":6}, {"x":7, "y":6}, {"x":9, "y":6}, {"x":10, "y":6}, {"x":11, "y":6}, - {"x":5, "y":7}, {"x":6, "y":7}, {"x":7, "y":7}, {"x":9, "y":7}, {"x":10, "y":7}, {"x":11, "y":7} - ] - } + "layout": [ + { "label": "L00", "matrix": [0, 0], "w": 1.5, "x": 0, "y": 0.375 }, + { "label": "L01", "matrix": [0, 1], "w": 1, "x": 1.5, "y": 0.375 }, + { "label": "L02", "matrix": [0, 2], "w": 1, "x": 2.5, "y": 0.125 }, + { "label": "L03", "matrix": [0, 3], "w": 1, "x": 3.5, "y": 0 }, + { "label": "L04", "matrix": [0, 4], "w": 1, "x": 4.5, "y": 0.125 }, + { "label": "L05", "matrix": [0, 5], "w": 1, "x": 5.5, "y": 0.25 }, + { "label": "L06", "matrix": [0, 6], "w": 1, "x": 6.5, "y": 0.25 }, + { "label": "R00", "matrix": [0, 7], "w": 1, "x": 9.5, "y": 0.25 }, + { "label": "R01", "matrix": [0, 8], "w": 1, "x": 10.5, "y": 0.25 }, + { "label": "R02", "matrix": [0, 9], "w": 1, "x": 11.5, "y": 0.125 }, + { "label": "R03", "matrix": [0, 10], "w": 1, "x": 12.5, "y": 0 }, + { "label": "R04", "matrix": [0, 11], "w": 1, "x": 13.5, "y": 0.125 }, + { "label": "R05", "matrix": [0, 12], "w": 1, "x": 14.5, "y": 0.375 }, + { "label": "R06", "matrix": [0, 13], "w": 1.5, "x": 15.5, "y": 0.375 }, + { "label": "L10", "matrix": [1, 0], "w": 1.5, "x": 0, "y": 1.375 }, + { "label": "L11", "matrix": [1, 1], "w": 1, "x": 1.5, "y": 1.375 }, + { "label": "L12", "matrix": [1, 2], "w": 1, "x": 2.5, "y": 1.125 }, + { "label": "L13", "matrix": [1, 3], "w": 1, "x": 3.5, "y": 1 }, + { "label": "L14", "matrix": [1, 4], "w": 1, "x": 4.5, "y": 1.125 }, + { "label": "L15", "matrix": [1, 5], "w": 1, "x": 5.5, "y": 1.25 }, + { "label": "L16", "matrix": [1, 6], "w": 1, "x": 6.5, "y": 1.25, "h": 1.5 }, + { "label": "R10", "matrix": [1, 7], "w": 1, "x": 9.5, "y": 1.25, "h": 1.5 }, + { "label": "R11", "matrix": [1, 8], "w": 1, "x": 10.5, "y": 1.25 }, + { "label": "R12", "matrix": [1, 9], "w": 1, "x": 11.5, "y": 1.125 }, + { "label": "R13", "matrix": [1, 10], "w": 1, "x": 12.5, "y": 1 }, + { "label": "R14", "matrix": [1, 11], "w": 1, "x": 13.5, "y": 1.125 }, + { "label": "R15", "matrix": [1, 12], "w": 1, "x": 14.5, "y": 1.375 }, + { "label": "R16", "matrix": [1, 13], "w": 1.5, "x": 15.5, "y": 1.375 }, + { "label": "L20", "matrix": [2, 0], "w": 1.5, "x": 0, "y": 2.375 }, + { "label": "L21", "matrix": [2, 1], "w": 1, "x": 1.5, "y": 2.375 }, + { "label": "L22", "matrix": [2, 2], "w": 1, "x": 2.5, "y": 2.125 }, + { "label": "L23", "matrix": [2, 3], "w": 1, "x": 3.5, "y": 2 }, + { "label": "L24", "matrix": [2, 4], "w": 1, "x": 4.5, "y": 2.125 }, + { "label": "L25", "matrix": [2, 5], "w": 1, "x": 5.5, "y": 2.25 }, + { "label": "R21", "matrix": [2, 8], "w": 1, "x": 10.5, "y": 2.25 }, + { "label": "R22", "matrix": [2, 9], "w": 1, "x": 11.5, "y": 2.125 }, + { "label": "R23", "matrix": [2, 10], "w": 1, "x": 12.5, "y": 2 }, + { "label": "R24", "matrix": [2, 11], "w": 1, "x": 13.5, "y": 2.125 }, + { "label": "R25", "matrix": [2, 12], "w": 1, "x": 14.5, "y": 2.375 }, + { "label": "R26", "matrix": [2, 13], "w": 1.5, "x": 15.5, "y": 2.375 }, + { "label": "L30", "matrix": [3, 0], "w": 1.5, "x": 0, "y": 3.375 }, + { "label": "L31", "matrix": [3, 1], "w": 1, "x": 1.5, "y": 3.375 }, + { "label": "L32", "matrix": [3, 2], "w": 1, "x": 2.5, "y": 3.125 }, + { "label": "L33", "matrix": [3, 3], "w": 1, "x": 3.5, "y": 3 }, + { "label": "L34", "matrix": [3, 4], "w": 1, "x": 4.5, "y": 3.125 }, + { "label": "L35", "matrix": [3, 5], "w": 1, "x": 5.5, "y": 3.25 }, + { "label": "L36", "matrix": [3, 6], "w": 1, "x": 6.5, "y": 2.75, "h": 1.5 }, + { "label": "R30", "matrix": [3, 7], "w": 1, "x": 9.5, "y": 2.75, "h": 1.5 }, + { "label": "R31", "matrix": [3, 8], "w": 1, "x": 10.5, "y": 3.25 }, + { "label": "R32", "matrix": [3, 9], "w": 1, "x": 11.5, "y": 3.125 }, + { "label": "R33", "matrix": [3, 10], "w": 1, "x": 12.5, "y": 3 }, + { "label": "R34", "matrix": [3, 11], "w": 1, "x": 13.5, "y": 3.125 }, + { "label": "R35", "matrix": [3, 12], "w": 1, "x": 14.5, "y": 3.375 }, + { "label": "R36", "matrix": [3, 13], "w": 1.5, "x": 15.5, "y": 3.375 }, + { "label": "L40", "matrix": [4, 0], "w": 1, "x": 0.5, "y": 4.375 }, + { "label": "L41", "matrix": [4, 1], "w": 1, "x": 1.5, "y": 4.375 }, + { "label": "L42", "matrix": [4, 2], "w": 1, "x": 2.5, "y": 4.125 }, + { "label": "L43", "matrix": [4, 3], "w": 1, "x": 3.5, "y": 4 }, + { "label": "L44", "matrix": [4, 4], "w": 1, "x": 4.5, "y": 4.125 }, + { "label": "R42", "matrix": [4, 9], "w": 1, "x": 11.5, "y": 4.125 }, + { "label": "R43", "matrix": [4, 10], "w": 1, "x": 12.5, "y": 4 }, + { "label": "R44", "matrix": [4, 11], "w": 1, "x": 13.5, "y": 4.125 }, + { "label": "R45", "matrix": [4, 12], "w": 1, "x": 14.5, "y": 4.375 }, + { "label": "R46", "matrix": [4, 13], "w": 1, "x": 15.5, "y": 4.375 }, + { "label": "L55", "matrix": [5, 5], "w": 1, "x": 6, "y": 5 }, + { "label": "L56", "matrix": [5, 6], "w": 1, "x": 7, "y": 5 }, + { "label": "R50", "matrix": [5, 7], "w": 1, "x": 9, "y": 5 }, + { "label": "R51", "matrix": [5, 8], "w": 1, "x": 10, "y": 5 }, + { "label": "L45", "matrix": [4, 5], "w": 1, "x": 5, "y": 6 }, + { "label": "L46", "matrix": [4, 6], "w": 1, "x": 6, "y": 6 }, + { "label": "L54", "matrix": [5, 4], "w": 1, "x": 7, "y": 6 }, + { "label": "R52", "matrix": [5, 9], "w": 1, "x": 9, "y": 6 }, + { "label": "R40", "matrix": [4, 7], "w": 1, "x": 10, "y": 6 }, + { "label": "R41", "matrix": [4, 8], "w": 1, "x": 11, "y": 6 }, + { "label": "L53", "matrix": [5, 3], "w": 1, "x": 5, "y": 7 }, + { "label": "L52", "matrix": [5, 2], "w": 1, "x": 6, "y": 7 }, + { "label": "L51", "matrix": [5, 1], "w": 1, "x": 7, "y": 7 }, + { "label": "R55", "matrix": [5, 12], "w": 1, "x": 9, "y": 7 }, + { "label": "R54", "matrix": [5, 11], "w": 1, "x": 10, "y": 7 }, + { "label": "R53", "matrix": [5, 10], "w": 1, "x": 11, "y": 7 } + ] + } } } diff --git a/keyboards/ktec/ergodone/keymaps/default/keymap.c b/keyboards/ktec/ergodone/keymaps/default/keymap.c index ca3da7ec5d..837af0fa03 100644 --- a/keyboards/ktec/ergodone/keymaps/default/keymap.c +++ b/keyboards/ktec/ergodone/keymaps/default/keymap.c @@ -6,10 +6,7 @@ #define MDIA 2 // media keys enum custom_keycodes { - PLACEHOLDER = SAFE_RANGE, // can always be here - EPRM, - VRSN, - RGB_SLD + VRSN = SAFE_RANGE, }; const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { @@ -67,7 +64,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * |---------+------+------+------+------+------| | | |------+------+------+------+------+--------| * | | % | ^ | [ | ] | ~ | | | | & | 1 | 2 | 3 | \ | | * `---------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' - * | EPRM | | | | | | | . | 0 | = | | + * | EE_CLR | | | | | | | . | 0 | = | | * `-----------------------------------' `----------------------------------' * ,-------------. ,-------------. * |Animat| | |Toggle|Solid | @@ -84,7 +81,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_TRNS,KC_EXLM,KC_AT, KC_LCBR,KC_RCBR,KC_PIPE,KC_TRNS, KC_TRNS,KC_HASH,KC_DLR, KC_LPRN,KC_RPRN,KC_GRV, KC_TRNS,KC_PERC,KC_CIRC,KC_LBRC,KC_RBRC,KC_TILD,KC_TRNS, - EPRM,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, + EE_CLR,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, RGB_MOD,KC_TRNS, KC_TRNS, RGB_VAD,RGB_VAI,KC_TRNS, @@ -94,7 +91,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_DOWN, KC_4, KC_5, KC_6, KC_PLUS, KC_TRNS, KC_TRNS, KC_AMPR, KC_1, KC_2, KC_3, KC_BSLS, KC_TRNS, KC_TRNS,KC_DOT, KC_0, KC_EQL, KC_TRNS, - RGB_TOG, RGB_SLD, + RGB_TOG, RGB_M_P, KC_TRNS, KC_TRNS, RGB_HUD, RGB_HUI ), @@ -143,41 +140,28 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { bool process_record_user(uint16_t keycode, keyrecord_t *record) { switch (keycode) { - // dynamically generate these. - case EPRM: - if (record->event.pressed) { - eeconfig_init(); - } - return false; - break; case VRSN: if (record->event.pressed) { SEND_STRING (QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION); } return false; - break; - case RGB_SLD: - if (record->event.pressed) { - #ifdef RGBLIGHT_ENABLE - rgblight_mode(1); - #endif - } - return false; - break; } return true; } +bool led_update_user(led_t led_state) { + // stub any kb level behaviour + return false; +} + // Runs constantly in the background, in a loop. void matrix_scan_user(void) { - - uint8_t layer = biton32(layer_state); - ergodox_board_led_off(); ergodox_right_led_1_off(); ergodox_right_led_2_off(); ergodox_right_led_3_off(); - switch (layer) { + + switch (get_highest_layer(layer_state)) { // TODO: Make this relevant to the ErgoDox EZ. case 1: ergodox_right_led_1_on(); diff --git a/keyboards/ktec/ergodone/keymaps/via/config.h b/keyboards/ktec/ergodone/keymaps/via/config.h deleted file mode 100644 index fc7744c763..0000000000 --- a/keyboards/ktec/ergodone/keymaps/via/config.h +++ /dev/null @@ -1,18 +0,0 @@ - /* Copyright HarshitGoel96 2021 - * - * 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 . - */ - //Keymap specific config.h -#pragma once -#define DYNAMIC_KEYMAP_LAYER_COUNT 4 \ No newline at end of file diff --git a/keyboards/ktec/ergodone/keymaps/via/readme.md b/keyboards/ktec/ergodone/keymaps/via/readme.md deleted file mode 100644 index 223cb892ba..0000000000 --- a/keyboards/ktec/ergodone/keymaps/via/readme.md +++ /dev/null @@ -1,5 +0,0 @@ - -## Changelog -HarshitGoel96 - -I love my ergodone, but it needed via, so here it is. Flash using HIDBOOTLOADER as described in keyboard root read.md and enjoy via on ergodone. \ No newline at end of file diff --git a/keyboards/ktec/ergodone/matrix.c b/keyboards/ktec/ergodone/matrix.c index 529974532a..cb845db1bc 100644 --- a/keyboards/ktec/ergodone/matrix.c +++ b/keyboards/ktec/ergodone/matrix.c @@ -1,161 +1,76 @@ -#include -#include -#include +// Copyright 2022 QMK +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "gpio.h" +#include "matrix.h" +#include "mcp23018.h" +#include "util.h" #include "wait.h" -#include "action_layer.h" -#include "print.h" #include "debug.h" -#include "util.h" -#include "matrix.h" -#include "ergodone.h" -#include "expander.h" - -/* - * This constant define not debouncing time in msecs, but amount of matrix - * scan loops which should be made to get stable debounced results. - * - * On Ergodox matrix scan rate is relatively low, because of slow I2C. - * Now it's only 317 scans/second, or about 3.15 msec/scan. - * According to Cherry specs, debouncing time is 5 msec. - * - * And so, there is no sense to have DEBOUNCE higher than 2. - */ - -#ifndef DEBOUNCE -# define DEBOUNCE 5 -#endif - -/* matrix state(1:on, 0:off) */ -static matrix_row_t matrix[MATRIX_ROWS]; - -// Debouncing: store for each key the number of scans until it's eligible to -// change. When scanning the matrix, ignore any changes in keys that have -// already changed in the last DEBOUNCE scans. -static uint8_t debounce_matrix[MATRIX_ROWS * MATRIX_COLS]; -static matrix_row_t read_cols(uint8_t row); -static void init_cols(void); -static void unselect_rows(void); -static void select_row(uint8_t row); +#define I2C_ADDR 0x20 -__attribute__ ((weak)) -void matrix_init_user(void) {} +static uint8_t mcp23018_errors = 0; -__attribute__ ((weak)) -void matrix_scan_user(void) {} - -__attribute__ ((weak)) -void matrix_init_kb(void) { - matrix_init_user(); -} - -__attribute__ ((weak)) -void matrix_scan_kb(void) { - matrix_scan_user(); +static void expander_init(void) { + mcp23018_init(I2C_ADDR); } -inline -uint8_t matrix_rows(void) -{ - return MATRIX_ROWS; +static void expander_init_cols(void) { + mcp23018_errors += !mcp23018_set_config(I2C_ADDR, mcp23018_PORTA, ALL_INPUT); + mcp23018_errors += !mcp23018_set_config(I2C_ADDR, mcp23018_PORTB, ALL_INPUT); } -inline -uint8_t matrix_cols(void) -{ - return MATRIX_COLS; -} - -void matrix_init(void) -{ - unselect_rows(); - init_cols(); - - // initialize matrix state: all keys off - for (uint8_t i=0; i < MATRIX_ROWS; i++) { - matrix[i] = 0; - for (uint8_t j=0; j < MATRIX_COLS; ++j) { - debounce_matrix[i * MATRIX_COLS + j] = 0; +static void expander_select_row(uint8_t row) { + if (mcp23018_errors) { + // wait to mimic i2c interactions + wait_us(100); + return; } - } - matrix_init_quantum(); + mcp23018_errors += !mcp23018_set_config(I2C_ADDR, mcp23018_PORTB, ~(1 << (row + 1))); } -void matrix_power_up(void) { - unselect_rows(); - init_cols(); - - // initialize matrix state: all keys off - for (uint8_t i=0; i < MATRIX_ROWS; i++) { - matrix[i] = 0; - } +static void expander_unselect_row(uint8_t row) { + // No need to unselect row as the next `select_row` will blank everything anyway } -// Returns a matrix_row_t whose bits are set if the corresponding key should be -// eligible to change in this scan. -matrix_row_t debounce_mask(uint8_t row) { - matrix_row_t result = 0; - for (uint8_t j=0; j < MATRIX_COLS; ++j) { - if (debounce_matrix[row * MATRIX_COLS + j]) { - --debounce_matrix[row * MATRIX_COLS + j]; - } else { - result |= (1 << j); +static void expander_unselect_rows(void) { + if (mcp23018_errors) { + return; } - } - return result; -} -// Report changed keys in the given row. Resets the debounce countdowns -// corresponding to each set bit in 'change' to DEBOUNCE. -void debounce_report(matrix_row_t change, uint8_t row) { - for (uint8_t i = 0; i < MATRIX_COLS; ++i) { - if (change & (1 << i)) { - debounce_matrix[row * MATRIX_COLS + i] = DEBOUNCE; - } - } + mcp23018_errors += !mcp23018_set_config(I2C_ADDR, mcp23018_PORTB, ALL_INPUT); } -uint8_t matrix_scan(void) -{ - expander_scan(); - - for (uint8_t i = 0; i < MATRIX_ROWS; i++) { - select_row(i); - wait_us(30); // without this wait read unstable value. - matrix_row_t mask = debounce_mask(i); - matrix_row_t cols = (read_cols(i) & mask) | (matrix[i] & ~mask); - debounce_report(cols ^ matrix[i], i); - matrix[i] = cols; - - unselect_rows(); - } +static matrix_row_t expander_read_row(void) { + if (mcp23018_errors) { + return 0; + } - matrix_scan_quantum(); + uint8_t ret = 0xFF; + mcp23018_errors += !mcp23018_readPins(I2C_ADDR, mcp23018_PORTA, &ret); - return 1; -} + ret = bitrev(~ret); + ret = ((ret & 0b11111000) >> 1) | (ret & 0b00000011); -inline -bool matrix_is_on(uint8_t row, uint8_t col) -{ - return (matrix[row] & ((matrix_row_t)1< 0x1FFF) { + // tuned to about 5s given the current scan rate + dprintf("trying to reset mcp23018\n"); + mcp23018_reset_loop = 0; + mcp23018_errors = 0; + expander_unselect_rows(); + expander_init_cols(); + } } /* Column pin configuration @@ -165,32 +80,31 @@ void matrix_print(void) * * Expander: 13 12 11 10 9 8 7 */ -static void init_cols(void) -{ - // Pro Micro - DDRE &= ~(1<