Convert ergodone to use core mcp23018 driver (#17005)

This commit is contained in:
Joel Challis 2022-05-31 03:08:56 +01:00 committed by GitHub
parent 2879573688
commit 0e11b511e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 652 additions and 788 deletions

View File

@ -1,77 +1,8 @@
// Copyright 2022 QMK
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include "config_common.h"
/* 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
/* 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

View File

@ -1,54 +1,11 @@
// Copyright 2022 QMK
// SPDX-License-Identifier: GPL-2.0-or-later
#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);
#include "ergodox_compat.h"
void keyboard_post_init_kb(void) {
ergodox_blink_all_leds();
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);
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();
}
void ergodox_led_init(void)
{
DDRB |= (1<<PB5 | 1<<PB6 | 1<<PB3);
PORTB &= ~(1<<PB5 | 1<<PB6 | 1<<PB3);
DDRB |= (1<<PB0);
PORTB |= (1<<PB0);
DDRD |= (1<<PB5);
PORTD |= (1<<PB5);
}
void ergodox_blink_all_leds(void)
{
ergodox_led_all_off();
ergodox_led_all_set(LED_BRIGHTNESS_HI);
ergodox_right_led_1_on();
_delay_ms(50);
ergodox_right_led_2_on();
_delay_ms(50);
ergodox_right_led_3_on();
_delay_ms(50);
ergodox_right_led_1_off();
_delay_ms(50);
ergodox_right_led_2_off();
_delay_ms(50);
ergodox_right_led_3_off();
//ergodox_led_all_on();
//_delay_ms(333);
ergodox_led_all_off();
keyboard_post_init_user();
}

View File

@ -1,156 +1,10 @@
// Copyright 2022 QMK
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include "quantum.h"
#include <stdint.h>
#include <stdbool.h>
#include "layouts.h" // Ensure access to info.json layouts
void init_ergodox(void);
inline void ergodox_right_led_1_off(void) { DDRB &= ~(1<<PB5); PORTB &= ~(1<<PB5); }
inline void ergodox_right_led_1_on(void) { DDRB |= (1<<PB5); PORTB |= (1<<PB5); }
inline void ergodox_right_led_2_off(void) { DDRB &= ~(1<<PB6); PORTB &= ~(1<<PB6); }
inline void ergodox_right_led_2_on(void) { DDRB |= (1<<PB6); PORTB |= (1<<PB6); }
inline void ergodox_right_led_3_off(void) { DDRB &= ~(1<<PB3); PORTB &= ~(1<<PB3); }
inline void ergodox_right_led_3_on(void) { DDRB |= (1<<PB3); PORTB |= (1<<PB3); }
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;
}
}
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;
}
}
inline void ergodox_board_led_off(void) { DDRB &= ~(1<<PB0); PORTB |= (1<<PB0); }
inline void ergodox_board_led_on(void) { DDRB |= (1<<PB0); PORTB &= ~(1<<PB0); }
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();
}
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();
}
inline void ergodox_right_led_1_set(uint8_t n) {}
inline void ergodox_right_led_2_set(uint8_t n) {}
inline void ergodox_right_led_3_set(uint8_t n) {}
inline void ergodox_right_led_set(uint8_t l, uint8_t n) {}
inline void ergodox_led_all_set(uint8_t n) {}
#define XXX KC_NO
#define LAYOUT_ergodox( \
k00, k01, k02, k03, k04, k05, k06, \
k10, k11, k12, k13, k14, k15, k16, \
k20, k21, k22, k23, k24, k25, \
k30, k31, k32, k33, k34, k35, k36, \
k40, k41, k42, k43, k44, \
k55, k56, \
k54, \
k53, k52, k51, \
\
k07, k08, k09, k0A, k0B, k0C, k0D, \
k17, k18, k19, k1A, k1B, k1C, k1D, \
k28, k29, k2A, k2B, k2C, k2D, \
k37, k38, k39, k3A, k3B, k3C, k3D, \
k49, k4A, k4B, k4C, k4D, \
k57, k58, \
k59, \
k5C, k5B, k5A \
) { \
{ k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0A, k0B, k0C, k0D }, \
{ k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1A, k1B, k1C, k1D }, \
{ k20, k21, k22, k23, k24, k25, XXX, XXX, k28, k29, k2A, k2B, k2C, k2D }, \
{ k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3A, k3B, k3C, k3D }, \
{ k40, k41, k42, k43, k44, XXX, XXX, XXX, XXX, k49, k4A, k4B, k4C, k4D }, \
{ XXX, k51, k52, k53, k54, k55, k56, k57, k58, k59, k5A, k5B, k5C, XXX } \
}
#define LAYOUT_ergodox_80( \
k00, k01, k02, k03, k04, k05, k06, \
k10, k11, k12, k13, k14, k15, k16, \
k20, k21, k22, k23, k24, k25, \
k30, k31, k32, k33, k34, k35, k36, \
k40, k41, k42, k43, k44, \
k55, k56, \
k45, k46, k54, \
k53, k52, k51, \
\
k07, k08, k09, k0A, k0B, k0C, k0D, \
k17, k18, k19, k1A, k1B, k1C, k1D, \
k28, k29, k2A, k2B, k2C, k2D, \
k37, k38, k39, k3A, k3B, k3C, k3D, \
k49, k4A, k4B, k4C, k4D, \
k57, k58, \
k59, k47, k48, \
k5C, k5B, k5A \
) { \
{ k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0A, k0B, k0C, k0D }, \
{ k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1A, k1B, k1C, k1D }, \
{ k20, k21, k22, k23, k24, k25, XXX, XXX, k28, k29, k2A, k2B, k2C, k2D }, \
{ k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3A, k3B, k3C, k3D }, \
{ k40, k41, k42, k43, k44, k45, k46, k47, k48, k49, k4A, k4B, k4C, k4D }, \
{ XXX, k51, k52, k53, k54, k55, k56, k57, k58, k59, k5A, k5B, k5C, XXX } \
}
#define LAYOUT_ergodox_pretty( \
L00, L01, L02, L03, L04, L05, L06, R00, R01, R02, R03, R04, R05, R06, \
L10, L11, L12, L13, L14, L15, L16, R10, R11, R12, R13, R14, R15, R16, \
L20, L21, L22, L23, L24, L25, R21, R22, R23, R24, R25, R26, \
L30, L31, L32, L33, L34, L35, L36, R30, R31, R32, R33, R34, R35, R36, \
L40, L41, L42, L43, L44, R42, R43, R44, R45, R46, \
L55, L56, R50, R51, \
L54, R52, \
L53, L52, L51, R55, R54, R53 \
) { \
{ L00, L01, L02, L03, L04, L05, L06, R00, R01, R02, R03, R04, R05, R06 }, \
{ L10, L11, L12, L13, L14, L15, L16, R10, R11, R12, R13, R14, R15, R16 }, \
{ L20, L21, L22, L23, L24, L25, XXX, XXX, R21, R22, R23, R24, R25, R26 }, \
{ L30, L31, L32, L33, L34, L35, L36, R30, R31, R32, R33, R34, R35, R36 }, \
{ L40, L41, L42, L43, L44, XXX, XXX, XXX, XXX, R42, R43, R44, R45, R46 }, \
{ XXX, L51, L52, L53, L54, L55, L56, R50, R51, R52, R53, R54, R55, XXX } \
}
#define LAYOUT_ergodox_pretty_80( \
L00, L01, L02, L03, L04, L05, L06, R00, R01, R02, R03, R04, R05, R06, \
L10, L11, L12, L13, L14, L15, L16, R10, R11, R12, R13, R14, R15, R16, \
L20, L21, L22, L23, L24, L25, R21, R22, R23, R24, R25, R26, \
L30, L31, L32, L33, L34, L35, L36, R30, R31, R32, R33, R34, R35, R36, \
L40, L41, L42, L43, L44, R42, R43, R44, R45, R46, \
L55, L56, R50, R51, \
L45, L46, L54, R52, R40, R41, \
L53, L52, L51, R55, R54, R53 \
) { \
{ L00, L01, L02, L03, L04, L05, L06, R00, R01, R02, R03, R04, R05, R06 }, \
{ L10, L11, L12, L13, L14, L15, L16, R10, R11, R12, R13, R14, R15, R16 }, \
{ L20, L21, L22, L23, L24, L25, XXX, XXX, R21, R22, R23, R24, R25, R26 }, \
{ L30, L31, L32, L33, L34, L35, L36, R30, R31, R32, R33, R34, R35, R36 }, \
{ L40, L41, L42, L43, L44, L45, L46, R40, R41, R42, R43, R44, R45, R46 }, \
{ XXX, L51, L52, L53, L54, L55, L56, R50, R51, R52, R53, R54, R55, XXX } \
}
// This file only exists to pull in....
#include "ergodox_compat.h"

View File

@ -0,0 +1,94 @@
// Copyright 2022 QMK
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include <stdint.h>
#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();
}

View File

@ -1,104 +0,0 @@
#include <stdbool.h>
#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<<col) ? 1 : 0;
}
matrix_row_t expander_read_row(void)
{
expander_read_cols();
/* make cols */
matrix_row_t cols = 0;
for (uint8_t col = 0; col < MATRIX_COLS; col++) {
if (expander_get_col(col)) {
cols |= (1UL << (MATRIX_COLS - 1 - col));
}
}
return cols;
}
void expander_unselect_rows(void)
{
expander_write(EXPANDER_REG_IODIRB, 0xFF);
}
void expander_select_row(uint8_t row)
{
expander_write(EXPANDER_REG_IODIRB, ~(1<<(row+1)));
}
void expander_config(void)
{
expander_write(EXPANDER_REG_IPOLA, 0xFF);
expander_write(EXPANDER_REG_GPPUA, 0xFF);
expander_write(EXPANDER_REG_IODIRB, 0xFF);
}
uint8_t expander_write(uint8_t reg, uint8_t data)
{
if (expander_status == 0) {
return 0;
}
return i2c_writeReg(EXPANDER_ADDR, reg, &data, 1, I2C_TIMEOUT);
}
uint8_t expander_read(uint8_t reg, uint8_t *data)
{
if (expander_status == 0) {
return 0;
}
return i2c_readReg(EXPANDER_ADDR, reg, data, 1, I2C_TIMEOUT);
}

View File

@ -1,45 +0,0 @@
#pragma once
#include <stdint.h>
#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);

View File

@ -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 }
]
}
}
}

View File

@ -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();

View File

@ -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 <http://www.gnu.org/licenses/>.
*/
//Keymap specific config.h
#pragma once
#define DYNAMIC_KEYMAP_LAYER_COUNT 4

View File

@ -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.

View File

@ -1,161 +1,76 @@
#include <stdint.h>
#include <stdbool.h>
#include <avr/io.h>
#include "wait.h"
#include "action_layer.h"
#include "print.h"
#include "debug.h"
#include "util.h"
// Copyright 2022 QMK
// SPDX-License-Identifier: GPL-2.0-or-later
#include "gpio.h"
#include "matrix.h"
#include "ergodone.h"
#include "expander.h"
#include "mcp23018.h"
#include "util.h"
#include "wait.h"
#include "debug.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.
*/
#define I2C_ADDR 0x20
#ifndef DEBOUNCE
# define DEBOUNCE 5
#endif
static uint8_t mcp23018_errors = 0;
/* 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);
__attribute__ ((weak))
void matrix_init_user(void) {}
__attribute__ ((weak))
void matrix_scan_user(void) {}
__attribute__ ((weak))
void matrix_init_kb(void) {
matrix_init_user();
static void expander_init(void) {
mcp23018_init(I2C_ADDR);
}
__attribute__ ((weak))
void matrix_scan_kb(void) {
matrix_scan_user();
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_rows(void)
{
return MATRIX_ROWS;
}
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;
mcp23018_errors += !mcp23018_set_config(I2C_ADDR, mcp23018_PORTB, ALL_INPUT);
}
// 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;
static matrix_row_t expander_read_row(void) {
if (mcp23018_errors) {
return 0;
}
}
uint8_t ret = 0xFF;
mcp23018_errors += !mcp23018_readPins(I2C_ADDR, mcp23018_PORTA, &ret);
ret = bitrev(~ret);
ret = ((ret & 0b11111000) >> 1) | (ret & 0b00000011);
return ((uint16_t)ret) << 7;
}
uint8_t matrix_scan(void)
{
expander_scan();
static void expander_scan(void) {
if (!mcp23018_errors) {
return;
}
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();
}
matrix_scan_quantum();
return 1;
}
inline
bool matrix_is_on(uint8_t row, uint8_t col)
{
return (matrix[row] & ((matrix_row_t)1<<col));
}
inline
matrix_row_t matrix_get_row(uint8_t row)
{
return matrix[row];
}
void matrix_print(void)
{
print("\nr/c 0123456789ABCDEF\n");
for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
print_hex8(row); print(": ");
print_bin_reverse16(matrix_get_row(row));
print("\n");
}
static uint16_t mcp23018_reset_loop = 0;
if (++mcp23018_reset_loop > 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<<PE6);
PORTE |= (1<<PE6);
DDRD &= ~(1<<PD2 | 1<<PD3 | 1<<PD4 | 1<<PD7);
PORTD |= (1<<PD2 | 1<<PD3 | 1<<PD4 | 1<<PD7);
DDRC &= ~(1<<PC6);
PORTC |= (1<<PC6);
DDRB &= ~(1<<PB4);
PORTB |= (1<<PB4);
static void init_cols(void) {
// Pro Micro
setPinInputHigh(E6);
setPinInputHigh(D2);
setPinInputHigh(D3);
setPinInputHigh(D4);
setPinInputHigh(D7);
setPinInputHigh(C6);
setPinInputHigh(B4);
// MCP23017
expander_init();
// Expander
expander_init_cols();
}
static matrix_row_t read_cols(uint8_t row)
{
return expander_read_row() |
(PIND&(1<<PD3) ? 0 : (1<<6)) |
(PIND&(1<<PD2) ? 0 : (1<<5)) |
(PIND&(1<<PD4) ? 0 : (1<<4)) |
(PINC&(1<<PC6) ? 0 : (1<<3)) |
(PIND&(1<<PD7) ? 0 : (1<<2)) |
(PINE&(1<<PE6) ? 0 : (1<<1)) |
(PINB&(1<<PB4) ? 0 : (1<<0)) ;
static matrix_row_t read_cols(void) {
// clang-format off
return expander_read_row() |
(readPin(D3) ? 0 : (1<<6)) |
(readPin(D2) ? 0 : (1<<5)) |
(readPin(D4) ? 0 : (1<<4)) |
(readPin(C6) ? 0 : (1<<3)) |
(readPin(D7) ? 0 : (1<<2)) |
(readPin(E6) ? 0 : (1<<1)) |
(readPin(B4) ? 0 : (1<<0)) ;
// clang-format on
}
/* Row pin configuration
@ -200,48 +114,122 @@ static matrix_row_t read_cols(uint8_t row)
*
* Expander: 0 1 2 3 4 5
*/
static void unselect_rows(void)
{
// Pro Micro
DDRF &= ~(1<<PF4 | 1<<PF5 | 1<<PF6 | 1<<PF7);
PORTF &= ~(1<<PF4 | 1<<PF5 | 1<<PF6 | 1<<PF7);
DDRB &= ~(1<<PB1 | 1<<PB2);
PORTB &= ~(1<<PB1 | 1<<PB2);
static void unselect_rows(void) {
// Pro Micro
setPinInput(B1);
setPinInput(B2);
setPinInput(F4);
setPinInput(F5);
setPinInput(F6);
setPinInput(F7);
writePinLow(B1);
writePinLow(B2);
writePinLow(F4);
writePinLow(F5);
writePinLow(F6);
writePinLow(F7);
// Expander
expander_unselect_rows();
// Expander
expander_unselect_rows();
}
static void select_row(uint8_t row)
{
// Pro Micro
switch (row) {
case 0:
DDRF |= (1<<PF4);
PORTF &= ~(1<<PF4);
break;
case 1:
DDRF |= (1<<PF5);
PORTF &= ~(1<<PF5);
break;
case 2:
DDRF |= (1<<PF6);
PORTF &= ~(1<<PF6);
break;
case 3:
DDRF |= (1<<PF7);
PORTF &= ~(1<<PF7);
break;
case 4:
DDRB |= (1<<PB1);
PORTB &= ~(1<<PB1);
break;
case 5:
DDRB |= (1<<PB2);
PORTB &= ~(1<<PB2);
break;
}
static void unselect_row(uint8_t row) {
// Pro Micro
switch (row) {
case 0:
setPinInput(F4);
writePinLow(F4);
break;
case 1:
setPinInput(F5);
writePinLow(F5);
break;
case 2:
setPinInput(F6);
writePinLow(F6);
break;
case 3:
setPinInput(F7);
writePinLow(F7);
break;
case 4:
setPinInput(B1);
writePinLow(B1);
break;
case 5:
setPinInput(B2);
writePinLow(B2);
break;
}
expander_select_row(row);
// Expander
expander_unselect_row(row);
}
static void select_row(uint8_t row) {
// Pro Micro
switch (row) {
case 0:
setPinOutput(F4);
writePinLow(F4);
break;
case 1:
setPinOutput(F5);
writePinLow(F5);
break;
case 2:
setPinOutput(F6);
writePinLow(F6);
break;
case 3:
setPinOutput(F7);
writePinLow(F7);
break;
case 4:
setPinOutput(B1);
writePinLow(B1);
break;
case 5:
setPinOutput(B2);
writePinLow(B2);
break;
}
// Expander
expander_select_row(row);
}
static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) {
// Store last value of row prior to reading
matrix_row_t last_row_value = current_matrix[current_row];
// Clear data in matrix row
current_matrix[current_row] = 0;
// Select row and wait for row selection to stabilize
select_row(current_row);
// Skip the wait_us(30); as i2c is slow enough to debounce the io changes
current_matrix[current_row] = read_cols();
unselect_row(current_row);
return (last_row_value != current_matrix[current_row]);
}
void matrix_init_custom(void) {
expander_init();
unselect_rows();
init_cols();
}
bool matrix_scan_custom(matrix_row_t current_matrix[]) {
expander_scan();
bool changed = false;
for (uint8_t current_row = 0; current_row < MATRIX_ROWS; current_row++) {
changed |= read_cols_on_row(current_matrix, current_row);
}
return changed;
}

View File

@ -1,28 +1,6 @@
# MCU name
MCU = atmega32u4
# custom matrix setup
CUSTOM_MATRIX = lite
# Bootloader selection
BOOTLOADER = caterina
# Build Options
# change yes to no to disable
#
CUSTOM_MATRIX = yes # Custom matrix file for the ErgoDone
UNICODE_ENABLE = yes # Unicode
BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite
MOUSEKEY_ENABLE = yes # Mouse keys
EXTRAKEY_ENABLE = yes # Audio control and System control
CONSOLE_ENABLE = no # Console for debug
COMMAND_ENABLE = no # Commands for debug and configuration
NKRO_ENABLE = yes # Enable N-Key Rollover
BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
SWAP_HANDS_ENABLE = no # Disable Onehand
RGBLIGHT_ENABLE = no
# project specific files
VPATH += drivers/gpio
SRC += mcp23018.c matrix.c
QUANTUM_LIB_SRC += i2c_master.c
SRC = \
matrix.c \
expander.c \
LAYOUTS = ergodox