summaryrefslogtreecommitdiff
path: root/keyboards/ergodox_ez
diff options
context:
space:
mode:
Diffstat (limited to 'keyboards/ergodox_ez')
-rw-r--r--keyboards/ergodox_ez/190hotfix.sh19
-rw-r--r--keyboards/ergodox_ez/Makefile8
-rw-r--r--keyboards/ergodox_ez/config.h109
-rw-r--r--keyboards/ergodox_ez/ergodox_ez.c136
-rw-r--r--keyboards/ergodox_ez/ergodox_ez.h165
-rw-r--r--keyboards/ergodox_ez/i2cmaster.h178
-rw-r--r--keyboards/ergodox_ez/keymaps/blakedietz/keymap.c289
-rw-r--r--keyboards/ergodox_ez/keymaps/default/default.png.md1
-rw-r--r--keyboards/ergodox_ez/keymaps/default/default_highres.png.md1
-rw-r--r--keyboards/ergodox_ez/keymaps/default/keymap.c223
-rw-r--r--keyboards/ergodox_ez/keymaps/default/readme.md15
-rw-r--r--keyboards/ergodox_ez/keymaps/default_osx/keymap.c187
-rw-r--r--keyboards/ergodox_ez/keymaps/default_osx/readme.md8
-rw-r--r--keyboards/ergodox_ez/keymaps/drashna-custom/Makefile10
-rw-r--r--keyboards/ergodox_ez/keymaps/drashna-custom/config.h8
-rw-r--r--keyboards/ergodox_ez/keymaps/drashna-custom/keymap.c867
-rw-r--r--keyboards/ergodox_ez/keymaps/drashna/Makefile6
-rw-r--r--keyboards/ergodox_ez/keymaps/drashna/config.h11
-rw-r--r--keyboards/ergodox_ez/keymaps/drashna/keymap.c195
-rw-r--r--keyboards/ergodox_ez/keymaps/drashna/readme.md9
-rw-r--r--keyboards/ergodox_ez/keymaps/profet_80/keymap.c183
-rw-r--r--keyboards/ergodox_ez/keymaps/profet_80/readme.md10
-rw-r--r--keyboards/ergodox_ez/keymaps/steno/Makefile3
-rw-r--r--keyboards/ergodox_ez/keymaps/steno/keymap.c324
-rw-r--r--keyboards/ergodox_ez/keymaps/steno/readme.md92
-rw-r--r--keyboards/ergodox_ez/matrix.c394
-rw-r--r--keyboards/ergodox_ez/readme.md33
-rw-r--r--keyboards/ergodox_ez/rules.mk86
-rw-r--r--keyboards/ergodox_ez/twimaster.c208
-rw-r--r--keyboards/ergodox_ez/util/compile_keymap.py710
-rw-r--r--keyboards/ergodox_ez/util/readme.md3
31 files changed, 4491 insertions, 0 deletions
diff --git a/keyboards/ergodox_ez/190hotfix.sh b/keyboards/ergodox_ez/190hotfix.sh
new file mode 100644
index 0000000000..bdc3adce22
--- /dev/null
+++ b/keyboards/ergodox_ez/190hotfix.sh
@@ -0,0 +1,19 @@
+#!/bin/bash
+#a tool to fix broken keymaps as a result of pull request #190
+#changing the declaration of matrix_scan_user() and matrix_init_user()
+#
+#This script will save a copy of the specified keymap as keymap.c.bak
+#and then create a new keymap.c with the definion corrected.
+#this script must be run from the ergodox_ez directory
+if [ $# -ne 1 ]; then
+ echo $0: usage: ./190hotfix keymap_name
+ exit 1
+fi
+
+echo Saving backup as ./keymaps/$1/keymap.c.bak ...
+mv ./keymaps/$1/keymap.c ./keymaps/$1/keymap.c.bak
+
+echo Modifying ./keymaps/$1/keymap.c ...
+cat ./keymaps/$1/keymap.c.bak | sed -r 's/^void \* matrix_/void matrix_/'>./keymaps/$1/keymap.c
+
+echo Complete!
diff --git a/keyboards/ergodox_ez/Makefile b/keyboards/ergodox_ez/Makefile
new file mode 100644
index 0000000000..e24600d884
--- /dev/null
+++ b/keyboards/ergodox_ez/Makefile
@@ -0,0 +1,8 @@
+SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
+COMMAND_ENABLE = no # Commands for debug and configuration
+RGBLIGHT_ENABLE = yes
+MIDI_ENABLE = no
+
+ifndef MAKEFILE_INCLUDED
+ include ../../Makefile
+endif
diff --git a/keyboards/ergodox_ez/config.h b/keyboards/ergodox_ez/config.h
new file mode 100644
index 0000000000..b258a5b2e6
--- /dev/null
+++ b/keyboards/ergodox_ez/config.h
@@ -0,0 +1,109 @@
+/*
+Copyright 2012 Jun Wako <wakojun@gmail.com>
+Copyright 2013 Oleg Kostyuk <cub.uanic@gmail.com>
+
+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/>.
+*/
+
+#ifndef ERGODOX_EZ_CONFIG_H
+#define ERGODOX_EZ_CONFIG_H
+
+#include "config_common.h"
+
+/* USB Device descriptor parameter */
+#define VENDOR_ID 0xFEED
+#define PRODUCT_ID 0x1307
+#define DEVICE_VER 0x0001
+#define MANUFACTURER ErgoDox EZ
+#define PRODUCT ErgoDox EZ
+#define DESCRIPTION QMK keyboard firmware for Ergodox EZ
+
+/* key matrix size */
+#define MATRIX_ROWS 14
+#define MATRIX_COLS 6
+
+#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() ( \
+ keyboard_report->mods == (MOD_BIT(KC_LCTL) | MOD_BIT(KC_RCTL)) || \
+ keyboard_report->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
+
+/* ws2812 RGB LED */
+#define RGB_DI_PIN D7
+#define RGBLIGHT_ANIMATIONS
+#define RGBLED_NUM 15 // Number of LEDs
+#define RGBLIGHT_HUE_STEP 12
+#define RGBLIGHT_SAT_STEP 255
+#define RGBLIGHT_VAL_STEP 12
+
+/* fix space cadet rollover issue */
+#define DISABLE_SPACE_CADET_ROLLOVER
+
+// #define RGB_MIDI
+#define RGBW_BB_TWI
+
+#define RGBW 1
+
+/* Set 0 if debouncing isn't needed */
+#define DEBOUNCE 15
+
+#define PREVENT_STUCK_MODIFIERS
+
+#define USB_MAX_POWER_CONSUMPTION 500
+
+/*
+ * 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 NO_ACTION_MACRO
+//#define NO_ACTION_FUNCTION
+//#define DEBUG_MATRIX_SCAN_RATE
+
+#endif
diff --git a/keyboards/ergodox_ez/ergodox_ez.c b/keyboards/ergodox_ez/ergodox_ez.c
new file mode 100644
index 0000000000..3609f6f810
--- /dev/null
+++ b/keyboards/ergodox_ez/ergodox_ez.c
@@ -0,0 +1,136 @@
+#include QMK_KEYBOARD_H
+#include "i2cmaster.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_on(void);
+extern inline void ergodox_led_all_off(void);
+
+extern inline void ergodox_right_led_1_set(uint8_t n);
+extern inline void ergodox_right_led_2_set(uint8_t n);
+extern inline void ergodox_right_led_3_set(uint8_t n);
+extern inline void ergodox_right_led_set(uint8_t led, uint8_t n);
+
+extern inline void ergodox_led_all_set(uint8_t n);
+
+
+bool i2c_initialized = 0;
+uint8_t mcp23018_status = 0x20;
+
+void matrix_init_kb(void) {
+ // keyboard LEDs (see "PWM on ports OC1(A|B|C)" in "teensy-2-0.md")
+ TCCR1A = 0b10101001; // set and configure fast PWM
+ TCCR1B = 0b00001001; // set and configure fast PWM
+
+ // (tied to Vcc for hardware convenience)
+ DDRB &= ~(1<<4); // set B(4) as input
+ PORTB &= ~(1<<4); // set B(4) internal pull-up disabled
+
+ // unused pins - C7, D4, D5, D7, E6
+ // set as input with internal pull-ip enabled
+ DDRC &= ~(1<<7);
+ DDRD &= ~(1<<5 | 1<<4);
+ DDRE &= ~(1<<6);
+ PORTC |= (1<<7);
+ PORTD |= (1<<5 | 1<<4);
+ PORTE |= (1<<6);
+
+ ergodox_blink_all_leds();
+
+ matrix_init_user();
+}
+
+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();
+}
+
+uint8_t init_mcp23018(void) {
+ mcp23018_status = 0x20;
+
+ // I2C subsystem
+
+ // uint8_t sreg_prev;
+ // sreg_prev=SREG;
+ // cli();
+ if (i2c_initialized == 0) {
+ i2c_init(); // on pins D(1,0)
+ i2c_initialized = true;
+ _delay_ms(1000);
+ }
+
+ // set pin direction
+ // - unused : input : 1
+ // - input : input : 1
+ // - driving : output : 0
+ mcp23018_status = i2c_start(I2C_ADDR_WRITE); if (mcp23018_status) goto out;
+ mcp23018_status = i2c_write(IODIRA); if (mcp23018_status) goto out;
+ mcp23018_status = i2c_write(0b00000000); if (mcp23018_status) goto out;
+ mcp23018_status = i2c_write(0b00111111); if (mcp23018_status) goto out;
+ i2c_stop();
+
+ // set pull-up
+ // - unused : on : 1
+ // - input : on : 1
+ // - driving : off : 0
+ mcp23018_status = i2c_start(I2C_ADDR_WRITE); if (mcp23018_status) goto out;
+ mcp23018_status = i2c_write(GPPUA); if (mcp23018_status) goto out;
+ mcp23018_status = i2c_write(0b00000000); if (mcp23018_status) goto out;
+ mcp23018_status = i2c_write(0b00111111); if (mcp23018_status) goto out;
+
+out:
+ i2c_stop();
+
+ // SREG=sreg_prev;
+
+ return mcp23018_status;
+}
+
+#ifdef ONEHAND_ENABLE
+__attribute__ ((weak))
+// swap-hands action needs a matrix to define the swap
+const keypos_t hand_swap_config[MATRIX_ROWS][MATRIX_COLS] = {
+ /* Left hand, matrix positions */
+ {{0,13}, {1,13}, {2,13}, {3,13}, {4,13}, {5,13}},
+ {{0,12}, {1,12}, {2,12}, {3,12}, {4,12}, {5,12}},
+ {{0,11}, {1,11}, {2,11}, {3,11}, {4,11}, {5,11}},
+ {{0,10}, {1,10}, {2,10}, {3,10}, {4,10}, {5,10}},
+ {{0,9}, {1,9}, {2,9}, {3,9}, {4,9}, {5,9}},
+ {{0,8}, {1,8}, {2,8}, {3,8}, {4,8}, {5,8}},
+ {{0,7}, {1,7}, {2,7}, {3,7}, {4,7}, {5,7}},
+ /* Right hand, matrix positions */
+ {{0,6}, {1,6}, {2,6}, {3,6}, {4,6}, {5,6}},
+ {{0,5}, {1,5}, {2,5}, {3,5}, {4,5}, {5,5}},
+ {{0,4}, {1,4}, {2,4}, {3,4}, {4,4}, {5,4}},
+ {{0,3}, {1,3}, {2,3}, {3,3}, {4,3}, {5,3}},
+ {{0,2}, {1,2}, {2,2}, {3,2}, {4,2}, {5,2}},
+ {{0,1}, {1,1}, {2,1}, {3,1}, {4,1}, {5,1}},
+ {{0,0}, {1,0}, {2,0}, {3,0}, {4,0}, {5,0}},
+};
+#endif
diff --git a/keyboards/ergodox_ez/ergodox_ez.h b/keyboards/ergodox_ez/ergodox_ez.h
new file mode 100644
index 0000000000..1f8d597519
--- /dev/null
+++ b/keyboards/ergodox_ez/ergodox_ez.h
@@ -0,0 +1,165 @@
+#ifndef ERGODOX_EZ_H
+#define ERGODOX_EZ_H
+
+#include "quantum.h"
+#include <stdint.h>
+#include <stdbool.h>
+#include "i2cmaster.h"
+#include <util/delay.h>
+
+#define CPU_PRESCALE(n) (CLKPR = 0x80, CLKPR = (n))
+#define CPU_16MHz 0x00
+
+// I2C aliases and register addresses (see "mcp23018.md")
+#define I2C_ADDR 0b0100000
+#define I2C_ADDR_WRITE ( (I2C_ADDR<<1) | I2C_WRITE )
+#define I2C_ADDR_READ ( (I2C_ADDR<<1) | I2C_READ )
+#define IODIRA 0x00 // i/o direction register
+#define IODIRB 0x01
+#define GPPUA 0x0C // GPIO pull-up resistor register
+#define GPPUB 0x0D
+#define GPIOA 0x12 // general purpose i/o port register (write modifies OLAT)
+#define GPIOB 0x13
+#define OLATA 0x14 // output latch register
+#define OLATB 0x15
+
+extern uint8_t mcp23018_status;
+
+void init_ergodox(void);
+void ergodox_blink_all_leds(void);
+uint8_t init_mcp23018(void);
+uint8_t ergodox_left_leds_update(void);
+
+#define LED_BRIGHTNESS_LO 15
+#define LED_BRIGHTNESS_HI 255
+
+
+inline void ergodox_board_led_on(void) { DDRD |= (1<<6); PORTD |= (1<<6); }
+inline void ergodox_right_led_1_on(void) { DDRB |= (1<<5); PORTB |= (1<<5); }
+inline void ergodox_right_led_2_on(void) { DDRB |= (1<<6); PORTB |= (1<<6); }
+inline void ergodox_right_led_3_on(void) { DDRB |= (1<<7); PORTB |= (1<<7); }
+inline void ergodox_right_led_on(uint8_t led) { DDRB |= (1<<(led+4)); PORTB |= (1<<(led+4)); }
+
+inline void ergodox_board_led_off(void) { DDRD &= ~(1<<6); PORTD &= ~(1<<6); }
+inline void ergodox_right_led_1_off(void) { DDRB &= ~(1<<5); PORTB &= ~(1<<5); }
+inline void ergodox_right_led_2_off(void) { DDRB &= ~(1<<6); PORTB &= ~(1<<6); }
+inline void ergodox_right_led_3_off(void) { DDRB &= ~(1<<7); PORTB &= ~(1<<7); }
+inline void ergodox_right_led_off(uint8_t led) { DDRB &= ~(1<<(led+4)); PORTB &= ~(1<<(led+4)); }
+
+inline void ergodox_led_all_on(void)
+{
+ ergodox_board_led_on();
+ ergodox_right_led_1_on();
+ ergodox_right_led_2_on();
+ ergodox_right_led_3_on();
+}
+
+inline void ergodox_led_all_off(void)
+{
+ ergodox_board_led_off();
+ ergodox_right_led_1_off();
+ ergodox_right_led_2_off();
+ ergodox_right_led_3_off();
+}
+
+inline void ergodox_right_led_1_set(uint8_t n) { OCR1A = n; }
+inline void ergodox_right_led_2_set(uint8_t n) { OCR1B = n; }
+inline void ergodox_right_led_3_set(uint8_t n) { OCR1C = n; }
+inline void ergodox_right_led_set(uint8_t led, uint8_t n) {
+ (led == 1) ? (OCR1A = n) :
+ (led == 2) ? (OCR1B = n) :
+ (OCR1C = n);
+}
+
+inline void ergodox_led_all_set(uint8_t n)
+{
+ ergodox_right_led_1_set(n);
+ ergodox_right_led_2_set(n);
+ ergodox_right_led_3_set(n);
+}
+
+#define KEYMAP( \
+ \
+ /* left hand, spatial positions */ \
+ 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, \
+ \
+ /* right hand, spatial positions */ \
+ 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 ) \
+ \
+ /* matrix positions */ \
+ { \
+ { k00, k10, k20, k30, k40, KC_NO }, \
+ { k01, k11, k21, k31, k41, k51 }, \
+ { k02, k12, k22, k32, k42, k52 }, \
+ { k03, k13, k23, k33, k43, k53 }, \
+ { k04, k14, k24, k34, k44, k54 }, \
+ { k05, k15, k25, k35, KC_NO, k55 }, \
+ { k06, k16, KC_NO, k36, KC_NO, k56 }, \
+ \
+ { k07, k17, KC_NO, k37,KC_NO, k57 }, \
+ { k08, k18, k28, k38,KC_NO, k58 }, \
+ { k09, k19, k29, k39, k49, k59 }, \
+ { k0A, k1A, k2A, k3A, k4A, k5A }, \
+ { k0B, k1B, k2B, k3B, k4B, k5B }, \
+ { k0C, k1C, k2C, k3C, k4C, k5C }, \
+ { k0D, k1D, k2D, k3D, k4D, KC_NO } \
+ }
+
+#define KEYMAP_80( \
+ \
+ /* left hand, spatial positions */ \
+ k00,k01,k02,k03,k04,k05,k06, \
+ k10,k11,k12,k13,k14,k15,k16, \
+ k20,k21,k22,k23,k24,k25, \
+ k30,k31,k32,k33,k34,k35,k36, \
+ k40,k41,k42,k43,k44, \
+ k55,k56, \
+ k45,k46,k54, \
+ k53,k52,k51, \
+ \
+ /* right hand, spatial positions */ \
+ k07,k08,k09,k0A,k0B,k0C,k0D, \
+ k17,k18,k19,k1A,k1B,k1C,k1D, \
+ k28,k29,k2A,k2B,k2C,k2D, \
+ k37,k38,k39,k3A,k3B,k3C,k3D, \
+ k49,k4A,k4B,k4C,k4D, \
+ k57,k58, \
+ k59,k47,k48, \
+ k5C,k5B,k5A ) \
+ \
+ /* matrix positions */ \
+ { \
+ { k00, k10, k20, k30, k40, KC_NO }, \
+ { k01, k11, k21, k31, k41, k51 }, \
+ { k02, k12, k22, k32, k42, k52 }, \
+ { k03, k13, k23, k33, k43, k53 }, \
+ { k04, k14, k24, k34, k44, k54 }, \
+ { k05, k15, k25, k35, k45, k55 }, \
+ { k06, k16, KC_NO, k36, k46, k56 }, \
+ \
+ { k07, k17, KC_NO, k37, k47, k57 }, \
+ { k08, k18, k28, k38, k48, k58 }, \
+ { k09, k19, k29, k39, k49, k59 }, \
+ { k0A, k1A, k2A, k3A, k4A, k5A }, \
+ { k0B, k1B, k2B, k3B, k4B, k5B }, \
+ { k0C, k1C, k2C, k3C, k4C, k5C }, \
+ { k0D, k1D, k2D, k3D, k4D, KC_NO } \
+ }
+
+#define LAYOUT_ergodox KEYMAP
+
+#endif
diff --git a/keyboards/ergodox_ez/i2cmaster.h b/keyboards/ergodox_ez/i2cmaster.h
new file mode 100644
index 0000000000..3917b9e6c0
--- /dev/null
+++ b/keyboards/ergodox_ez/i2cmaster.h
@@ -0,0 +1,178 @@
+#ifndef _I2CMASTER_H
+#define _I2CMASTER_H 1
+/*************************************************************************
+* Title: C include file for the I2C master interface
+* (i2cmaster.S or twimaster.c)
+* Author: Peter Fleury <pfleury@gmx.ch> http://jump.to/fleury
+* File: $Id: i2cmaster.h,v 1.10 2005/03/06 22:39:57 Peter Exp $
+* Software: AVR-GCC 3.4.3 / avr-libc 1.2.3
+* Target: any AVR device
+* Usage: see Doxygen manual
+**************************************************************************/
+
+#ifdef DOXYGEN
+/**
+ @defgroup pfleury_ic2master I2C Master library
+ @code #include <i2cmaster.h> @endcode
+
+ @brief I2C (TWI) Master Software Library
+
+ Basic routines for communicating with I2C slave devices. This single master
+ implementation is limited to one bus master on the I2C bus.
+
+ This I2c library is implemented as a compact assembler software implementation of the I2C protocol
+ which runs on any AVR (i2cmaster.S) and as a TWI hardware interface for all AVR with built-in TWI hardware (twimaster.c).
+ Since the API for these two implementations is exactly the same, an application can be linked either against the
+ software I2C implementation or the hardware I2C implementation.
+
+ Use 4.7k pull-up resistor on the SDA and SCL pin.
+
+ Adapt the SCL and SDA port and pin definitions and eventually the delay routine in the module
+ i2cmaster.S to your target when using the software I2C implementation !
+
+ Adjust the CPU clock frequence F_CPU in twimaster.c or in the Makfile when using the TWI hardware implementaion.
+
+ @note
+ The module i2cmaster.S is based on the Atmel Application Note AVR300, corrected and adapted
+ to GNU assembler and AVR-GCC C call interface.
+ Replaced the incorrect quarter period delays found in AVR300 with
+ half period delays.
+
+ @author Peter Fleury pfleury@gmx.ch http://jump.to/fleury
+
+ @par API Usage Example
+ The following code shows typical usage of this library, see example test_i2cmaster.c
+
+ @code
+
+ #include <i2cmaster.h>
+
+
+ #define Dev24C02 0xA2 // device address of EEPROM 24C02, see datasheet
+
+ int main(void)
+ {
+ unsigned char ret;
+
+ i2c_init(); // initialize I2C library
+
+ // write 0x75 to EEPROM address 5 (Byte Write)
+ i2c_start_wait(Dev24C02+I2C_WRITE); // set device address and write mode
+ i2c_write(0x05); // write address = 5
+ i2c_write(0x75); // write value 0x75 to EEPROM
+ i2c_stop(); // set stop conditon = release bus
+
+
+ // read previously written value back from EEPROM address 5
+ i2c_start_wait(Dev24C02+I2C_WRITE); // set device address and write mode
+
+ i2c_write(0x05); // write address = 5
+ i2c_rep_start(Dev24C02+I2C_READ); // set device address and read mode
+
+ ret = i2c_readNak(); // read one byte from EEPROM
+ i2c_stop();
+
+ for(;;);
+ }
+ @endcode
+
+*/
+#endif /* DOXYGEN */
+
+/**@{*/
+
+#if (__GNUC__ * 100 + __GNUC_MINOR__) < 304
+#error "This library requires AVR-GCC 3.4 or later, update to newer AVR-GCC compiler !"
+#endif
+
+#include <avr/io.h>
+
+/** defines the data direction (reading from I2C device) in i2c_start(),i2c_rep_start() */
+#define I2C_READ 1
+
+/** defines the data direction (writing to I2C device) in i2c_start(),i2c_rep_start() */
+#define I2C_WRITE 0
+
+
+/**
+ @brief initialize the I2C master interace. Need to be called only once
+ @param void
+ @return none
+ */
+extern void i2c_init(void);
+
+
+/**
+ @brief Terminates the data transfer and releases the I2C bus
+ @param void
+ @return none
+ */
+extern void i2c_stop(void);
+
+
+/**
+ @brief Issues a start condition and sends address and transfer direction
+
+ @param addr address and transfer direction of I2C device
+ @retval 0 device accessible
+ @retval 1 failed to access device
+ */
+extern unsigned char i2c_start(unsigned char addr);
+
+
+/**
+ @brief Issues a repeated start condition and sends address and transfer direction
+
+ @param addr address and transfer direction of I2C device
+ @retval 0 device accessible
+ @retval 1 failed to access device
+ */
+extern unsigned char i2c_rep_start(unsigned char addr);
+
+
+/**
+ @brief Issues a start condition and sends address and transfer direction
+
+ If device is busy, use ack polling to wait until device ready
+ @param addr address and transfer direction of I2C device
+ @return none
+ */
+extern void i2c_start_wait(unsigned char addr);
+
+
+/**
+ @brief Send one byte to I2C device
+ @param data byte to be transfered
+ @retval 0 write successful
+ @retval 1 write failed
+ */
+extern unsigned char i2c_write(unsigned char data);
+
+
+/**
+ @brief read one byte from the I2C device, request more data from device
+ @return byte read from I2C device
+ */
+extern unsigned char i2c_readAck(void);
+
+/**
+ @brief read one byte from the I2C device, read is followed by a stop condition
+ @return byte read from I2C device
+ */
+extern unsigned char i2c_readNak(void);
+
+/**
+ @brief read one byte from the I2C device
+
+ Implemented as a macro, which calls either i2c_readAck or i2c_readNak
+
+ @param ack 1 send ack, request more data from device<br>
+ 0 send nak, read is followed by a stop condition
+ @return byte read from I2C device
+ */
+extern unsigned char i2c_read(unsigned char ack);
+#define i2c_read(ack) (ack) ? i2c_readAck() : i2c_readNak();
+
+
+/**@}*/
+#endif
diff --git a/keyboards/ergodox_ez/keymaps/blakedietz/keymap.c b/keyboards/ergodox_ez/keymaps/blakedietz/keymap.c
new file mode 100644
index 0000000000..a35f86d665
--- /dev/null
+++ b/keyboards/ergodox_ez/keymaps/blakedietz/keymap.c
@@ -0,0 +1,289 @@
+#include QMK_KEYBOARD_H
+#include "debug.h"
+#include "action_layer.h"
+
+/**
+ * This section of macros is for tap or hold functionality. Keys will fire off the second symbol in the name if tapped
+ * or fire the first symbol in the name if held. For example
+ * GUI_Z
+ *
+ * - will fire z if tapped
+ * - will fire cmd/super/win if held
+ */
+#define ALT_DOT ALT_T(KC_DOT)
+#define ALT_X ALT_T(KC_X)
+#define CTL_SLSH CTL_T(KC_SLSH)
+#define CTL_Z CTL_T(KC_Z)
+#define GUI_C GUI_T(KC_C)
+#define GUI_COMM GUI_T(KC_COMM)
+#define HPR_ESC ALL_T(KC_ESC)
+#define HPR_QUO ALL_T(KC_QUOT)
+
+#define BASE 0
+#define SYMB 1
+#define MDIA 2
+#define MOUSE 3
+#define DEV 4
+
+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+/* Keymap 0: Basic layer
+ *
+ * ,--------------------------------------------------. ,--------------------------------------------------.
+ * | = | 1 | 2 | 3 | 4 | 5 | LEFT | | RIGHT| 6 | 7 | 8 | 9 | 0 | - |
+ * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
+ * | Del | Q | W | E | R | T | L1 | | L1 | Y | U | I | O | P | \ |
+ * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
+ * | BkSp | A | S | D | F | G |------| |------| H | J | K | L |; / L2| '" |
+ * |--------+------+------+------+------+------| Hyper| | Meh |------+------+------+------+------+--------|
+ * | LShift |Z/Ctrl|X/Alt |C/GUI | V | B | | | | N | M |,/GUI |./ALT |//Ctrl| RShift |
+ * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
+ * |Grv/L1| '" |AltShf| Left | Right| | Up | Down | [ | ] | ~L1 |
+ * `----------------------------------' `----------------------------------'
+ * ,-------------. ,------------.
+ * |MOUSE | Home | | PgDn | PgUp|
+ * ,------|------|------| |------+-----+------.
+ * | | | ESC | | ESC | | |
+ * | Space|Backsp|------| |------| Tab |Enter |
+ * | |ace | LGui | | LGui | | |
+ * `--------------------' `-------------------'
+ */
+// If it accepts an argument (i.e, is a function), it doesn't need KC_.
+// Otherwise, it needs KC_*
+[BASE] = KEYMAP( // layer 0 : default
+ // left hand
+ KC_EQL, KC_1, KC_2, KC_3, KC_4, KC_5, KC_LEFT,
+ KC_DELT, KC_Q, KC_W, KC_E, KC_R, KC_T, TG(DEV),
+ KC_BSPC, KC_A, KC_S, KC_D, KC_F, KC_G,
+ KC_LSFT, CTL_T(KC_Z), ALT_T(KC_X), GUI_T(KC_C), KC_V, KC_B, ALL_T(KC_NO),
+ LT(SYMB,KC_GRV), KC_QUOT, LALT(KC_LSFT), KC_LEFT, KC_RGHT,
+
+ TG(MOUSE), KC_HOME,
+ KC_ESC,
+ KC_SPC, KC_BSPC, KC_LGUI,
+
+ // right hand
+ KC_RGHT, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS,
+ TG(SYMB), KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLS,
+ KC_H, KC_J, KC_K, KC_L, LT(MDIA, KC_SCLN), KC_QUOT,
+ MEH_T(KC_NO), KC_N, KC_M, GUI_COMM, ALT_DOT, CTL_SLSH, KC_RSFT,
+ KC_DOWN, KC_UP, KC_LBRC, KC_RBRC, KC_FN1,
+
+ KC_PGDN, KC_PGUP,
+ KC_ESC,
+ KC_LGUI, KC_TAB, KC_ENT
+ ),
+/* Keymap 1: Symbol Layer
+ *
+ * ,--------------------------------------------------. ,--------------------------------------------------.
+ * | | F1 | F2 | F3 | F4 | F5 | | | | F6 | F7 | F8 | F9 | F10 | F11 |
+ * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
+ * | | ! | @ | { | } | | | | | | Up | 7 | 8 | 9 | * | F12 |
+ * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
+ * | | # | $ | ( | ) | ` |------| |------| Down | 4 | 5 | 6 | + | |
+ * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
+ * | | % | ^ | [ | ] | ~ | | | | & | 1 | 2 | 3 | \ | |
+ * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
+ * | | | | | | | | . | 0 | = | |
+ * `----------------------------------' `----------------------------------'
+ * ,-------------. ,-------------.
+ * | | | | | |
+ * ,------|------|------| |------+------+------.
+ * | | | | | | | |
+ * | | |------| |------| | |
+ * | | | | | | | |
+ * `--------------------' `--------------------'
+ */
+// SYMBOLS
+[SYMB] = KEYMAP(
+ // left hand
+ KC_TRNS,KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_TRNS,
+ KC_TRNS,KC_EXLM,KC_AT, KC_LCBR,KC_RCBR,KC_PIPE,KC_TRNS,
+ 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,
+ KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,
+ KC_TRNS,KC_TRNS,
+ KC_TRNS,
+ KC_TRNS,KC_TRNS,KC_TRNS,
+ // right hand
+ KC_TRNS, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11,
+ KC_TRNS, KC_UP, KC_7, KC_8, KC_9, KC_ASTR, KC_F12,
+ 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,
+ KC_TRNS, KC_TRNS,
+ KC_TRNS,
+ KC_TRNS, KC_TRNS, KC_TRNS
+),
+/* Keymap 2: Media and mouse keys
+ *
+ * ,--------------------------------------------------. ,--------------------------------------------------.
+ * | | | | | | | | | | | | | | | |
+ * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
+ * | | | | | | | | | | | | | | | |
+ * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
+ * | | | | | | |------| |------| | Prev | Next | Mute | | Play |
+ * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
+ * | | | | | | | | | | | VolDn| VolUp| | | |
+ * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
+ * | | | | | | | | | | | |
+ * `----------------------------------' `----------------------------------'
+ * ,-------------. ,-------------.
+ * | | | | | |
+ * ,------|------|------| |------+------+------.
+ * | | | | | | | |
+ * | | |------| |------| | |
+ * | | | | | | | |
+ * `--------------------' `--------------------'
+ */
+// MEDIA
+[MDIA] = KEYMAP(
+ // left hand
+ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
+ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
+ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
+ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
+ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
+ KC_TRNS, KC_TRNS,
+ KC_TRNS,
+ KC_TRNS, KC_TRNS, KC_TRNS,
+ // right hand
+ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
+ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
+ KC_TRNS, KC_MPRV, KC_MNXT, KC_MUTE, KC_TRNS, KC_MPLY,
+ KC_TRNS, KC_TRNS, KC_VOLD, KC_VOLU, KC_TRNS, KC_TRNS, KC_TRNS,
+ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
+ KC_TRNS, KC_TRNS,
+ KC_TRNS,
+ KC_TRNS, KC_TRNS, KC_TRNS
+),
+[MOUSE] = KEYMAP(
+ // left hand
+ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
+ KC_TRNS, KC_TRNS, KC_TRNS, KC_MS_U, KC_TRNS, KC_TRNS, KC_TRNS,
+ KC_TRNS, KC_TRNS, KC_MS_L, KC_MS_D, KC_MS_R, KC_TRNS,
+ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
+ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
+ KC_TRNS, KC_TRNS,
+ KC_TRNS,
+ KC_TRNS, KC_TRNS, KC_TRNS,
+ // right hand
+ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
+ KC_TRNS, KC_TRNS, KC_ACL2, KC_ACL1, KC_ACL0, KC_TRNS, KC_TRNS,
+ KC_TRNS, KC_BTN1, KC_BTN2, KC_TRNS, KC_TRNS, KC_TRNS,
+ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
+ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
+ KC_TRNS, KC_TRNS,
+ KC_TRNS,
+ KC_TRNS, KC_TRNS, KC_TRNS
+),
+[DEV] = KEYMAP(
+ // left hand
+ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
+ KC_TRNS, KC_F12, KC_F13, KC_F14, KC_F15, KC_F16, KC_TRNS,
+ KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5,
+ KC_TRNS, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_TRNS,
+ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
+ KC_TRNS, KC_TRNS,
+ KC_TRNS,
+ KC_TRNS, KC_TRNS, KC_TRNS,
+ // right hand
+ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
+ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
+ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
+ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
+ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
+ KC_TRNS, KC_TRNS,
+ KC_TRNS,
+ KC_TRNS, KC_TRNS, KC_TRNS
+),
+};
+
+const uint16_t PROGMEM fn_actions[] = {
+ [1] = ACTION_LAYER_TAP_TOGGLE(SYMB) // FN1 - Momentary Layer 1 (Symbols)
+};
+
+// MACRODOWN only works in this function
+const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
+{
+ switch(id) {
+ case 0:
+ if (record->event.pressed) {
+ register_code(KC_RSFT);
+ } else {
+ unregister_code(KC_RSFT);
+ }
+ break;
+ }
+ return MACRO_NONE;
+};
+
+// Runs just one time when the keyboard initializes.
+void matrix_init_user(void) {
+
+};
+
+// 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) {
+ case SYMB:
+ // Binary 1 represented by the leds
+ // --*
+ ergodox_right_led_3_on();
+ break;
+ case MDIA:
+ // Binary 2 represented by the leds
+ // -*-
+ ergodox_right_led_2_on();
+ break;
+ case MOUSE:
+ // Binary 3 represented by the leds
+ // -**
+ ergodox_right_led_3_on();
+ ergodox_right_led_2_on();
+ break;
+ case DEV:
+ // Binary 4 represented by the leds
+ // *--
+ ergodox_right_led_1_on();
+ break;
+ default:
+ // none
+ break;
+ }
+};
+
+//bool process_record_user(uint16_t keycode, keyrecord_t *record) {
+// switch (keycode) {
+// case QWERTY:
+// return false
+// break;
+// case LOWER:
+// if (record->event.pressed) {
+// layer_on(_LOWER);
+// update_tri_layer(_LOWER, _RAISE, _ADJUST);
+// } else {
+// layer_off(_LOWER);
+// update_tri_layer(_LOWER, _RAISE, _ADJUST);
+// }
+// return false;
+// break;
+// case RAISE:
+// if (record->event.pressed) {
+// layer_on(_RAISE);
+// update_tri_layer(_LOWER, _RAISE, _ADJUST);
+// } else {
+// layer_off(_RAISE);
+// update_tri_layer(_LOWER, _RAISE, _ADJUST);
+// }
+// return false;
+// break;
+// }
+// return true;
+//}
+
diff --git a/keyboards/ergodox_ez/keymaps/default/default.png.md b/keyboards/ergodox_ez/keymaps/default/default.png.md
new file mode 100644
index 0000000000..744e7d172a
--- /dev/null
+++ b/keyboards/ergodox_ez/keymaps/default/default.png.md
@@ -0,0 +1 @@
+https://i.imgur.com/fKX0Zbs.png
diff --git a/keyboards/ergodox_ez/keymaps/default/default_highres.png.md b/keyboards/ergodox_ez/keymaps/default/default_highres.png.md
new file mode 100644
index 0000000000..074e0634d2
--- /dev/null
+++ b/keyboards/ergodox_ez/keymaps/default/default_highres.png.md
@@ -0,0 +1 @@
+https://i.imgur.com/giAc3M9.jpg
diff --git a/keyboards/ergodox_ez/keymaps/default/keymap.c b/keyboards/ergodox_ez/keymaps/default/keymap.c
new file mode 100644
index 0000000000..cbc180d6a0
--- /dev/null
+++ b/keyboards/ergodox_ez/keymaps/default/keymap.c
@@ -0,0 +1,223 @@
+#include QMK_KEYBOARD_H
+#include "debug.h"
+#include "action_layer.h"
+#include "version.h"
+
+#define BASE 0 // default layer
+#define SYMB 1 // symbols
+#define MDIA 2 // media keys
+
+enum custom_keycodes {
+ PLACEHOLDER = SAFE_RANGE, // can always be here
+ EPRM,
+ VRSN,
+ RGB_SLD
+};
+
+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+/* Keymap 0: Basic layer
+ *
+ * ,--------------------------------------------------. ,--------------------------------------------------.
+ * | = | 1 | 2 | 3 | 4 | 5 | LEFT | | RIGHT| 6 | 7 | 8 | 9 | 0 | - |
+ * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
+ * | Del | Q | W | E | R | T | L1 | | L1 | Y | U | I | O | P | \ |
+ * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
+ * | BkSp | A | S | D | F | G |------| |------| H | J | K | L |; / L2|' / Cmd |
+ * |--------+------+------+------+------+------| Hyper| | Meh |------+------+------+------+------+--------|
+ * | LShift |Z/Ctrl| X | C | V | B | | | | N | M | , | . |//Ctrl| RShift |
+ * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
+ * |Grv/L1| '" |AltShf| Left | Right| | Up | Down | [ | ] | ~L1 |
+ * `----------------------------------' `----------------------------------'
+ * ,-------------. ,-------------.
+ * | App | LGui | | Alt |Ctrl/Esc|
+ * ,------|------|------| |------+--------+------.
+ * | | | Home | | PgUp | | |
+ * | Space|Backsp|------| |------| Tab |Enter |
+ * | |ace | End | | PgDn | | |
+ * `--------------------' `----------------------'
+ */
+// If it accepts an argument (i.e, is a function), it doesn't need KC_.
+// Otherwise, it needs KC_*
+[BASE] = LAYOUT_ergodox( // layer 0 : default
+ // left hand
+ KC_EQL, KC_1, KC_2, KC_3, KC_4, KC_5, KC_LEFT,
+ KC_DELT, KC_Q, KC_W, KC_E, KC_R, KC_T, TG(SYMB),
+ KC_BSPC, KC_A, KC_S, KC_D, KC_F, KC_G,
+ KC_LSFT, CTL_T(KC_Z), KC_X, KC_C, KC_V, KC_B, ALL_T(KC_NO),
+ LT(SYMB,KC_GRV),KC_QUOT, LALT(KC_LSFT), KC_LEFT,KC_RGHT,
+ ALT_T(KC_APP), KC_LGUI,
+ KC_HOME,
+ KC_SPC,KC_BSPC,KC_END,
+ // right hand
+ KC_RGHT, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS,
+ TG(SYMB), KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLS,
+ KC_H, KC_J, KC_K, KC_L, LT(MDIA, KC_SCLN),GUI_T(KC_QUOT),
+ MEH_T(KC_NO),KC_N, KC_M, KC_COMM,KC_DOT, CTL_T(KC_SLSH), KC_RSFT,
+ KC_UP, KC_DOWN,KC_LBRC,KC_RBRC, KC_FN1,
+ KC_LALT, CTL_T(KC_ESC),
+ KC_PGUP,
+ KC_PGDN,KC_TAB, KC_ENT
+ ),
+/* Keymap 1: Symbol Layer
+ *
+ * ,---------------------------------------------------. ,--------------------------------------------------.
+ * |Version | F1 | F2 | F3 | F4 | F5 | | | | F6 | F7 | F8 | F9 | F10 | F11 |
+ * |---------+------+------+------+------+------+------| |------+------+------+------+------+------+--------|
+ * | | ! | @ | { | } | | | | | | Up | 7 | 8 | 9 | * | F12 |
+ * |---------+------+------+------+------+------| | | |------+------+------+------+------+--------|
+ * | | # | $ | ( | ) | ` |------| |------| Down | 4 | 5 | 6 | + | |
+ * |---------+------+------+------+------+------| | | |------+------+------+------+------+--------|
+ * | | % | ^ | [ | ] | ~ | | | | & | 1 | 2 | 3 | \ | |
+ * `---------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
+ * | EPRM | | | | | | | . | 0 | = | |
+ * `-----------------------------------' `----------------------------------'
+ * ,-------------. ,-------------.
+ * |Animat| | |Toggle|Solid |
+ * ,------|------|------| |------+------+------.
+ * |Bright|Bright| | | |Hue- |Hue+ |
+ * |ness- |ness+ |------| |------| | |
+ * | | | | | | | |
+ * `--------------------' `--------------------'
+ */
+// SYMBOLS
+[SYMB] = LAYOUT_ergodox(
+ // left hand
+ VRSN, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_TRNS,
+ KC_TRNS,KC_EXLM,KC_AT, KC_LCBR,KC_RCBR,KC_PIPE,KC_TRNS,
+ 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,
+ RGB_MOD,KC_TRNS,
+ KC_TRNS,
+ RGB_VAD,RGB_VAI,KC_TRNS,
+ // right hand
+ KC_TRNS, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11,
+ KC_TRNS, KC_UP, KC_7, KC_8, KC_9, KC_ASTR, KC_F12,
+ 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,
+ KC_TRNS,
+ KC_TRNS, RGB_HUD, RGB_HUI
+),
+/* Keymap 2: Media and mouse keys
+ *
+ * ,--------------------------------------------------. ,--------------------------------------------------.
+ * | | | | | | | | | | | | | | | |
+ * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
+ * | | | | MsUp | | | | | | | | | | | |
+ * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
+ * | | |MsLeft|MsDown|MsRght| |------| |------| | | | | | Play |
+ * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
+ * | | | | | | | | | | | | Prev | Next | | |
+ * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
+ * | | | | Lclk | Rclk | |VolUp |VolDn | Mute | | |
+ * `----------------------------------' `----------------------------------'
+ * ,-------------. ,-------------.
+ * | | | | | |
+ * ,------|------|------| |------+------+------.
+ * | | | | | | |Brwser|
+ * | | |------| |------| |Back |
+ * | | | | | | | |
+ * `--------------------' `--------------------'
+ */
+// MEDIA AND MOUSE
+[MDIA] = LAYOUT_ergodox(
+ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
+ KC_TRNS, KC_TRNS, KC_TRNS, KC_MS_U, KC_TRNS, KC_TRNS, KC_TRNS,
+ KC_TRNS, KC_TRNS, KC_MS_L, KC_MS_D, KC_MS_R, KC_TRNS,
+ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
+ KC_TRNS, KC_TRNS, KC_TRNS, KC_BTN1, KC_BTN2,
+ KC_TRNS, KC_TRNS,
+ KC_TRNS,
+ KC_TRNS, KC_TRNS, KC_TRNS,
+ // right hand
+ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
+ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
+ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MPLY,
+ KC_TRNS, KC_TRNS, KC_TRNS, KC_MPRV, KC_MNXT, KC_TRNS, KC_TRNS,
+ KC_VOLU, KC_VOLD, KC_MUTE, KC_TRNS, KC_TRNS,
+ KC_TRNS, KC_TRNS,
+ KC_TRNS,
+ KC_TRNS, KC_TRNS, KC_WBAK
+),
+};
+
+const uint16_t PROGMEM fn_actions[] = {
+ [1] = ACTION_LAYER_TAP_TOGGLE(SYMB) // FN1 - Momentary Layer 1 (Symbols)
+};
+
+const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
+{
+ // MACRODOWN only works in this function
+ switch(id) {
+ case 0:
+ if (record->event.pressed) {
+ SEND_STRING (QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION);
+ }
+ break;
+ case 1:
+ if (record->event.pressed) { // For resetting EEPROM
+ eeconfig_init();
+ }
+ break;
+ }
+ return MACRO_NONE;
+};
+
+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;
+}
+
+// Runs just one time when the keyboard initializes.
+void matrix_init_user(void) {
+
+};
+
+
+// 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) {
+ // TODO: Make this relevant to the ErgoDox EZ.
+ case 1:
+ ergodox_right_led_1_on();
+ break;
+ case 2:
+ ergodox_right_led_2_on();
+ break;
+ default:
+ // none
+ break;
+ }
+
+};
diff --git a/keyboards/ergodox_ez/keymaps/default/readme.md b/keyboards/ergodox_ez/keymaps/default/readme.md
new file mode 100644
index 0000000000..1150a4f709
--- /dev/null
+++ b/keyboards/ergodox_ez/keymaps/default/readme.md
@@ -0,0 +1,15 @@
+# ErgoDox EZ Default Configuration
+
+## Changelog
+
+* Dec 2016:
+ * Added LED keys
+ * Refreshed layout graphic, comes from http://configure.ergodox-ez.com now.
+* Sep 22, 2016:
+ * Created a new key in layer 1 (bottom-corner key) that resets the EEPROM.
+* Feb 2, 2016 (V1.1):
+ * Made the right-hand quote key double as Cmd/Win on hold. So you get ' when you tap it, " when you tap it with Shift, and Cmd or Win when you hold it. You can then use it as a modifier, or just press and hold it for a moment (and then let go) to send a single Cmd or Win keystroke (handy for opening the Start menu on Windows).
+
+This is what we ship with out of the factory. :) The image says it all:
+
+![Default](https://i.imgur.com/Be53jH7.png) \ No newline at end of file
diff --git a/keyboards/ergodox_ez/keymaps/default_osx/keymap.c b/keyboards/ergodox_ez/keymaps/default_osx/keymap.c
new file mode 100644
index 0000000000..947c8a007f
--- /dev/null
+++ b/keyboards/ergodox_ez/keymaps/default_osx/keymap.c
@@ -0,0 +1,187 @@
+// Netable differences vs. the default firmware for the ErgoDox EZ:
+// 1. The Cmd key is now on the right side, making Cmd+Space easier.
+// 2. The media keys work on OSX (But not on Windows).
+#include QMK_KEYBOARD_H
+#include "debug.h"
+#include "action_layer.h"
+
+#define BASE 0 // default layer
+#define SYMB 1 // symbols
+#define MDIA 2 // media keys
+
+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+/* Keymap 0: Basic layer
+ *
+ * ,--------------------------------------------------. ,--------------------------------------------------.
+ * | = | 1 | 2 | 3 | 4 | 5 | LEFT | | RIGHT| 6 | 7 | 8 | 9 | 0 | - |
+ * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
+ * | Del | Q | W | E | R | T | L1 | | L1 | Y | U | I | O | P | \ |
+ * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
+ * | BkSp | A | S | D | F | G |------| |------| H | J | K | L |; / L2| LGui |
+ * |--------+------+------+------+------+------| Hyper| | Meh |------+------+------+------+------+--------|
+ * | LShift |Z/Ctrl| X | C | V | B | | | | N | M | , | . |//Ctrl| RShift |
+ * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
+ * |Grv/L1| '" |AltShf| Left | Right| | Up | Down | [ | ] | ~L1 |
+ * `----------------------------------' `----------------------------------'
+ * ,-------------. ,-------------.
+ * | App | LGui | | Alt |Ctrl/Esc|
+ * ,------|------|------| |------+--------+------.
+ * | | | Home | | PgUp | | |
+ * | Space|Backsp|------| |------| Tab |Enter |
+ * | |ace | End | | PgDn | | |
+ * `--------------------' `----------------------'
+ */
+// If it accepts an argument (i.e, is a function), it doesn't need KC_.
+// Otherwise, it needs KC_*
+[BASE] = LAYOUT_ergodox( // layer 0 : default
+ // left hand
+ KC_EQL, KC_1, KC_2, KC_3, KC_4, KC_5, KC_LEFT,
+ KC_DELT, KC_Q, KC_W, KC_E, KC_R, KC_T, TG(SYMB),
+ KC_BSPC, KC_A, KC_S, KC_D, KC_F, KC_G,
+ KC_LSFT, CTL_T(KC_Z), KC_X, KC_C, KC_V, KC_B, ALL_T(KC_NO),
+ LT(SYMB,KC_GRV),KC_QUOT, LALT(KC_LSFT), KC_LEFT,KC_RGHT,
+ ALT_T(KC_APP), KC_LGUI,
+ KC_HOME,
+ KC_SPC,KC_BSPC,KC_END,
+ // right hand
+ KC_RGHT, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS,
+ TG(SYMB), KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLS,
+ KC_H, KC_J, KC_K, KC_L, LT(MDIA, KC_SCLN),KC_LGUI,
+ MEH_T(KC_NO),KC_N, KC_M, KC_COMM,KC_DOT, CTL_T(KC_SLSH), KC_RSFT,
+ KC_UP, KC_DOWN,KC_LBRC,KC_RBRC, KC_FN1,
+ KC_LALT, CTL_T(KC_ESC),
+ KC_PGUP,
+ KC_PGDN,KC_TAB, KC_ENT
+ ),
+/* Keymap 1: Symbol Layer
+ *
+ * ,--------------------------------------------------. ,--------------------------------------------------.
+ * | | F1 | F2 | F3 | F4 | F5 | | | | F6 | F7 | F8 | F9 | F10 | F11 |
+ * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
+ * | | ! | @ | { | } | | | | | | Up | 7 | 8 | 9 | * | F12 |
+ * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
+ * | | # | $ | ( | ) | ` |------| |------| Down | 4 | 5 | 6 | + | |
+ * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
+ * | | % | ^ | [ | ] | ~ | | | | & | 1 | 2 | 3 | \ | |
+ * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
+ * | | | | | | | | . | 0 | = | |
+ * `----------------------------------' `----------------------------------'
+ * ,-------------. ,-------------.
+ * | | | | | |
+ * ,------|------|------| |------+------+------.
+ * | | | | | | | |
+ * | | |------| |------| | |
+ * | | | | | | | |
+ * `--------------------' `--------------------'
+ */
+// SYMBOLS
+[SYMB] = LAYOUT_ergodox(
+ // left hand
+ KC_TRNS,KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_TRNS,
+ KC_TRNS,KC_EXLM,KC_AT, KC_LCBR,KC_RCBR,KC_PIPE,KC_TRNS,
+ 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,
+ KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,
+ KC_TRNS,KC_TRNS,
+ KC_TRNS,
+ KC_TRNS,KC_TRNS,KC_TRNS,
+ // right hand
+ KC_TRNS, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11,
+ KC_TRNS, KC_UP, KC_7, KC_8, KC_9, KC_ASTR, KC_F12,
+ 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,
+ KC_TRNS, KC_TRNS,
+ KC_TRNS,
+ KC_TRNS, KC_TRNS, KC_TRNS
+),
+/* Keymap 2: Media and mouse keys
+ *
+ * ,--------------------------------------------------. ,--------------------------------------------------.
+ * | | | | | | | | | | | | | | | |
+ * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
+ * | | | | MsUp | | | | | | | | | | | |
+ * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
+ * | | |MsLeft|MsDown|MsRght| |------| |------| | | | | | Play |
+ * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
+ * | | | | | | | | | | | | Prev | Next | | |
+ * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
+ * | | | | Lclk | Rclk | |VolUp |VolDn | Mute | | |
+ * `----------------------------------' `----------------------------------'
+ * ,-------------. ,-------------.
+ * | | | | | |
+ * ,------|------|------| |------+------+------.
+ * | | | | | | |Brwser|
+ * | | |------| |------| |Back |
+ * | | | | | | | |
+ * `--------------------' `--------------------'
+ */
+// MEDIA AND MOUSE
+[MDIA] = LAYOUT_ergodox(
+ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
+ KC_TRNS, KC_TRNS, KC_TRNS, KC_MS_U, KC_TRNS, KC_TRNS, KC_TRNS,
+ KC_TRNS, KC_TRNS, KC_MS_L, KC_MS_D, KC_MS_R, KC_TRNS,
+ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
+ KC_TRNS, KC_TRNS, KC_TRNS, KC_BTN1, KC_BTN2,
+ KC_TRNS, KC_TRNS,
+ KC_TRNS,
+ KC_TRNS, KC_TRNS, KC_TRNS,
+ // right hand
+ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
+ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
+ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MPLY,
+ KC_TRNS, KC_TRNS, KC_TRNS, KC_MPRV, KC_MNXT, KC_TRNS, KC_TRNS,
+ KC_VOLU, KC_VOLD, KC_MUTE, KC_TRNS, KC_TRNS,
+ KC_TRNS, KC_TRNS,
+ KC_TRNS,
+ KC_TRNS, KC_TRNS, KC_WBAK
+),
+};
+
+const uint16_t PROGMEM fn_actions[] = {
+ [1] = ACTION_LAYER_TAP_TOGGLE(SYMB) // FN1 - Momentary Layer 1 (Symbols)
+};
+
+const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
+{
+ // MACRODOWN only works in this function
+ switch(id) {
+ case 0:
+ if (record->event.pressed) {
+ register_code(KC_RSFT);
+ } else {
+ unregister_code(KC_RSFT);
+ }
+ break;
+ }
+ return MACRO_NONE;
+};
+
+// Runs just one time when the keyboard initializes.
+void matrix_init_user(void) {
+
+};
+
+// 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) {
+ // TODO: Make this relevant to the ErgoDox EZ.
+ case 1:
+ ergodox_right_led_1_on();
+ break;
+ case 2:
+ ergodox_right_led_2_on();
+ break;
+ default:
+ // none
+ break;
+ }
+
+};
diff --git a/keyboards/ergodox_ez/keymaps/default_osx/readme.md b/keyboards/ergodox_ez/keymaps/default_osx/readme.md
new file mode 100644
index 0000000000..28ca0339b6
--- /dev/null
+++ b/keyboards/ergodox_ez/keymaps/default_osx/readme.md
@@ -0,0 +1,8 @@
+# The OSX Friendly Version of the Default Firmware
+
+So, I took the default firmware and just made a couple of tweaks that make it easier to use with OS X:
+
+1. The Cmd key is now on the right side, making Cmd+Space easier.
+2. The media keys work on OSX (But not on Windows).
+
+![default osx](https://i.imgur.com/z0aqFDq.png)
diff --git a/keyboards/ergodox_ez/keymaps/drashna-custom/Makefile b/keyboards/ergodox_ez/keymaps/drashna-custom/Makefile
new file mode 100644
index 0000000000..21da248f0c
--- /dev/null
+++ b/keyboards/ergodox_ez/keymaps/drashna-custom/Makefile
@@ -0,0 +1,10 @@
+TAP_DANCE_ENABLE = yes
+LAYER_UNDERGLOW_LIGHTING = yes
+SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend
+COMMAND_ENABLE = no # Commands for debug and configuration
+RGBLIGHT_ENABLE = yes
+MIDI_ENABLE = no
+
+ifndef QUANTUM_DIR
+ include ../../../../Makefile
+endif
diff --git a/keyboards/ergodox_ez/keymaps/drashna-custom/config.h b/keyboards/ergodox_ez/keymaps/drashna-custom/config.h
new file mode 100644
index 0000000000..fe33552e15
--- /dev/null
+++ b/keyboards/ergodox_ez/keymaps/drashna-custom/config.h
@@ -0,0 +1,8 @@
+
+#include "../../config.h"
+
+
+#define TAPPING_TERM 200
+
+
+#define LAYER_UNDERGLOW_LIGHTING
diff --git a/keyboards/ergodox_ez/keymaps/drashna-custom/keymap.c b/keyboards/ergodox_ez/keymaps/drashna-custom/keymap.c
new file mode 100644
index 0000000000..ed7aede1f9
--- /dev/null
+++ b/keyboards/ergodox_ez/keymaps/drashna-custom/keymap.c
@@ -0,0 +1,867 @@
+#include QMK_KEYBOARD_H
+#include "debug.h"
+#include "action_layer.h"
+#include "version.h"
+
+
+#include "keymap_german.h"
+
+#include "keymap_nordic.h"
+
+// Define layer names
+#define BASE 0
+#define COLEMAK 1
+#define DVORAK 2
+#define SYMB 3
+#define OVERWATCH 4
+#define DIABLO 5
+#define MOUS 6
+
+//define modifiers
+#define MODS_SHIFT_MASK (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT))
+#define MODS_CTRL_MASK (MOD_BIT(KC_LCTL)|MOD_BIT(KC_RCTRL))
+#define MODS_ALT_MASK (MOD_BIT(KC_LALT)|MOD_BIT(KC_RALT))
+
+//define macro keycodes
+#define M_VERSION M(0)
+#define M_SYMM M(1)
+#define M_SALT M(2)
+#define M_HARD M(3)
+#define M_MAKE M(4)
+#define M_COVECUBE M(5)
+#define M_MORESALT M(6)
+#define M_DOOMFIST M(7)
+
+
+//define layer change stuff for underglow indicator
+bool skip_leds = false;
+bool has_layer_changed = false;
+static uint8_t current_layer;
+
+static uint16_t key_timer;
+//define diablo macro timer variables
+static uint16_t diablo_timer[4];
+static uint8_t diablo_times[] = {0, 1, 3, 5, 10, 30};
+static uint8_t diablo_key_time[4];
+
+bool check_dtimer(uint8_t dtimer) {
+ // has the correct number of seconds elapsed (as defined by diablo_times)
+ return (timer_elapsed(diablo_timer[dtimer]) < ( diablo_key_time[dtimer] * 1000 ) ) ? false : true;
+};
+
+bool checktime(void){
+ return (timer_elapsed(key_timer) < 150) ? true : false;
+};
+
+
+enum custom_keycodes {
+ PLACEHOLDER = SAFE_RANGE, // can always be here
+ EPRM,
+ VRSN,
+ RGB_SLD,
+ RGB_0000FF,
+ RGB_008000,
+ RGB_FF0000,
+ RGB_800080,
+ RGB_00FF90,
+ KC_DIABLO_CLEAR
+};
+
+#ifdef TAP_DANCE_ENABLE
+enum {
+ SFT_CAP = 0,
+ TD_DIABLO_J,
+ TD_CLN,
+ TD_EGG,
+ TD_FLSH,
+ TD_DIABLO_1,
+ TD_DIABLO_2,
+ TD_DIABLO_3,
+ TD_DIABLO_4
+};
+
+
+
+void dance_cln_finished (qk_tap_dance_state_t *state, void *user_data) {
+ if (state->count == 1) {
+ register_code (KC_RSFT);
+ register_code (KC_SCLN);
+ } else {
+ register_code (KC_SCLN);
+ }
+}
+
+void dance_cln_reset (qk_tap_dance_state_t *state, void *user_data) {
+ if (state->count == 1) {
+ unregister_code (KC_RSFT);
+ unregister_code (KC_SCLN);
+ } else {
+ unregister_code (KC_SCLN);
+ }
+}
+
+void dance_egg (qk_tap_dance_state_t *state, void *user_data) {
+ if (state->count >= 10) {
+ SEND_STRING ("Safety dance!");
+ reset_tap_dance (state);
+ }
+}
+
+// on each tap, light up one led, from right to left
+// on the forth tap, turn them off from right to left
+void dance_flsh_each(qk_tap_dance_state_t *state, void *user_data) {
+ if (!skip_leds) {
+ ergodox_board_led_off();
+ ergodox_right_led_1_off();
+ ergodox_right_led_2_off();
+ ergodox_right_led_3_off();
+ skip_leds = true;
+ }
+ switch (state->count) {
+ case 1:
+ ergodox_right_led_3_on();
+ break;
+ case 2:
+ ergodox_right_led_2_on();
+ break;
+ case 3:
+ ergodox_right_led_1_on();
+ break;
+ case 4:
+ ergodox_right_led_3_off();
+ _delay_ms(50);
+ ergodox_right_led_2_off();
+ _delay_ms(50);
+ ergodox_right_led_1_off();
+
+ }
+}
+
+// on the fourth tap, set the keyboard on flash state
+void dance_flsh_finished(qk_tap_dance_state_t *state, void *user_data) {
+ if (state->count >= 4) {
+#ifdef LAYER_UNDERGLOW_LIGHTING
+ rgblight_enable();
+ rgblight_mode(1);
+ rgblight_setrgb(0xff,0x00,0x00);
+#endif
+ reset_keyboard();
+ reset_tap_dance(state);
+ }
+}
+
+void diablo_tapdance_master (qk_tap_dance_state_t *state, void *user_data, uint8_t diablo_key) {
+ if (state->count >= 7) {
+ diablo_key_time[diablo_key] = diablo_times[0];
+ reset_tap_dance(state);
+ } else {
+ diablo_key_time[diablo_key] = diablo_times[state->count - 1];
+ }
+}
+
+void diablo_tapdance1 (qk_tap_dance_state_t *state, void *user_data) {
+ diablo_tapdance_master (state, user_data, 0);
+}
+
+void diablo_tapdance2 (qk_tap_dance_state_t *state, void *user_data) {
+ diablo_tapdance_master (state, user_data, 1);
+}
+
+void diablo_tapdance3 (qk_tap_dance_state_t *state, void *user_data) {
+ diablo_tapdance_master (state, user_data, 2);
+}
+
+void diablo_tapdance4 (qk_tap_dance_state_t *state, void *user_data) {
+ diablo_tapdance_master (state, user_data, 3);
+}
+
+
+// if the flash state didnt happen, then turn off leds, left to right
+void dance_flsh_reset(qk_tap_dance_state_t *state, void *user_data) {
+ _delay_ms(200);
+ ergodox_right_led_1_off();
+ _delay_ms(200);
+ ergodox_right_led_2_off();
+ _delay_ms(200);
+ ergodox_right_led_3_off();
+ _delay_ms(500);
+ skip_leds = false;
+}
+
+//Tap Dance Definitions
+qk_tap_dance_action_t tap_dance_actions[] = {
+ //Tap one for Space, and twice for Enter
+ [SFT_CAP] = ACTION_TAP_DANCE_DOUBLE(KC_LSHIFT, KC_CAPS),
+ // Special Z
+ [TD_DIABLO_J] = ACTION_TAP_DANCE_DOUBLE(KC_J, S(KC_J)),
+ // Once for colin, twice for semi-colin
+ [TD_CLN] = ACTION_TAP_DANCE_FN_ADVANCED (NULL, dance_cln_finished, dance_cln_reset),
+ // Tap until you get a surprise
+ [TD_EGG] = ACTION_TAP_DANCE_FN (dance_egg),
+ //Once for Blue, Twice for Green, Thrice for Red, and four to flash
+ [TD_FLSH] = ACTION_TAP_DANCE_FN_ADVANCED (dance_flsh_each, dance_flsh_finished, dance_flsh_reset),
+
+ [TD_DIABLO_1] = ACTION_TAP_DANCE_FN(diablo_tapdance1),
+ [TD_DIABLO_2] = ACTION_TAP_DANCE_FN(diablo_tapdance2),
+ [TD_DIABLO_3] = ACTION_TAP_DANCE_FN(diablo_tapdance3),
+ [TD_DIABLO_4] = ACTION_TAP_DANCE_FN(diablo_tapdance4),
+
+};
+#endif
+
+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+/* Keymap 0: Basic layer
+ *
+ *
+ * ,--------------------------------------------------. ,--------------------------------------------------.
+ * | = + | 1 ! | 2 @ | 3 # | 4 $ | 5 % | TG(4)| | TG(4)| 6 ^ | 7 & | 8 * | 9 ( | 0 ) | - _ |
+ * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
+ * | TAB | Q | W | E | R | T | TG(3)| |TG(3) | Y | U | I | O | P | \ | |
+ * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
+ * | Bksp | A | S | D | F | G |------| |------| H | J | K | L | ; | ' " |
+ * |--------+------+------+------+------+------| TG(2)| | TG(2)|------+------+------+------+------+--------|
+ * | Shift | Z | X | C | V | B | | | | N | M | , < | . > | UP | Shift |
+ * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
+ * | `/SYM| ' " | LGUI | [ { | ] } | | SYMB | ? / | LEFT | DOWN |RIGHT |
+ * `----------------------------------' `----------------------------------'
+ * ,--------------. ,--------------.
+ * |Alt/Ap| Win | | Alt |Ctl/Esc|
+ * ,------|------|-------| |------+-------+------.
+ * | | | Home | | PgUp | | |
+ * | Space| Bksp |-------| |------| DEL |Enter |
+ * | | | End | | PgDn | | |
+ * `---------------------' `---------------------'
+ */
+ [BASE] = KEYMAP(
+ KC_EQUAL, KC_1, KC_2, KC_3, KC_4, KC_5, TG(MOUS),
+ KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, TG(DIABLO),
+ KC_BSPACE, KC_A, KC_S, KC_D, KC_F, KC_G,
+ KC_LSHIFT, CTL_T(KC_Z),KC_X, KC_C, KC_V, KC_B, TG(OVERWATCH),
+ LT(SYMB,KC_GRAVE),KC_QUOTE, KC_LGUI, KC_LBRACKET,KC_RBRACKET,
+
+ ALT_T(KC_APPLICATION), KC_LGUI,
+ KC_HOME,
+ KC_SPACE, KC_BSPACE, KC_END,
+
+ TG(SYMB), KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINUS,
+ TG(DVORAK), KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLASH,
+ KC_H, KC_J, KC_K, KC_L, KC_SCOLON, GUI_T(KC_QUOTE),
+ TG(COLEMAK), KC_N, KC_M, KC_COMMA, KC_DOT, CTL_T(KC_SLASH),KC_RSHIFT,
+ KC_FN1, KC_LEFT, KC_UP, KC_DOWN, KC_RIGHT,
+ KC_LALT, CTL_T(KC_ESCAPE),
+ KC_PGUP,
+ KC_PGDOWN, KC_DELETE, KC_ENTER
+ ),
+/* Keymap 1: Basic layer
+ *
+ * ,--------------------------------------------------. ,--------------------------------------------------.
+ * | = | 1 | 2 | 3 | 4 | 5 | LEFT | | RIGHT| 6 | 7 | 8 | 9 | 0 | - |
+ * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
+ * | Del | Q | W | F | P | G | L1 | | L1 | J | L | U | Y | ; | \ |
+ * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
+ * | BkSp | A | R | S | T | D |------| |------| H | N | E | I |O / L2| ' |
+ * |--------+------+------+------+------+------| OVER | | Meh |------+------+------+------+------+--------|
+ * | LShift |Z/Ctrl| X | C | V | B | | | | K | M | , | . |//Ctrl| RShift |
+ * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
+ * |Grv/L1| '" |AltShf| Left | Right| | Up | Down | [ | ] | ~L1 |
+ * `----------------------------------' `----------------------------------'
+ * ,-------------. ,-------------.
+ * | App | LGui | | Alt |Ctrl/Esc|
+ * ,------|------|------| |------+--------+------.
+ * | | | Home | | PgUp | | |
+ * | Space|Backsp|------| |------| Tab |Enter |
+ * | |ace | End | | PgDn | | |
+ * `--------------------' `----------------------'
+ */
+// If it accepts an argument (i.e, is a function), it doesn't need KC_.
+// Otherwise, it needs KC_*
+[COLEMAK] = KEYMAP(
+ // left hand
+ KC_EQL, KC_1, KC_2, KC_3, KC_4, KC_5, TG(MOUS),
+ KC_DELT, KC_Q, KC_W, KC_F, KC_P, KC_G, TG(DIABLO),
+ KC_BSPC, KC_A, KC_R, KC_S, KC_T, KC_D,
+ KC_LSFT, CTL_T(KC_Z), KC_X, KC_C, KC_V, KC_B, TG(OVERWATCH),
+ LT(SYMB,KC_GRV),KC_QUOT, LALT(KC_LSFT), KC_LBRACKET,KC_RBRACKET,
+ ALT_T(KC_APP), KC_LGUI,
+ KC_HOME,
+ KC_SPC,KC_BSPC,KC_END,
+ // right hand
+ KC_TRANSPARENT, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS,
+ KC_NO, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSLS,
+ KC_H, KC_N, KC_E, KC_I, LT(MOUS, KC_O), KC_QUOTE,
+ KC_TRANSPARENT,KC_K, KC_M, KC_COMM,KC_DOT, CTL_T(KC_SLASH),KC_RSHIFT,
+ KC_FN1, KC_LEFT, KC_UP, KC_DOWN, KC_RIGHT,
+ KC_LALT, CTL_T(KC_ESC),
+ KC_PGUP,
+ KC_PGDN,KC_TAB, KC_ENT
+ ),
+/* Keymap 2: Basic layer
+ *
+ * ,--------------------------------------------------. ,--------------------------------------------------.
+ * | = | 1 | 2 | 3 | 4 | 5 | LEFT | | RIGHT| 6 | 7 | 8 | 9 | 0 | \ |
+ * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
+ * | Del | ' | , | . | P | Y | L1 | | L1 | F | G | C | R | L | / |
+ * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
+ * | BkSp | A | O | E | U | I |------| |------| D | H | T | N |S / L2| - |
+ * |--------+------+------+------+------+------| Hyper| | Meh |------+------+------+------+------+--------|
+ * | LShift |:/Ctrl| Q | J | K | X | | | | B | M | W | V |Z/Ctrl| RShift |
+ * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
+ * |Grv/L1| '" |AltShf| Left | Right| | Up | Down | [ | ] | ~L1 |
+ * `----------------------------------' `----------------------------------'
+ * ,-------------. ,-------------.
+ * | App | LGui | | Alt |Ctrl/Esc|
+ * ,------|------|------| |------+--------+------.
+ * | | | Home | | PgUp | | |
+ * | Space|Backsp|------| |------| Tab |Enter |
+ * | |ace | End | | PgDn | | |
+ * `--------------------' `----------------------'
+ */
+// If it accepts an argument (i.e, is a function), it doesn't need KC_.
+// Otherwise, it needs KC_*
+[DVORAK] = KEYMAP(
+ // left hand
+ KC_EQL, KC_1, KC_2, KC_3, KC_4, KC_5, TG(MOUS),
+ KC_DELT, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, TG(DIABLO),
+ KC_BSPC, KC_A, KC_O, KC_E, KC_U, KC_I,
+ KC_LSFT, CTL_T(KC_SCLN), KC_Q, KC_J, KC_K, KC_X, TG(OVERWATCH),
+ LT(SYMB,KC_GRV),KC_QUOT, LALT(KC_LSFT), KC_LBRACKET,KC_RBRACKET,
+ ALT_T(KC_APP), KC_LGUI,
+ KC_HOME,
+ KC_SPC,KC_BSPC,KC_END,
+ // right hand
+ KC_TRANSPARENT, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSLS,
+ KC_TRANSPARENT, KC_F, KC_G, KC_C, KC_R, KC_L, KC_SLSH,
+ KC_D, KC_H, KC_T, KC_N, LT(MOUS, KC_S), KC_MINS,
+ KC_NO,KC_B, KC_M, KC_W, KC_V, CTL_T(KC_Z), KC_RSHIFT,
+ KC_FN1, KC_LEFT, KC_UP, KC_DOWN, KC_RIGHT,
+ KC_LALT, CTL_T(KC_ESC),
+ KC_PGUP,
+ KC_PGDN,KC_TAB, KC_ENT
+ ),
+
+ /* Keymap 3: Symbol Layer
+*
+* ,--------------------------------------------------. ,--------------------------------------------------.
+* | ESC | F1 | F2 | F3 | F4 | F5 | | | | F6 | F7 | F8 | F9 | F10 | F11 |
+* |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
+* | VERSION| ! | @ | { | } | | | | | | + | 7 | 8 | 9 | * | F12 |
+* |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
+* | MAKE | # | $ | ( | ) | ` |------| |------| - | 4 | 5 | 6 | / | PrtSc |
+* |--------+------+------+------+------+------| COVE | | |------+------+------+------+------+--------|
+* | RESET | % | ^ | [ | ] | ~ | CUBE | | | NUM | 1 | 2 | 3 | = | PAUSE |
+* `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
+* | LT0 | & | * | : | ; | | 0 | 0 | NUM. | ENT | ENT |
+* `----------------------------------' `----------------------------------'
+* ,-------------. ,-------------.
+* | RGBM | RED | | OFF | SOLID|
+* ,------|------|------| |------+------+------.
+* | | | GREEN| | | | |
+* | RGB | RGB |------| |------| NUM. | NUM0 |
+* | DARK |BRITE | BLUE | | | | |
+* `--------------------' `--------------------'
+*/
+ [SYMB] = KEYMAP(
+ KC_ESCAPE,KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_TRANSPARENT,
+ M_VERSION, KC_EXLM, KC_AT, KC_LCBR, KC_RCBR, KC_PIPE, KC_TRANSPARENT,
+ M_MAKE, KC_HASH, KC_DLR, KC_LPRN, KC_RPRN, KC_GRAVE,
+ TD(TD_FLSH), KC_PERC, KC_CIRC, KC_LBRACKET,KC_RBRACKET,KC_TILD, M_COVECUBE,
+ KC_NO, KC_AMPR, KC_ASTR, KC_COLN, KC_SCOLON,
+ RGB_MOD, RGB_0000FF,
+ RGB_008000,
+ RGB_VAD, RGB_VAI, RGB_FF0000,
+
+ KC_TRANSPARENT, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11,
+ KC_TRANSPARENT, KC_KP_PLUS, KC_KP_7, KC_KP_8, KC_KP_9, KC_KP_ASTERISK, KC_F12,
+ KC_KP_MINUS, KC_KP_4, KC_KP_5, KC_KP_6, KC_KP_SLASH,KC_PSCREEN,
+ KC_TRANSPARENT, KC_NUMLOCK, KC_KP_1, KC_KP_2, KC_KP_3, KC_EQUAL, KC_PAUSE,
+ KC_KP_0, KC_KP_0, KC_KP_DOT, KC_KP_ENTER, KC_KP_ENTER,
+ RGB_TOG, RGB_SLD,
+ RGB_HUI,
+ RGB_HUD, KC_KP_DOT, KC_KP_0
+ ),
+
+/* Keymap 4: Customized Overwatch Layout
+ *
+ * ,--------------------------------------------------. ,--------------------------------------------------.
+ * | ESC | SALT | SYMM | MORE | DOOM | | | | | F9 | F10 | F11 | F12 | | |
+ * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
+ * | F1 | K | Q | W | E | R | T | | | | | | | | |
+ * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
+ * | TAB | G | A | S | D | F |------| |------| | | | | | |
+ * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
+ * | LCTR | LSHFT| Z | X | C | M | | | | | | | | | |
+ * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
+ * | J | U | I | Y | T | | | | | | |
+ * `----------------------------------' `----------------------------------'
+ * ,-------------. ,-------------.
+ * | O | P | | | |
+ * ,------|------|------| |------+------+------.
+ * | | | LGUI | | | | |
+ * | V | SPACE|------ |------| | Enter|
+ * | | | H | | | | |
+ * `--------------------' `--------------------'
+ */
+ [OVERWATCH] = KEYMAP(
+ KC_ESCAPE, M_SALT, M_SYMM, M_MORESALT, M_DOOMFIST, KC_NO, KC_NO,
+ KC_F1, KC_K, KC_Q, KC_W, KC_E, KC_R, KC_T,
+ KC_TAB, KC_G, KC_A, KC_S, KC_D, KC_F,
+ KC_LCTL, KC_LSHIFT, KC_Z, KC_X, KC_C, KC_M, KC_TRANSPARENT,
+ KC_G, KC_U, KC_I, KC_Y, KC_T,
+ KC_O, KC_P,
+ KC_LGUI,
+ KC_V, KC_SPACE, KC_H,
+
+ KC_NO, KC_F9, KC_F10, KC_F11, KC_F12, KC_NO, KC_NO,
+ KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,
+ KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,
+ KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,
+ KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,
+ KC_NO, KC_NO,
+ KC_NO,
+ KC_NO, KC_NO, KC_ENTER
+ ),
+
+/* Keymap 3:
+ *
+ * ,--------------------------------------------------. ,--------------------------------------------------.
+ * | ESC | V | D | ALT | | | | | | | | | | | |
+ * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
+ * | TAB | S | I | F | M | T | | | | | | | | | |
+ * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
+ * | Q | 1 | 2 | 3 | 4 | G |------| |------| | | | | | |
+ * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
+ * | NUMLOCK| NUM1 | NUM2 | NUM3 | NUM4 | Z | | | | | | | | | |
+ * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
+ * | LCTL | MAC1 | MAC2 | MAC3 | MAC4 | | | | | | |
+ * `----------------------------------' `----------------------------------'
+ * ,-------------. ,-------------.
+ * | L | J | | | |
+ * ,------|------|------| |------+------+------.
+ * | | | G | | | | |
+ * | SPACE| Q |------ |------| | |
+ * | SHIFT| ALT | 0MAC | | | | |
+ * `--------------------' `--------------------'
+ */
+ [DIABLO] = KEYMAP(
+ KC_ESCAPE, KC_V, KC_D, KC_LALT, KC_NO, KC_NO, KC_NO,
+ KC_TAB, KC_S, KC_I, KC_F, KC_M, KC_T, KC_TRANSPARENT,
+ KC_Q, KC_1, KC_2, KC_3, KC_4, KC_G,
+ KC_NUMLOCK, KC_KP_1, KC_KP_2, KC_KP_3, KC_KP_4, KC_Z, KC_NO,
+ KC_LCTL, TD(TD_DIABLO_1), TD(TD_DIABLO_2), TD(TD_DIABLO_3), TD(TD_DIABLO_4),
+ KC_L, KC_J,
+ KC_F,
+ SFT_T(KC_SPACE), ALT_T(KC_Q), KC_DIABLO_CLEAR,
+
+
+ KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,
+ KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,
+ KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,
+ KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,
+ KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,
+ KC_NO, KC_NO,
+ KC_NO,
+ KC_NO, KC_NO, KC_NO
+ ),
+
+/* Keymap 4: Media and mouse keys
+ *
+ * ,--------------------------------------------------. ,--------------------------------------------------.
+ * | | | | | | | | | | | | | | | |
+ * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
+ * | | | MsUp | | | | | | | | | | | | |
+ * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
+ * | |MsLeft|MsDown|MsRght| | |------| |------| | | Acc0 | Acc1 | Acc2 | |
+ * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
+ * | | Acc0 | Acc1 | Acc2 | | | | | | Play | Stop | Mute |VolDn |VolUp | |
+ * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
+ * | | | | | | | | | | | |
+ * `----------------------------------' `----------------------------------'
+ * ,-------------. ,-------------.
+ * | | | | | |
+ * ,------|------|------| |------+------+------.
+ * | | | MWUp | | | | |
+ * | Lclk | Rclk |------| |------| MBn4 | MBn4 |
+ * | | | MWDn | | Mclk | | |
+ * `--------------------' `--------------------'
+ */
+ [MOUS] = KEYMAP(
+ KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_TRANSPARENT,
+ KC_NO, KC_NO, KC_MS_UP, KC_NO, KC_NO, KC_NO, KC_TRANSPARENT,
+ KC_NO, KC_MS_LEFT, KC_MS_DOWN, KC_MS_RIGHT,KC_NO, KC_NO,
+ KC_NO, KC_MS_ACCEL0,KC_MS_ACCEL1,KC_MS_ACCEL2,KC_NO, KC_NO, KC_TRANSPARENT,
+ KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,
+ KC_NO,KC_NO,
+ KC_MS_WH_UP,
+ KC_MS_BTN1,KC_MS_BTN2,KC_MS_WH_DOWN,
+
+ KC_TRANSPARENT,KC_NO,KC_NO,KC_NO,KC_NO,KC_NO,KC_NO,
+ KC_TRANSPARENT,KC_NO,KC_NO,KC_NO,KC_NO,KC_NO,
+ KC_NO,KC_NO,KC_MS_ACCEL0,KC_MS_ACCEL1,KC_MS_ACCEL2,KC_NO,KC_NO,
+ KC_TRANSPARENT,KC_MEDIA_PLAY_PAUSE,KC_MEDIA_STOP,KC_AUDIO_MUTE,KC_AUDIO_VOL_DOWN,KC_AUDIO_VOL_UP,KC_NO,
+ KC_NO,KC_NO,KC_NO,KC_NO,KC_NO,
+ KC_NO,KC_NO,
+ KC_NO,
+ KC_MS_BTN3,KC_MS_BTN4,KC_MS_BTN5
+ ),
+
+};
+
+const uint16_t PROGMEM fn_actions[] = {
+ [1] = ACTION_LAYER_TAP_TOGGLE(SYMB),
+ // FN1 - Momentary Layer 1 (Symbols)
+ [2] = ACTION_MODS_TAP_KEY(MOD_RCTL, KC_UP),
+ [3] = ACTION_MODS_TAP_KEY(MOD_RGUI, KC_LEFT),
+ [4] = ACTION_MODS_TAP_KEY(MOD_RALT, KC_DOWN),
+ [5] = ACTION_MODS_TAP_KEY(MOD_RSFT, KC_RIGHT),
+};
+
+void action_function(keyrecord_t *event, uint8_t id, uint8_t opt)
+{
+
+}
+
+const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
+{
+ switch(id) {
+ case 0:
+ if (record->event.pressed) {
+ // Output Keyboard Firmware info
+ SEND_STRING (QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION);
+ return false;
+ }
+ case 1:
+ if (record->event.pressed) {
+ // Symmentra "Left Click to win" salt
+ return MACRO( I(50), T(ENTER), I(5), D(LSFT), T(L), U(LSFT), T(E), T(F), T(T), T(SPACE), T(C), T(L), T(I), T(C), T(K), T(SPACE), T(T), T(O), T(SPACE), T(W), T(I), T(N), D(LSFT), T(1), U(LSFT), T(ENTER), END );
+ }
+ case 2:
+ if (record->event.pressed) {
+ //salt salt salt
+ return MACRO( I(50), T(ENTER), I(5), D(LSFT), T(S), U(LSFT), T(A), T(L), T(T), T(COMMA), T(SPACE), T(S), T(A), T(L), T(T), T(COMMA), T(SPACE), T(S), T(A), T(L), T(T), T(DOT), T(DOT), T(DOT), T(ENTER), END );
+ }
+ case 3:
+ if (record->event.pressed) {
+ // your saltiness makes me hard
+ return MACRO( I(50), T(ENTER), I(5), D(LSFT), T(Y), U(LSFT), T(O), T(U), T(R), T(SPACE), T(S), T(A), T(L), T(T), T(SPACE), T(O), T(N), T(L), T(Y), T(SPACE), T(M), T(A), T(K), T(E), T(S), T(SPACE), T(M), T(Y), T(SPACE), T(P), T(E), T(N), T(I), T(S), T(SPACE), T(T), T(H), T(A), T(T), T(SPACE), T(M), T(U), T(C), T(H), T(SPACE), T(H), T(A), T(R), T(D), T(E), T(R), T(COMMA), T(SPACE), T(A), T(N), T(D), T(SPACE), T(E), T(V), T(E), T(N), T(SPACE), T(M), T(O), T(R), T(E), T(SPACE), T(A), T(G), T(G), T(R), T(E), T(S), T(S), T(I), T(V), T(E), D(LSFT), T(1), U(LSFT), T(ENTER), END );
+ }
+ case 4:
+ if (record->event.pressed) {
+ // make ergodox-ez-drashna-custom-teensy
+ return MACRO( I(5), T(M), T(A), T(K), T(E), T(SPACE), T(E), T(R), T(G), T(O), T(D), T(O), T(X), T(MINUS), T(E), T(Z), T(MINUS), T(D), T(R), T(A), T(S), T(H), T(N), T(A), T(MINUS), T(C), T(U), T(S), T(T), T(O), T(M), T(MINUS), T(T), T(E), T(E), T(N), T(S), T(Y), T(ENTER), END );
+ }
+ case 5:
+ if (record->event.pressed) {
+ //super secret hash
+ SEND_STRING("supersecrethash");
+ return MACRO_NONE;
+ }
+ case 6:
+ if (record->event.pressed) {
+ // Please sir, can I have some more salt
+ return MACRO( I(50), T(ENTER), I(5), D(LSFT), T(P), U(LSFT), T(L), T(E), T(A), T(S), T(E), T(SPACE), T(S), T(I), T(R), T(COMMA), T(SPACE), T(C), T(A), T(N), T(SPACE), D(LSFT), T(I), U(LSFT), T(SPACE), T(H), T(A), T(V), T(E), T(SPACE), T(S), T(O), T(M), T(E), T(SPACE), T(M), T(O), T(R), T(E), T(SPACE), T(S), T(A), T(L), T(T), D(LSFT), T(SLASH), U(LSFT), D(LSFT), T(1), U(LSFT), T(ENTER), END );
+ }
+ break;
+ case 7:
+ if (record->event.pressed) {
+ // DoomFisted
+ // Hey, look at me. I'm Doomfist, and I'm overpowered!
+ // All I do is spam punches all day! I'm DPS, tank and
+ // defense, rolled into one! All I need is team healing to be complete!
+ return MACRO( I(50), T(ENTER), I(5), D(LSFT), T(H), U(LSFT), T(E), T(Y), T(COMMA), T(SPACE), T(L), T(O), T(O), T(K), T(SPACE), T(A), T(T), T(SPACE), T(M), T(E), T(DOT), T(SPACE), T(SPACE), D(LSFT), T(I), U(LSFT), T(QUOTE), T(M), T(SPACE), D(LSFT), T(D), U(LSFT), T(O), T(O), T(M), T(F), T(I), T(S), T(T), T(COMMA), T(SPACE), T(A), T(N), T(D), T(SPACE), D(LSFT), T(I), U(LSFT), T(QUOTE), T(M), T(SPACE), T(O), T(V), T(E), T(R), T(P), T(O), T(W), T(E), T(R), T(E), T(D), D(LSFT), T(1), U(LSFT), T(SPACE), T(SPACE), D(LSFT), T(A), U(LSFT), T(L), T(L), T(SPACE), D(LSFT), T(I), U(LSFT), T(SPACE), T(D), T(O), T(SPACE), T(I), T(S), T(SPACE), T(S), T(P), T(A), T(M), T(SPACE), T(P), T(U), T(N), T(C), T(H), T(E), T(S), T(SPACE), T(A), T(L), T(L), T(SPACE), T(D), T(A), T(Y), D(LSFT), T(1), U(LSFT), T(SPACE), T(SPACE), T(SPACE), D(LSFT), T(I), U(LSFT), T(QUOTE), T(M), T(SPACE), D(LSFT), T(D), U(LSFT), D(LSFT), T(P), U(LSFT), D(LSFT), T(S), U(LSFT), T(COMMA), T(SPACE), T(T), T(A), T(N), T(K), T(SPACE), T(A), T(N), T(D), T(SPACE), T(D), T(E), T(F), T(E), T(N), T(S), T(E), T(COMMA), T(SPACE), T(R), T(O), T(L), T(L), T(E), T(D), T(SPACE), T(I), T(N), T(T), T(O), T(SPACE), T(O), T(N), T(E), D(LSFT), T(1), U(LSFT), T(SPACE), D(LSFT), T(A), U(LSFT), T(L), T(L), T(SPACE), D(LSFT), T(I), U(LSFT), T(SPACE), T(N), T(E), T(E), T(D), T(SPACE), T(I), T(S), T(SPACE), T(T), T(E), T(A), T(M), T(SPACE), T(H), T(E), T(A), T(L), T(I), T(N), T(G), T(SPACE), T(T), T(O), T(SPACE), T(B), T(E), T(SPACE), T(C), T(O), T(M), T(P), T(L), T(E), T(T), T(E), D(LSFT), T(1), U(LSFT), T(ENTER), END );
+ }
+ case 8: //MAC1 - Hold for rshift and } on tap
+ if (record->event.pressed) {
+ key_timer = timer_read();
+ return MACRO(D(LSFT), END );
+ } else {
+ return checktime() ? MACRO(U(LSFT),D(RALT),T(7),U(RALT),END): MACRO(U(LSFT),END);
+ }; break;
+ case 9: //MAC1 - Hold for rshift and } on tap
+ if (record->event.pressed) {
+ key_timer = timer_read();
+ return MACRO(D(RSFT), END );
+ } else {
+ return checktime() ? MACRO(U(RSFT),D(RALT),T(0),U(RALT),END): MACRO(U(RSFT),END);
+ }; break;
+ case 10: //MAC2 - Hold for lctrl and [ on tap
+ if (record->event.pressed) {
+ key_timer = timer_read();
+ return MACRO(D(LCTL), END );
+ } else {return checktime() ? MACRO(U(LCTL),D(RALT),T(8),U(RALT),END):MACRO(U(LCTL),END);
+ }; break;
+ case 11: //MAC3 - Hold for rctrl and ] on tap
+ if (record->event.pressed) {
+ key_timer = timer_read();
+ return MACRO(D(RCTL), END );
+ } else {
+ return checktime() ? MACRO(U(RCTL),D(RALT),T(9),U(RALT),END):MACRO(U(RCTL),END);
+ }; break;
+ }
+ return MACRO_NONE;
+};
+
+
+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) {
+ rgblight_mode(1);
+ }
+ return false;
+ break;
+
+ case RGB_0000FF:
+ if (record->event.pressed) {
+ #ifdef RGBLIGHT_ENABLE
+ rgblight_enable();
+ rgblight_mode(1);
+ rgblight_setrgb(0x00,0x00,0xff);
+ #endif
+ }
+ return false;
+ break;
+
+ case RGB_008000:
+ if (record->event.pressed) {
+ #ifdef RGBLIGHT_ENABLE
+ rgblight_enable();
+ rgblight_mode(1);
+ rgblight_setrgb(0x00,0x80,0x00);
+ #endif
+ }
+ return false;
+ break;
+
+ case RGB_FF0000:
+ if (record->event.pressed) {
+ #ifdef RGBLIGHT_ENABLE
+ rgblight_enable();
+ rgblight_mode(1);
+ rgblight_setrgb(0xff,0x00,0x00);
+ #endif
+ }
+ return false;
+ break;
+
+ case RGB_800080:
+ if (record->event.pressed) {
+ #ifdef RGBLIGHT_ENABLE
+ rgblight_enable();
+ rgblight_mode(1);
+ rgblight_setrgb(0x80,0x00,0x80);
+ #endif
+ }
+ return false;
+ break;
+
+ case RGB_00FF90:
+ if (record->event.pressed) {
+ #ifdef RGBLIGHT_ENABLE
+ rgblight_enable();
+ rgblight_mode(1);
+ rgblight_setrgb(0x00,0xff,0x90);
+ #endif
+ }
+ return false;
+ break;
+ case KC_DIABLO_CLEAR:
+ if (record->event.pressed) {
+ uint8_t dtime;
+
+ for (dtime = 0; dtime < 4; dtime++) {
+ diablo_key_time[dtime] = diablo_times[0];
+ }
+ }
+ return false;
+ break;
+
+ }
+ return true;
+}
+
+void send_diablo_keystroke (uint8_t diablo_key) {
+ if (current_layer == DIABLO) {
+ switch (diablo_key) {
+ case 0:
+ SEND_STRING("1");
+ break;
+ case 1:
+ SEND_STRING("2");
+ break;
+ case 2:
+ SEND_STRING("3");
+ break;
+ case 3:
+ SEND_STRING("4");
+ break;
+ }
+ }
+}
+
+void run_diablo_macro_check(void) {
+ uint8_t dtime;
+
+ for (dtime = 0; dtime < 4; dtime++) {
+ if (check_dtimer(dtime) && diablo_key_time[dtime]) {
+ diablo_timer[dtime] = timer_read();
+ send_diablo_keystroke(dtime);
+ }
+ }
+
+}
+
+void matrix_init_user(void) { // Runs boot tasks for keyboard
+ wait_ms(500);
+ ergodox_board_led_on();
+ wait_ms(200);
+ ergodox_right_led_1_on();
+ wait_ms(200);
+ ergodox_right_led_2_on();
+ wait_ms(200);
+ ergodox_right_led_3_on();
+ wait_ms(200);
+ ergodox_board_led_off();
+ wait_ms(200);
+ ergodox_right_led_1_off();
+ wait_ms(200);
+ ergodox_right_led_2_off();
+ wait_ms(200);
+ ergodox_right_led_3_off();
+
+
+#ifdef LAYER_UNDERGLOW_LIGHTING
+ rgblight_enable();
+ rgblight_sethsv(195,255,255);
+#endif
+ has_layer_changed = false;
+
+
+
+};
+
+
+
+void matrix_scan_user(void) { // runs frequently to update info
+ uint8_t modifiders = get_mods();
+ uint8_t layer = biton32(layer_state);
+
+ if (!skip_leds) {
+ ergodox_board_led_off();
+ ergodox_right_led_1_off();
+ ergodox_right_led_2_off();
+ ergodox_right_led_3_off();
+
+ if ( modifiders & MODS_SHIFT_MASK) {
+ ergodox_right_led_1_on();
+ }
+ if ( modifiders & MODS_CTRL_MASK) {
+ ergodox_right_led_2_on();
+ }
+ if ( modifiders & MODS_ALT_MASK) {
+ ergodox_right_led_3_on();
+ }
+
+ }
+
+ switch (layer) {
+ case SYMB:
+ #ifdef LAYER_UNDERGLOW_LIGHTING
+ if (has_layer_changed) {
+ rgblight_sethsv (240,255,255);
+ }
+ #else
+ ergodox_right_led_3_on();
+ #endif
+ break;
+ case OVERWATCH:
+ #ifdef LAYER_UNDERGLOW_LIGHTING
+ if (has_layer_changed) {
+ rgblight_sethsv (30,255,255);
+ }
+ #else
+ ergodox_right_led_2_on();
+ #endif
+ break;
+ case DIABLO:
+ #ifdef LAYER_UNDERGLOW_LIGHTING
+ if (has_layer_changed) {
+ rgblight_sethsv (0,255,255);
+ }
+ #else
+ ergodox_right_led_1_on();
+ #endif
+ break;
+ case MOUS:
+ #ifdef LAYER_UNDERGLOW_LIGHTING
+ if (has_layer_changed) {
+ rgblight_sethsv (60,255,255);
+ }
+ #else
+ ergodox_right_led_3_on();
+ ergodox_right_led_2_on();
+ #endif
+ break;
+ case COLEMAK:
+ #ifdef LAYER_UNDERGLOW_LIGHTING
+ if (has_layer_changed) {
+ rgblight_sethsv (300,255,255);
+ }
+ #else
+ ergodox_right_led_1_on();
+ ergodox_right_led_3_on();
+ #endif
+ break;
+ case DVORAK:
+ #ifdef LAYER_UNDERGLOW_LIGHTING
+ if (has_layer_changed) {
+ rgblight_sethsv (120,255,255);
+ }
+ #else
+ ergodox_right_led_2_on();
+ ergodox_right_led_1_on();
+ #endif
+ break;
+ case 7:
+ #ifdef LAYER_UNDERGLOW_LIGHTING
+ if (has_layer_changed) {
+ rgblight_sethsv (255,255,255);
+ }
+ #else
+ ergodox_right_led_1_on();
+ ergodox_right_led_2_on();
+ ergodox_right_led_3_on();
+ #endif
+ break;
+ default:
+ // Do not add anything here, as this will be ran EVERY check, and can cause a significant slowdown
+ #ifdef LAYER_UNDERGLOW_LIGHTING
+ if (has_layer_changed) {
+ rgblight_sethsv (195,255,255);
+ }
+ #endif
+ break;
+ }
+
+ if (current_layer == layer) {
+ has_layer_changed = false;
+ } else {
+ has_layer_changed = true;
+ current_layer = layer;
+ }
+ run_diablo_macro_check();
+};
+
+
diff --git a/keyboards/ergodox_ez/keymaps/drashna/Makefile b/keyboards/ergodox_ez/keymaps/drashna/Makefile
new file mode 100644
index 0000000000..9dfddf01ec
--- /dev/null
+++ b/keyboards/ergodox_ez/keymaps/drashna/Makefile
@@ -0,0 +1,6 @@
+RGBLIGHT_ENABLE = yes
+RGBLIGHT_ANIMATION = no
+
+ifndef QUANTUM_DIR
+ include ../../../../Makefile
+endif
diff --git a/keyboards/ergodox_ez/keymaps/drashna/config.h b/keyboards/ergodox_ez/keymaps/drashna/config.h
new file mode 100644
index 0000000000..258dc391fe
--- /dev/null
+++ b/keyboards/ergodox_ez/keymaps/drashna/config.h
@@ -0,0 +1,11 @@
+
+#include "../../config.h"
+
+
+
+// make this easy to toggle behavior, so that it can be more easily toggled
+#define LAYER_UNDERGLOW_LIGHTING
+
+#ifdef LAYER_UNDERGLOW_LIGHTING
+#undef RGBLIGHT_ANIMATIONS
+#endif \ No newline at end of file
diff --git a/keyboards/ergodox_ez/keymaps/drashna/keymap.c b/keyboards/ergodox_ez/keymaps/drashna/keymap.c
new file mode 100644
index 0000000000..cef0e9c39f
--- /dev/null
+++ b/keyboards/ergodox_ez/keymaps/drashna/keymap.c
@@ -0,0 +1,195 @@
+#include QMK_KEYBOARD_H
+#include "debug.h"
+#include "action_layer.h"
+#include "version.h"
+
+
+#include "keymap_german.h"
+
+#include "keymap_nordic.h"
+
+#define VERSION M(0)
+
+
+// Define layer names
+#define BASE 0
+#define SYMB 1
+#define MOUS 2
+
+#ifdef LAYER_UNDERGLOW_LIGHTING
+bool has_layer_changed = true;
+
+#define rgblight_set_teal rgblight_setrgb(0x00, 0xFF, 0xFF)
+#define rgblight_set_red rgblight_setrgb(0xFF, 0x00, 0x00)
+#define rgblight_set_blue rgblight_setrgb(0x00, 0xFF, 0x00);
+#define rgblight_set_green rgblight_setrgb(0x00, 0x00, 0xFF);
+#define rgblight_set_yellow rgblight_setrgb(0xFF, 0xFF, 0x00);
+
+
+#define MODS_SHIFT_MASK (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT))
+#define MODS_CTRL_MASK (MOD_BIT(KC_LCTL)|MOD_BIT(KC_RCTRL))
+#define MODS_ALT_MASK (MOD_BIT(KC_LALT)|MOD_BIT(KC_RALT))
+#endif
+
+
+enum custom_keycodes {
+ PLACEHOLDER = SAFE_RANGE, // can always be here
+ EPRM,
+ VRSN,
+#ifndef LAYER_UNDERGLOW_LIGHTING
+ RGB_SLD,
+#endif
+};
+
+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+
+ [0] = KEYMAP(KC_EQUAL,KC_1,KC_2,KC_3,KC_4,KC_5,KC_LEFT,KC_DELETE,KC_Q,KC_W,KC_E,KC_R,KC_T,TG(1),KC_BSPACE,KC_A,KC_S,KC_D,KC_F,KC_G,KC_LSHIFT,CTL_T(KC_Z),KC_X,KC_C,KC_V,KC_B,ALL_T(KC_NO),LT(1,KC_GRAVE),KC_QUOTE,LALT(KC_LSHIFT),KC_LEFT,KC_RIGHT,ALT_T(KC_APPLICATION),KC_LGUI,KC_HOME,KC_SPACE,KC_BSPACE,KC_END,KC_RIGHT,KC_6,KC_7,KC_8,KC_9,KC_0,KC_MINUS,TG(1),KC_Y,KC_U,KC_I,KC_O,KC_P,KC_BSLASH,KC_H,KC_J,KC_K,KC_L,LT(2,KC_SCOLON),GUI_T(KC_QUOTE),MEH_T(KC_NO),KC_N,KC_M,KC_COMMA,KC_DOT,CTL_T(KC_SLASH),KC_RSHIFT,KC_UP,KC_DOWN,KC_LBRACKET,KC_RBRACKET,MO(1),KC_LALT,CTL_T(KC_ESCAPE),KC_PGUP,KC_PGDOWN,KC_TAB,KC_ENTER),
+
+#ifdef LAYER_UNDERGLOW_LIGHTING
+ [1] = KEYMAP(KC_ESCAPE,KC_F1,KC_F2,KC_F3,KC_F4,KC_F5,KC_TRANSPARENT,VERSION,KC_EXLM,KC_AT,KC_LCBR,KC_RCBR,KC_PIPE,KC_TRANSPARENT,VRSN,KC_HASH,KC_DLR,KC_LPRN,KC_RPRN,KC_GRAVE,RESET,KC_PERC,KC_CIRC,KC_LBRACKET,KC_RBRACKET,KC_TILD,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,RGB_VAD,RGB_VAI,KC_TRANSPARENT,KC_TRANSPARENT,KC_F6,KC_F7,KC_F8,KC_F9,KC_F10,KC_F11,KC_TRANSPARENT,KC_UP,KC_7,KC_8,KC_9,KC_ASTR,KC_F12,KC_DOWN,KC_4,KC_5,KC_6,KC_PLUS,KC_TRANSPARENT,KC_TRANSPARENT,KC_AMPR,KC_1,KC_2,KC_3,KC_BSLASH,KC_TRANSPARENT,KC_TRANSPARENT,KC_DOT,KC_0,KC_EQUAL,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT),
+#else
+ [1] = KEYMAP(KC_ESCAPE,KC_F1,KC_F2,KC_F3,KC_F4,KC_F5,KC_TRANSPARENT,VERSION,KC_EXLM,KC_AT,KC_LCBR,KC_RCBR,KC_PIPE,KC_TRANSPARENT,VRSN,KC_HASH,KC_DLR,KC_LPRN,KC_RPRN,KC_GRAVE,RESET,KC_PERC,KC_CIRC,KC_LBRACKET,KC_RBRACKET,KC_TILD,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,RGB_MOD,KC_TRANSPARENT,KC_TRANSPARENT,RGB_VAD,RGB_VAI,KC_TRANSPARENT,KC_TRANSPARENT,KC_F6,KC_F7,KC_F8,KC_F9,KC_F10,KC_F11,KC_TRANSPARENT,KC_UP,KC_7,KC_8,KC_9,KC_ASTR,KC_F12,KC_DOWN,KC_4,KC_5,KC_6,KC_PLUS,KC_TRANSPARENT,KC_TRANSPARENT,KC_AMPR,KC_1,KC_2,KC_3,KC_BSLASH,KC_TRANSPARENT,KC_TRANSPARENT,KC_DOT,KC_0,KC_EQUAL,KC_TRANSPARENT,RGB_TOG,RGB_SLD,KC_TRANSPARENT,KC_TRANSPARENT,RGB_HUD,RGB_HUI),
+#endif
+
+ [2] = KEYMAP(KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_MS_UP,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_MS_LEFT,KC_MS_DOWN,KC_MS_RIGHT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_MS_BTN1,KC_MS_BTN2,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_MEDIA_PLAY_PAUSE,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_MEDIA_PREV_TRACK,KC_MEDIA_NEXT_TRACK,KC_TRANSPARENT,KC_TRANSPARENT,KC_AUDIO_VOL_UP,KC_AUDIO_VOL_DOWN,KC_AUDIO_MUTE,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_TRANSPARENT,KC_WWW_BACK),
+
+};
+
+const uint16_t PROGMEM fn_actions[] = {
+ [1] = ACTION_LAYER_TAP_TOGGLE(1)
+};
+
+// leaving this in place for compatibilty with old keymaps cloned and re-compiled.
+const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
+{
+ switch(id) {
+ case 0:
+ if (record->event.pressed) {
+ SEND_STRING (QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION);
+ }
+ break;
+ }
+ return MACRO_NONE;
+};
+
+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;
+#ifndef LAYER_UNDERGLOW_LIGHTING
+ case RGB_SLD:
+ if (record->event.pressed) {
+ rgblight_mode(1);
+ }
+ return false;
+ break;
+#endif
+
+ }
+ return true;
+}
+
+
+
+
+void matrix_scan_user(void) {
+
+ uint8_t new_layer = biton32(layer_state);
+
+ ergodox_board_led_off();
+ ergodox_right_led_1_off();
+ ergodox_right_led_2_off();
+ ergodox_right_led_3_off();
+
+#ifdef LAYER_UNDERGLOW_LIGHTING
+ static uint8_t old_layer = 0;
+ uint8_t modifiders = get_mods();
+
+ if ( modifiders & MODS_SHIFT_MASK) {
+ ergodox_right_led_1_on();
+ }
+ if ( modifiders & MODS_CTRL_MASK) {
+ ergodox_right_led_2_on();
+ }
+ if ( modifiders & MODS_ALT_MASK) {
+ ergodox_right_led_3_on();
+ }
+
+ if (old_layer != new_layer) {
+ has_layer_changed = true;
+ old_layer = new_layer;
+ }
+ if (has_layer_changed) {
+ switch (new_layer) {
+ case 1:
+ rgblight_set_red;
+ break;
+ case 2:
+ rgblight_set_blue;
+ break;
+ case 3:
+ rgblight_set_green;
+ break;
+ case 4:
+ rgblight_set_yellow;
+ break;
+ case 5:
+ rgblight_setrgb(0xFF, 0xFF, 0x00);
+ break;
+ case 6:
+ rgblight_setrgb(0xFF, 0xFF, 0x00);
+ break;
+ case 7:
+ rgblight_setrgb(0xFF, 0xFF, 0xFF);
+ break;
+ default:
+ rgblight_set_teal;
+ break;
+ }
+ has_layer_changed = false;
+ }
+
+#else
+ switch (new_layer) {
+ case 1:
+ ergodox_right_led_1_on();
+ break;
+ case 2:
+ ergodox_right_led_2_on();
+ break;
+ case 3:
+ ergodox_right_led_3_on();
+ break;
+ case 4:
+ ergodox_right_led_1_on();
+ ergodox_right_led_2_on();
+ break;
+ case 5:
+ ergodox_right_led_1_on();
+ ergodox_right_led_3_on();
+ break;
+ case 6:
+ ergodox_right_led_2_on();
+ ergodox_right_led_3_on();
+ break;
+ case 7:
+ ergodox_right_led_1_on();
+ ergodox_right_led_2_on();
+ ergodox_right_led_3_on();
+ break;
+ default:
+ break;
+ }
+#endif
+};
diff --git a/keyboards/ergodox_ez/keymaps/drashna/readme.md b/keyboards/ergodox_ez/keymaps/drashna/readme.md
new file mode 100644
index 0000000000..90fe44861a
--- /dev/null
+++ b/keyboards/ergodox_ez/keymaps/drashna/readme.md
@@ -0,0 +1,9 @@
+# Drashna's ErgoDox EZ Underglow Mod
+
+This is based on the default Ergodox EZ keymap.
+
+This modifieds the keymay so that it uses the underglow to indicate which layer you're on, rather than the top LEDs.
+
+Default colors are "teal" for base layer, "red" for Symbols, and "green" for mouse/media. Blue would be the next layer, if you had more.
+
+Additionally, the top LEDs are Shift/Control/Alt indicators instead (in that order). \ No newline at end of file
diff --git a/keyboards/ergodox_ez/keymaps/profet_80/keymap.c b/keyboards/ergodox_ez/keymaps/profet_80/keymap.c
new file mode 100644
index 0000000000..06c4f77d6c
--- /dev/null
+++ b/keyboards/ergodox_ez/keymaps/profet_80/keymap.c
@@ -0,0 +1,183 @@
+#include QMK_KEYBOARD_H
+#include "debug.h"
+#include "action_layer.h"
+#include "version.h"
+
+#define BASE 0 // default layer
+#define SYMB 1 // symbols
+#define MDIA 2 // media keys
+
+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+/* Keymap 0: Basic layer
+ *
+ * ,--------------------------------------------------. ,--------------------------------------------------.
+ * | = | 1 | 2 | 3 | 4 | 5 | LEFT | | RIGHT| 6 | 7 | 8 | 9 | 0 | - |
+ * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
+ * | Del | Q | W | E | R | T | L1 | | L1 | Y | U | I | O | P | \ |
+ * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
+ * | BkSp | A | S | D | F | G |------| |------| H | J | K | L |; / L2|' / Cmd |
+ * |--------+------+------+------+------+------| Hyper| | Meh |------+------+------+------+------+--------|
+ * | LShift |Z/Ctrl| X | C | V | B | | | | N | M | , | . |//Ctrl| RShift |
+ * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
+ * |Grv/L1| '" |AltShf| Left | Right| | Up | Down | [ | ] | ~L1 |
+ * `----------------------------------' `----------------------------------'
+ * ,-------------. ,-------------.
+ * | App | LGui | | Alt |Ctrl/Esc|
+ * ,------|------|------| |------+--------+------.
+ * | 1 | 2 | Home | | PgUp | 3 | 4 |
+ * |------|------|------| |------|--------|------|
+ * | Space| BkSp | End | | PgDn | Tab |Enter |
+ * `--------------------' `----------------------'
+ */
+// If it accepts an argument (i.e, is a function), it doesn't need KC_.
+// Otherwise, it needs KC_*
+[BASE] = KEYMAP_80( // layer 0 : default
+ // left hand
+ KC_EQL, KC_1, KC_2, KC_3, KC_4, KC_5, KC_LEFT,
+ KC_DELT, KC_Q, KC_W, KC_E, KC_R, KC_T, TG(SYMB),
+ KC_BSPC, KC_A, KC_S, KC_D, KC_F, KC_G,
+ KC_LSFT, CTL_T(KC_Z), KC_X, KC_C, KC_V, KC_B, ALL_T(KC_NO),
+ LT(SYMB,KC_GRV),KC_QUOT, LALT(KC_LSFT), KC_LEFT,KC_RGHT,
+ ALT_T(KC_APP), KC_LGUI,
+ KC_1, KC_2, KC_HOME,
+ KC_SPC,KC_BSPC,KC_END,
+ // right hand
+ KC_RGHT, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS,
+ TG(SYMB), KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLS,
+ KC_H, KC_J, KC_K, KC_L, LT(MDIA, KC_SCLN),GUI_T(KC_QUOT),
+ MEH_T(KC_NO),KC_N, KC_M, KC_COMM,KC_DOT, CTL_T(KC_SLSH), KC_RSFT,
+ KC_UP, KC_DOWN,KC_LBRC,KC_RBRC, KC_FN1,
+ KC_LALT, CTL_T(KC_ESC),
+ KC_PGUP,KC_3, KC_4,
+ KC_PGDN,KC_TAB, KC_ENT
+ ),
+/* Keymap 1: Symbol Layer
+ *
+ * ,--------------------------------------------------. ,--------------------------------------------------.
+ * |Version | F1 | F2 | F3 | F4 | F5 | | | | F6 | F7 | F8 | F9 | F10 | F11 |
+ * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
+ * | | ! | @ | { | } | | | | | | Up | 7 | 8 | 9 | * | F12 |
+ * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
+ * | | # | $ | ( | ) | ` |------| |------| Down | 4 | 5 | 6 | + | |
+ * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
+ * | | % | ^ | [ | ] | ~ | | | | & | 1 | 2 | 3 | \ | |
+ * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
+ * | | | | | | | | . | 0 | = | |
+ * `----------------------------------' `----------------------------------'
+ * ,-------------. ,-------------.
+ * | | | | | |
+ * ,------|------|------| |------+------+------.
+ * | | | | | | | |
+ * |------|------|------| |------|------|------|
+ * | | | | | | | |
+ * `--------------------' `--------------------'
+ */
+// SYMBOLS
+[SYMB] = KEYMAP_80(
+ // left hand
+ M(0), KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_TRNS,
+ KC_TRNS,KC_EXLM,KC_AT, KC_LCBR,KC_RCBR,KC_PIPE,KC_TRNS,
+ 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,
+ KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,
+ KC_TRNS,KC_TRNS,
+ KC_TRNS,KC_TRNS,KC_TRNS,
+ KC_TRNS,KC_TRNS,KC_TRNS,
+ // right hand
+ KC_TRNS, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11,
+ KC_TRNS, KC_UP, KC_7, KC_8, KC_9, KC_ASTR, KC_F12,
+ 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,
+ KC_TRNS, KC_TRNS,
+ KC_TRNS, KC_TRNS, KC_TRNS,
+ KC_TRNS, KC_TRNS, KC_TRNS
+),
+/* Keymap 2: Media and mouse keys
+ *
+ * ,--------------------------------------------------. ,--------------------------------------------------.
+ * | | | | | | | | | | | | | | | |
+ * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
+ * | | | | MsUp | | | | | | | | | | | |
+ * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
+ * | | |MsLeft|MsDown|MsRght| |------| |------| | | | | | Play |
+ * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
+ * | | | | | | | | | | | | Prev | Next | | |
+ * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
+ * | | | | Lclk | Rclk | |VolUp |VolDn | Mute | | |
+ * `----------------------------------' `----------------------------------'
+ * ,-------------. ,-------------.
+ * | | | | | |
+ * ,------|------|------| |------+------+----------.
+ * | | | | | | | |
+ * |------|------|------| |------|------|----------|
+ * | | | | | | |BrwserBack|
+ * `--------------------' `------------------------'
+ */
+// MEDIA AND MOUSE
+[MDIA] = KEYMAP_80(
+ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
+ KC_TRNS, KC_TRNS, KC_TRNS, KC_MS_U, KC_TRNS, KC_TRNS, KC_TRNS,
+ KC_TRNS, KC_TRNS, KC_MS_L, KC_MS_D, KC_MS_R, KC_TRNS,
+ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
+ KC_TRNS, KC_TRNS, KC_TRNS, KC_BTN1, KC_BTN2,
+ KC_TRNS, KC_TRNS,
+ KC_TRNS, KC_TRNS, KC_TRNS,
+ KC_TRNS, KC_TRNS, KC_TRNS,
+ // right hand
+ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
+ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
+ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MPLY,
+ KC_TRNS, KC_TRNS, KC_TRNS, KC_MPRV, KC_MNXT, KC_TRNS, KC_TRNS,
+ KC_VOLU, KC_VOLD, KC_MUTE, KC_TRNS, KC_TRNS,
+ KC_TRNS, KC_TRNS,
+ KC_TRNS, KC_TRNS, KC_TRNS,
+ KC_TRNS, KC_TRNS, KC_WBAK
+),
+};
+
+const uint16_t PROGMEM fn_actions[] = {
+ [1] = ACTION_LAYER_TAP_TOGGLE(SYMB) // FN1 - Momentary Layer 1 (Symbols)
+};
+
+const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
+{
+ // MACRODOWN only works in this function
+ switch(id) {
+ case 0:
+ if (record->event.pressed) {
+ SEND_STRING (QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION);
+ }
+ break;
+ }
+ return MACRO_NONE;
+};
+
+// Runs just one time when the keyboard initializes.
+void matrix_init_user(void) {
+
+};
+
+// 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) {
+ // TODO: Make this relevant to the ErgoDox EZ.
+ case 1:
+ ergodox_right_led_1_on();
+ break;
+ case 2:
+ ergodox_right_led_2_on();
+ break;
+ default:
+ // none
+ break;
+ }
+
+};
diff --git a/keyboards/ergodox_ez/keymaps/profet_80/readme.md b/keyboards/ergodox_ez/keymaps/profet_80/readme.md
new file mode 100644
index 0000000000..7380e3465f
--- /dev/null
+++ b/keyboards/ergodox_ez/keymaps/profet_80/readme.md
@@ -0,0 +1,10 @@
+# ErgoDox 80 Default Configuration
+
+This is based on the default Ergodox EZ keymap.
+The difference is that this keymap supports 80 key layouts.
+If you own an 80 key Ergodox, use this as an example to get your desired keymap.
+
+**NOTE:** This layout is not physically supported by the Ergodox EZ.
+
+
+![Default80](https://i.imgur.com/P2Lga9x.png)
diff --git a/keyboards/ergodox_ez/keymaps/steno/Makefile b/keyboards/ergodox_ez/keymaps/steno/Makefile
new file mode 100644
index 0000000000..b6fb9b1a80
--- /dev/null
+++ b/keyboards/ergodox_ez/keymaps/steno/Makefile
@@ -0,0 +1,3 @@
+VIRTSER_ENABLE = yes
+# Not enough interupts, so something has to go
+MOUSEKEY_ENABLE = no
diff --git a/keyboards/ergodox_ez/keymaps/steno/keymap.c b/keyboards/ergodox_ez/keymaps/steno/keymap.c
new file mode 100644
index 0000000000..86b16f1618
--- /dev/null
+++ b/keyboards/ergodox_ez/keymaps/steno/keymap.c
@@ -0,0 +1,324 @@
+#include QMK_KEYBOARD_H
+#include "debug.h"
+#include "action_layer.h"
+#include "sendchar.h"
+#include "virtser.h"
+
+#define BASE 0 // default layer
+#define SYMB 1 // symbols
+#define MDIA 2 // media keys
+#define TXBOLT 3 // TxBolt Steno Virtual Serial
+#define TXBOLT2 4 // TxBolt Steno Virtual Serial Alternative Layout
+
+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+/* Keymap 0: Basic layer
+ *
+ * ,--------------------------------------------------. ,--------------------------------------------------.
+ * | = | 1 | 2 | 3 | 4 | 5 | LEFT | | RIGHT| 6 | 7 | 8 | 9 | 0 | - |
+ * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
+ * | Del | Q | W | E | R | T | L1 | | TX | Y | U | I | O | P | \ |
+ * |--------+------+------+------+------+------| | | BOLT |------+------+------+------+------+--------|
+ * | BkSp | A | S | D | F | G |------| |------| H | J | K | L |; / L2|' / Cmd |
+ * |--------+------+------+------+------+------| Hyper| | Meh |------+------+------+------+------+--------|
+ * | LShift |Z/Ctrl| X | C | V | B | | | | N | M | , | . |//Ctrl| RShift |
+ * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
+ * |Grv/L1| '" |AltShf| Left | Right| | Up | Down | [ | ] | ~L1 |
+ * `----------------------------------' `----------------------------------'
+ * ,-------------. ,-------------.
+ * | App | LGui | | Alt |Ctrl/Esc|
+ * ,------|------|------| |------+--------+------.
+ * | | | Home | | PgUp | | |
+ * | Space|Backsp|------| |------| Tab |Enter |
+ * | |ace | End | | PgDn | | |
+ * `--------------------' `----------------------'
+ */
+// If it accepts an argument (i.e, is a function), it doesn't need KC_.
+// Otherwise, it needs KC_*
+[BASE] = KEYMAP( // layer 0 : default
+ // left hand
+ KC_EQL, KC_1, KC_2, KC_3, KC_4, KC_5, KC_LEFT,
+ KC_DELT, KC_Q, KC_W, KC_E, KC_R, KC_T, TG(SYMB),
+ KC_BSPC, KC_A, KC_S, KC_D, KC_F, KC_G,
+ KC_LSFT, CTL_T(KC_Z), KC_X, KC_C, KC_V, KC_B, ALL_T(KC_NO),
+ LT(SYMB,KC_GRV),KC_QUOT, LALT(KC_LSFT), KC_LEFT,KC_RGHT,
+ ALT_T(KC_APP), KC_LGUI,
+ KC_HOME,
+ KC_SPC,KC_BSPC,KC_END,
+ // right hand
+ KC_RGHT, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS,
+ TG(TXBOLT), KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLS,
+ KC_H, KC_J, KC_K, KC_L, LT(MDIA, KC_SCLN),GUI_T(KC_QUOT),
+ MEH_T(KC_NO),KC_N, KC_M, KC_COMM,KC_DOT, CTL_T(KC_SLSH), KC_RSFT,
+ KC_UP, KC_DOWN,KC_LBRC,KC_RBRC, KC_FN1,
+ KC_LALT, CTL_T(KC_ESC),
+ KC_PGUP,
+ KC_PGDN,KC_TAB, KC_ENT
+ ),
+/* Keymap 1: Symbol Layer
+ *
+ * ,--------------------------------------------------. ,--------------------------------------------------.
+ * |Version | F1 | F2 | F3 | F4 | F5 | | | | F6 | F7 | F8 | F9 | F10 | F11 |
+ * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
+ * | | ! | @ | { | } | | | | | | Up | 7 | 8 | 9 | * | F12 |
+ * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
+ * | | # | $ | ( | ) | ` |------| |------| Down | 4 | 5 | 6 | + | |
+ * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
+ * | | % | ^ | [ | ] | ~ | | | | & | 1 | 2 | 3 | \ | |
+ * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
+ * | | | | | | | | . | 0 | = | |
+ * `----------------------------------' `----------------------------------'
+ * ,-------------. ,-------------.
+ * | | | | | |
+ * ,------|------|------| |------+------+------.
+ * | | | | | | | |
+ * | | |------| |------| | |
+ * | | | | | | | |
+ * `--------------------' `--------------------'
+ */
+// SYMBOLS
+[SYMB] = KEYMAP(
+ // left hand
+ M(0), KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_TRNS,
+ KC_TRNS,KC_EXLM,KC_AT, KC_LCBR,KC_RCBR,KC_PIPE,KC_TRNS,
+ 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,
+ KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,
+ KC_TRNS,KC_TRNS,
+ KC_TRNS,
+ KC_TRNS,KC_TRNS,KC_TRNS,
+ // right hand
+ KC_TRNS, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11,
+ KC_TRNS, KC_UP, KC_7, KC_8, KC_9, KC_ASTR, KC_F12,
+ 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,
+ KC_TRNS, KC_TRNS,
+ KC_TRNS,
+ KC_TRNS, KC_TRNS, KC_TRNS
+),
+/* Keymap 2: Media and mouse keys
+ *
+ * ,--------------------------------------------------. ,--------------------------------------------------.
+ * | RESET | | | | | | | | | | | | | | |
+ * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
+ * | | | | MsUp | | | | | | | | | | | |
+ * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
+ * | | |MsLeft|MsDown|MsRght| |------| |------| | | | | | Play |
+ * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
+ * | | | | | | | | | | | | Prev | Next | | |
+ * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
+ * | | | | Lclk | Rclk | |VolUp |VolDn | Mute | | |
+ * `----------------------------------' `----------------------------------'
+ * ,-------------. ,-------------.
+ * | | | | | |
+ * ,------|------|------| |------+------+------.
+ * | | | | | | |Brwser|
+ * | | |------| |------| |Back |
+ * | | | | | | | |
+ * `--------------------' `--------------------'
+ */
+// MEDIA AND MOUSE
+[MDIA] = KEYMAP(
+ RESET, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
+ KC_TRNS, KC_TRNS, KC_TRNS, KC_MS_U, KC_TRNS, KC_TRNS, KC_TRNS,
+ KC_TRNS, KC_TRNS, KC_MS_L, KC_MS_D, KC_MS_R, KC_TRNS,
+ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
+ KC_TRNS, KC_TRNS, KC_TRNS, KC_BTN1, KC_BTN2,
+ KC_TRNS, KC_TRNS,
+ KC_TRNS,
+ KC_TRNS, KC_TRNS, KC_TRNS,
+ // right hand
+ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
+ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
+ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MPLY,
+ KC_TRNS, KC_TRNS, KC_TRNS, KC_MPRV, KC_MNXT, KC_TRNS, KC_TRNS,
+ KC_VOLU, KC_VOLD, KC_MUTE, KC_TRNS, KC_TRNS,
+ KC_TRNS, KC_TRNS,
+ KC_TRNS,
+ KC_TRNS, KC_TRNS, KC_WBAK
+),
+// TxBolt Codes
+#define Sl 0b00000001
+#define Tl 0b00000010
+#define Kl 0b00000100
+#define Pl 0b00001000
+#define Wl 0b00010000
+#define Hl 0b00100000
+#define Rl 0b01000001
+#define Al 0b01000010
+#define Ol 0b01000100
+#define X 0b01001000
+#define Er 0b01010000
+#define Ur 0b01100000
+#define Fr 0b10000001
+#define Rr 0b10000010
+#define Pr 0b10000100
+#define Br 0b10001000
+#define Lr 0b10010000
+#define Gr 0b10100000
+#define Tr 0b11000001
+#define Sr 0b11000010
+#define Dr 0b11000100
+#define Zr 0b11001000
+#define NM 0b11010000
+#define GRPMASK 0b11000000
+#define GRP0 0b00000000
+#define GRP1 0b01000000
+#define GRP2 0b10000000
+#define GRP3 0b11000000
+/* Keymap 3: TxBolt (Serial)
+ *
+ * ,--------------------------------------------------. ,--------------------------------------------------.
+ * | BKSPC | | | | | | | | | | | | | | |
+ * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
+ * | | # | # | # | # | # | | | | # | # | # | # | # | # |
+ * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
+ * | | S | T | P | H | * |------| |------| * | F | P | L | T | D |
+ * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
+ * | | S | K | W | R | * | | | | * | R | B | G | S | Z |
+ * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
+ * | | | | | | | | | | | |
+ * `----------------------------------' `----------------------------------'
+ * ,-------------. ,-------------.
+ * | | | | | |
+ * ,------|------|------| |------+------+------.
+ * | | | | | | | |
+ * | A | O |------| |------| E | U |
+ * | | | | | | | |
+ * `--------------------' `--------------------'
+ */
+// TxBolt over Serial
+[TXBOLT] = KEYMAP(
+ KC_BSPC, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,
+ KC_NO, M(NM), M(NM), M(NM), M(NM), M(NM), KC_NO,
+ KC_NO, M(Sl), M(Tl), M(Pl), M(Hl), M(X),
+ KC_NO, M(Sl), M(Kl), M(Wl), M(Rl), M(X), KC_NO,
+ KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,
+ KC_NO, KC_NO,
+ KC_NO,
+ M(Al), M(Ol), KC_NO,
+ // right hand
+ KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,
+ KC_TRNS, M(NM), M(NM), M(NM), M(NM), M(NM), M(NM),
+ M(X), M(Fr), M(Pr), M(Lr), M(Tr), M(Dr),
+ KC_NO, M(X), M(Rr), M(Br), M(Gr), M(Sr), M(Zr),
+ KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,
+ KC_NO, KC_NO,
+ KC_NO,
+ KC_NO, M(Er), M(Ur)
+),
+/* Keymap 4: TxBolt (Serial) Alternative
+ *
+ * ,--------------------------------------------------. ,--------------------------------------------------.
+ * | | # | # | # | # | # | | | | # | # | # | # | # | # |
+ * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
+ * | | S | T | P | H | * | | | | * | F | P | L | T | D |
+ * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
+ * | | S | K | W | R | * |------| |------| * | R | B | G | S | Z |
+ * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
+ * | | | | | | | | | | | | | | | |
+ * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
+ * | | | | A | O | | E | U | | | |
+ * `----------------------------------' `----------------------------------'
+ * ,-------------. ,-------------.
+ * | | | | | |
+ * ,------|------|------| |------+------+------.
+ * | | | | | | | |
+ * | | |------| |------| | |
+ * | | | | | | | |
+ * `--------------------' `--------------------'
+ */
+// TxBolt over Serial
+[TXBOLT2] = KEYMAP(
+ KC_NO, M(NM), M(NM), M(NM), M(NM), M(NM), KC_NO,
+ KC_NO, M(Sl), M(Tl), M(Pl), M(Hl), M(X), KC_NO,
+ KC_NO, M(Sl), M(Kl), M(Wl), M(Rl), M(X),
+ KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,
+ KC_NO, KC_NO, KC_NO, M(Al), M(Ol),
+ KC_NO, KC_NO,
+ KC_NO,
+ KC_NO, KC_NO, KC_NO,
+ // right hand
+ KC_NO, M(NM), M(NM), M(NM), M(NM), M(NM), M(NM),
+ KC_TRNS, M(X), M(Fr), M(Pr), M(Lr), M(Tr), M(Dr),
+ M(X), M(Rr), M(Br), M(Gr), M(Sr), M(Zr),
+ KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,
+ M(Er), M(Ur), KC_NO, KC_NO, KC_NO,
+ KC_NO, KC_NO,
+ KC_NO,
+ KC_NO, KC_NO, KC_NO
+),
+};
+
+const uint16_t PROGMEM fn_actions[] = {
+ [1] = ACTION_LAYER_TAP_TOGGLE(SYMB) // FN1 - Momentary Layer 1 (Symbols)
+};
+
+uint8_t chord[4] = {0,0,0,0};
+uint8_t pressed_count = 0;
+
+void send_chord(void)
+{
+ for(uint8_t i = 0; i < 4; i++)
+ {
+ if(chord[i])
+ virtser_send(chord[i]);
+ }
+ virtser_send(0);
+}
+
+bool process_record_user(uint16_t keycode, keyrecord_t *record)
+{
+ // We need to track keypresses in all modes, in case the user
+ // changes mode whilst pressing other keys.
+ if (record->event.pressed)
+ pressed_count++;
+ else
+ pressed_count--;
+ return true;
+}
+
+const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
+{
+ // MACRODOWN only works in this function
+
+ if (record->event.pressed) {
+ uint8_t grp = (id & GRPMASK) >> 6;
+ chord[grp] |= id;
+ }
+ else {
+ if (pressed_count == 0) {
+ send_chord();
+ chord[0] = chord[1] = chord[2] = chord[3] = 0;
+ }
+ }
+ return MACRO_NONE;
+};
+
+// Runs just one time when the keyboard initializes.
+void matrix_init_user(void) {
+};
+
+// 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) {
+ // TODO: Make this relevant to the ErgoDox EZ.
+ case 1:
+ ergodox_right_led_1_on();
+ break;
+ case 2:
+ ergodox_right_led_2_on();
+ break;
+ default:
+ // none
+ break;
+ }
+
+};
diff --git a/keyboards/ergodox_ez/keymaps/steno/readme.md b/keyboards/ergodox_ez/keymaps/steno/readme.md
new file mode 100644
index 0000000000..d67cde2a3c
--- /dev/null
+++ b/keyboards/ergodox_ez/keymaps/steno/readme.md
@@ -0,0 +1,92 @@
+# ErgoDox EZ Steno Configuration
+
+This layout has a layer that uses the TxBolt Stenograph protocol over a Virtual Serial port. It requires something like Plover in order to function.
+
+In Plover, you can select TX Bolt as the Stenotype Machine, and find the COM port that was assigned. In this way, your regular keyboard will still function normally, and you can switch back and forth between the Steno and Keyboard layers.
+
+<pre><code>
+/* Keymap 0: Basic layer
+ *
+ * ,--------------------------------------------------. ,--------------------------------------------------.
+ * | = | 1 | 2 | 3 | 4 | 5 | LEFT | | RIGHT| 6 | 7 | 8 | 9 | 0 | - |
+ * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
+ * | Del | Q | W | E | R | T | L1 | | TX | Y | U | I | O | P | \ |
+ * |--------+------+------+------+------+------| | | BOLT |------+------+------+------+------+--------|
+ * | BkSp | A | S | D | F | G |------| |------| H | J | K | L |; / L2|' / Cmd |
+ * |--------+------+------+------+------+------| Hyper| | Meh |------+------+------+------+------+--------|
+ * | LShift |Z/Ctrl| X | C | V | B | | | | N | M | , | . |//Ctrl| RShift |
+ * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
+ * |Grv/L1| '" |AltShf| Left | Right| | Up | Down | [ | ] | ~L1 |
+ * `----------------------------------' `----------------------------------'
+ * ,-------------. ,-------------.
+ * | App | LGui | | Alt |Ctrl/Esc|
+ * ,------|------|------| |------+--------+------.
+ * | | | Home | | PgUp | | |
+ * | Space|Backsp|------| |------| Tab |Enter |
+ * | |ace | End | | PgDn | | |
+ * `--------------------' `----------------------'
+ */
+/* Keymap 1: Symbol Layer
+ *
+ * ,--------------------------------------------------. ,--------------------------------------------------.
+ * |Version | F1 | F2 | F3 | F4 | F5 | | | | F6 | F7 | F8 | F9 | F10 | F11 |
+ * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
+ * | | ! | @ | { | } | | | | | | Up | 7 | 8 | 9 | * | F12 |
+ * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
+ * | | # | $ | ( | ) | ` |------| |------| Down | 4 | 5 | 6 | + | |
+ * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
+ * | | % | ^ | [ | ] | ~ | | | | & | 1 | 2 | 3 | \ | |
+ * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
+ * | | | | | | | | . | 0 | = | |
+ * `----------------------------------' `----------------------------------'
+ * ,-------------. ,-------------.
+ * | | | | | |
+ * ,------|------|------| |------+------+------.
+ * | | | | | | | |
+ * | | |------| |------| | |
+ * | | | | | | | |
+ * `--------------------' `--------------------'
+ */
+/* Keymap 2: Media keys
+ *
+ * ,--------------------------------------------------. ,--------------------------------------------------.
+ * | RESET | | | | | | | | | | | | | | |
+ * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
+ * | | | | | | | | | | | | | | | |
+ * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
+ * | | | | | | |------| |------| | | | | | Play |
+ * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
+ * | | | | | | | | | | | | Prev | Next | | |
+ * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
+ * | | | | | | |VolUp |VolDn | Mute | | |
+ * `----------------------------------' `----------------------------------'
+ * ,-------------. ,-------------.
+ * | | | | | |
+ * ,------|------|------| |------+------+------.
+ * | | | | | | |Brwser|
+ * | | |------| |------| |Back |
+ * | | | | | | | |
+ * `--------------------' `--------------------'
+ */
+/* Keymap 3: TxBolt (Serial)
+ *
+ * ,--------------------------------------------------. ,--------------------------------------------------.
+ * | BKSPC | | | | | | | | | | | | | | |
+ * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
+ * | | # | # | # | # | # | | | | # | # | # | # | # | # |
+ * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
+ * | | S | T | P | H | * |------| |------| * | F | P | L | T | D |
+ * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
+ * | | S | K | W | R | * | | | | * | R | B | G | S | Z |
+ * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
+ * | | | | | | | | | | | |
+ * `----------------------------------' `----------------------------------'
+ * ,-------------. ,-------------.
+ * | | | | | |
+ * ,------|------|------| |------+------+------.
+ * | | | | | | | |
+ * | A | O |------| |------| E | U |
+ * | | | | | | | |
+ * `--------------------' `--------------------'
+ */
+</code></pre>
diff --git a/keyboards/ergodox_ez/matrix.c b/keyboards/ergodox_ez/matrix.c
new file mode 100644
index 0000000000..b743cf0d6b
--- /dev/null
+++ b/keyboards/ergodox_ez/matrix.c
@@ -0,0 +1,394 @@
+/*
+
+Note for ErgoDox EZ customizers: Here be dragons!
+This is not a file you want to be messing with.
+All of the interesting stuff for you is under keymaps/ :)
+Love, Erez
+
+Copyright 2013 Oleg Kostyuk <cub.uanic@gmail.com>
+
+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/>.
+*/
+
+/*
+ * scan matrix
+ */
+#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"
+#include "matrix.h"
+#include QMK_KEYBOARD_H
+#include "i2cmaster.h"
+#ifdef DEBUG_MATRIX_SCAN_RATE
+#include "timer.h"
+#endif
+
+/*
+ * 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);
+
+static uint8_t mcp23018_reset_loop;
+
+#ifdef DEBUG_MATRIX_SCAN_RATE
+uint32_t matrix_timer;
+uint32_t matrix_scan_count;
+#endif
+
+
+__attribute__ ((weak))
+void matrix_init_user(void) {}
+
+__attribute__ ((weak))
+void matrix_scan_user(void) {}
+
+__attribute__ ((weak))
+void matrix_init_kb(void) {
+ matrix_init_user();
+}
+
+__attribute__ ((weak))
+void matrix_scan_kb(void) {
+ matrix_scan_user();
+}
+
+inline
+uint8_t matrix_rows(void)
+{
+ return MATRIX_ROWS;
+}
+
+inline
+uint8_t matrix_cols(void)
+{
+ return MATRIX_COLS;
+}
+
+void matrix_init(void)
+{
+ // initialize row and col
+
+ mcp23018_status = init_mcp23018();
+
+
+ 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;
+ }
+ }
+
+#ifdef DEBUG_MATRIX_SCAN_RATE
+ matrix_timer = timer_read32();
+ matrix_scan_count = 0;
+#endif
+
+ matrix_init_quantum();
+
+}
+
+void matrix_power_up(void) {
+ mcp23018_status = init_mcp23018();
+
+ unselect_rows();
+ init_cols();
+
+ // initialize matrix state: all keys off
+ for (uint8_t i=0; i < MATRIX_ROWS; i++) {
+ matrix[i] = 0;
+ }
+
+#ifdef DEBUG_MATRIX_SCAN_RATE
+ matrix_timer = timer_read32();
+ matrix_scan_count = 0;
+#endif
+}
+
+// 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);
+ }
+ }
+ 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;
+ }
+ }
+}
+
+uint8_t matrix_scan(void)
+{
+ if (mcp23018_status) { // if there was an error
+ if (++mcp23018_reset_loop == 0) {
+ // since mcp23018_reset_loop is 8 bit - we'll try to reset once in 255 matrix scans
+ // this will be approx bit more frequent than once per second
+ print("trying to reset mcp23018\n");
+ mcp23018_status = init_mcp23018();
+ if (mcp23018_status) {
+ print("left side not responding\n");
+ } else {
+ print("left side attached\n");
+ ergodox_blink_all_leds();
+ }
+ }
+ }
+
+#ifdef DEBUG_MATRIX_SCAN_RATE
+ matrix_scan_count++;
+
+ uint32_t timer_now = timer_read32();
+ if (TIMER_DIFF_32(timer_now, matrix_timer)>1000) {
+ print("matrix scan frequency: ");
+ pdec(matrix_scan_count);
+ print("\n");
+
+ matrix_timer = timer_now;
+ matrix_scan_count = 0;
+ }
+#endif
+
+ 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;
+}
+
+bool matrix_is_modified(void) // deprecated and evidently not called.
+{
+ return true;
+}
+
+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++) {
+ phex(row); print(": ");
+ pbin_reverse16(matrix_get_row(row));
+ print("\n");
+ }
+}
+
+uint8_t matrix_key_count(void)
+{
+ uint8_t count = 0;
+ for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
+ count += bitpop16(matrix[i]);
+ }
+ return count;
+}
+
+/* Column pin configuration
+ *
+ * Teensy
+ * col: 0 1 2 3 4 5
+ * pin: F0 F1 F4 F5 F6 F7
+ *
+ * MCP23018
+ * col: 0 1 2 3 4 5
+ * pin: B5 B4 B3 B2 B1 B0
+ */
+static void init_cols(void)
+{
+ // init on mcp23018
+ // not needed, already done as part of init_mcp23018()
+
+ // init on teensy
+ // Input with pull-up(DDR:0, PORT:1)
+ DDRF &= ~(1<<7 | 1<<6 | 1<<5 | 1<<4 | 1<<1 | 1<<0);
+ PORTF |= (1<<7 | 1<<6 | 1<<5 | 1<<4 | 1<<1 | 1<<0);
+}
+
+static matrix_row_t read_cols(uint8_t row)
+{
+ if (row < 7) {
+ if (mcp23018_status) { // if there was an error
+ return 0;
+ } else {
+ uint8_t data = 0;
+ mcp23018_status = i2c_start(I2C_ADDR_WRITE); if (mcp23018_status) goto out;
+ mcp23018_status = i2c_write(GPIOB); if (mcp23018_status) goto out;
+ mcp23018_status = i2c_start(I2C_ADDR_READ); if (mcp23018_status) goto out;
+ data = i2c_readNak();
+ data = ~data;
+ out:
+ i2c_stop();
+ return data;
+ }
+ } else {
+ // read from teensy
+ return
+ (PINF&(1<<0) ? 0 : (1<<0)) |
+ (PINF&(1<<1) ? 0 : (1<<1)) |
+ (PINF&(1<<4) ? 0 : (1<<2)) |
+ (PINF&(1<<5) ? 0 : (1<<3)) |
+ (PINF&(1<<6) ? 0 : (1<<4)) |
+ (PINF&(1<<7) ? 0 : (1<<5)) ;
+ }
+}
+
+/* Row pin configuration
+ *
+ * Teensy
+ * row: 7 8 9 10 11 12 13
+ * pin: B0 B1 B2 B3 D2 D3 C6
+ *
+ * MCP23018
+ * row: 0 1 2 3 4 5 6
+ * pin: A0 A1 A2 A3 A4 A5 A6
+ */
+static void unselect_rows(void)
+{
+ // unselect on mcp23018
+ if (mcp23018_status) { // if there was an error
+ // do nothing
+ } else {
+ // set all rows hi-Z : 1
+ mcp23018_status = i2c_start(I2C_ADDR_WRITE); if (mcp23018_status) goto out;
+ mcp23018_status = i2c_write(GPIOA); if (mcp23018_status) goto out;
+ mcp23018_status = i2c_write( 0xFF
+ & ~(0<<7)
+ ); if (mcp23018_status) goto out;
+ out:
+ i2c_stop();
+ }
+
+ // unselect on teensy
+ // Hi-Z(DDR:0, PORT:0) to unselect
+ DDRB &= ~(1<<0 | 1<<1 | 1<<2 | 1<<3);
+ PORTB &= ~(1<<0 | 1<<1 | 1<<2 | 1<<3);
+ DDRD &= ~(1<<2 | 1<<3);
+ PORTD &= ~(1<<2 | 1<<3);
+ DDRC &= ~(1<<6);
+ PORTC &= ~(1<<6);
+}
+
+static void select_row(uint8_t row)
+{
+ if (row < 7) {
+ // select on mcp23018
+ if (mcp23018_status) { // if there was an error
+ // do nothing
+ } else {
+ // set active row low : 0
+ // set other rows hi-Z : 1
+ mcp23018_status = i2c_start(I2C_ADDR_WRITE); if (mcp23018_status) goto out;
+ mcp23018_status = i2c_write(GPIOA); if (mcp23018_status) goto out;
+ mcp23018_status = i2c_write( 0xFF & ~(1<<row)
+ & ~(0<<7)
+ ); if (mcp23018_status) goto out;
+ out:
+ i2c_stop();
+ }
+ } else {
+ // select on teensy
+ // Output low(DDR:1, PORT:0) to select
+ switch (row) {
+ case 7:
+ DDRB |= (1<<0);
+ PORTB &= ~(1<<0);
+ break;
+ case 8:
+ DDRB |= (1<<1);
+ PORTB &= ~(1<<1);
+ break;
+ case 9:
+ DDRB |= (1<<2);
+ PORTB &= ~(1<<2);
+ break;
+ case 10:
+ DDRB |= (1<<3);
+ PORTB &= ~(1<<3);
+ break;
+ case 11:
+ DDRD |= (1<<2);
+ PORTD &= ~(1<<3);
+ break;
+ case 12:
+ DDRD |= (1<<3);
+ PORTD &= ~(1<<3);
+ break;
+ case 13:
+ DDRC |= (1<<6);
+ PORTC &= ~(1<<6);
+ break;
+ }
+ }
+}
+
diff --git a/keyboards/ergodox_ez/readme.md b/keyboards/ergodox_ez/readme.md
new file mode 100644
index 0000000000..f025c5991d
--- /dev/null
+++ b/keyboards/ergodox_ez/readme.md
@@ -0,0 +1,33 @@
+# ErgoDox EZ
+
+The Ez uses the [Teensy Loader](https://www.pjrc.com/teensy/loader.html).
+
+Linux users need to modify udev rules as described on the [Teensy
+Linux page]. Some distributions provide a binary, maybe called
+`teensy-loader-cli`.
+
+[Teensy Linux page]: https://www.pjrc.com/teensy/loader_linux.html
+
+To flash the firmware:
+
+ - Build the firmware with `make keymapname`, for example `make default`
+ - This will result in a hex file called `ergodox_ez_keymapname.hex`, e.g.
+ `ergodox_ez_default.hex`
+
+ - Start the teensy loader.
+
+ - Load the .hex file into it.
+
+ - Press the Reset button by inserting a paperclip gently into the reset hole
+ in the top right corder.
+
+ - Click the button in the Teensy app to download the firmware.
+
+To flash with ´teensy-loader-cli´:
+
+ - Build the firmware with `make keymapname`, for example `make default`
+
+ - Run ´<path/to/>teensy_loader_cli -mmcu=atmega32u4 -w ergodox_ez_<keymap>.hex´
+
+ - Press the Reset button by inserting a paperclip gently into the reset hole
+ in the top right corder.
diff --git a/keyboards/ergodox_ez/rules.mk b/keyboards/ergodox_ez/rules.mk
new file mode 100644
index 0000000000..e0111272a5
--- /dev/null
+++ b/keyboards/ergodox_ez/rules.mk
@@ -0,0 +1,86 @@
+#----------------------------------------------------------------------------
+# On command line:
+#
+# make = Make software.
+#
+# make clean = Clean out built project files.
+#
+# That's pretty much all you need. To compile, always go make clean,
+# followed by make.
+#
+# For advanced users only:
+# make teensy = Download the hex file to the device, using teensy_loader_cli.
+# (must have teensy_loader_cli installed).
+#
+#----------------------------------------------------------------------------
+
+# # project specific files
+SRC = twimaster.c \
+ matrix.c
+
+# MCU name
+MCU = atmega32u4
+
+# Processor frequency.
+# This will define a symbol, F_CPU, in all source code files equal to the
+# processor frequency in Hz. You can then use this symbol in your source code to
+# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
+# automatically to create a 32-bit value in your source code.
+#
+# This will be an integer division of F_USB below, as it is sourced by
+# F_USB after it has run through any CPU prescalers. Note that this value
+# does not *change* the processor frequency - it should merely be updated to
+# reflect the processor speed set externally so that the code can use accurate
+# software delays.
+F_CPU = 16000000
+
+
+#
+# LUFA specific
+#
+# Target architecture (see library "Board Types" documentation).
+ARCH = AVR8
+
+# Input clock frequency.
+# This will define a symbol, F_USB, in all source code files equal to the
+# input clock frequency (before any prescaling is performed) in Hz. This value may
+# differ from F_CPU if prescaling is used on the latter, and is required as the
+# raw input clock is fed directly to the PLL sections of the AVR for high speed
+# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'
+# at the end, this will be done automatically to create a 32-bit value in your
+# source code.
+#
+# If no clock division is performed on the input clock inside the AVR (via the
+# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
+F_USB = $(F_CPU)
+
+# Interrupt driven control endpoint task(+60)
+OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
+
+
+# Boot Section Size in *bytes*
+# Teensy halfKay 512
+# Teensy++ halfKay 1024
+# Atmel DFU loader 4096
+# LUFA bootloader 4096
+# USBaspLoader 2048
+OPT_DEFS += -DBOOTLOADER_SIZE=512
+
+
+# Build Options
+# comment out to disable the options.
+#
+BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000)
+MOUSEKEY_ENABLE = yes # Mouse keys(+4700)
+EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
+CONSOLE_ENABLE = no # Console for debug(+400)
+COMMAND_ENABLE = yes # Commands for debug and configuration
+CUSTOM_MATRIX = yes # Custom matrix file for the ErgoDox EZ
+NKRO_ENABLE = yes # USB Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
+UNICODE_ENABLE = yes # Unicode
+ONEHAND_ENABLE = yes # Allow swapping hands of keyboard
+SLEEP_LED_ENABLE = no
+API_SYSEX_ENABLE = no
+RGBLIGHT_ENABLE = yes
+
+LAYOUTS = ergodox \ No newline at end of file
diff --git a/keyboards/ergodox_ez/twimaster.c b/keyboards/ergodox_ez/twimaster.c
new file mode 100644
index 0000000000..f91c08e6e4
--- /dev/null
+++ b/keyboards/ergodox_ez/twimaster.c
@@ -0,0 +1,208 @@
+/*************************************************************************
+* Title: I2C master library using hardware TWI interface
+* Author: Peter Fleury <pfleury@gmx.ch> http://jump.to/fleury
+* File: $Id: twimaster.c,v 1.3 2005/07/02 11:14:21 Peter Exp $
+* Software: AVR-GCC 3.4.3 / avr-libc 1.2.3
+* Target: any AVR device with hardware TWI
+* Usage: API compatible with I2C Software Library i2cmaster.h
+**************************************************************************/
+#include <inttypes.h>
+#include <compat/twi.h>
+
+#include <i2cmaster.h>
+
+
+/* define CPU frequency in Mhz here if not defined in Makefile */
+#ifndef F_CPU
+#define F_CPU 16000000UL
+#endif
+
+/* I2C clock in Hz */
+#define SCL_CLOCK 400000L
+
+
+/*************************************************************************
+ Initialization of the I2C bus interface. Need to be called only once
+*************************************************************************/
+void i2c_init(void)
+{
+ /* initialize TWI clock
+ * minimal values in Bit Rate Register (TWBR) and minimal Prescaler
+ * bits in the TWI Status Register should give us maximal possible
+ * I2C bus speed - about 444 kHz
+ *
+ * for more details, see 20.5.2 in ATmega16/32 secification
+ */
+
+ TWSR = 0; /* no prescaler */
+ TWBR = 10; /* must be >= 10 for stable operation */
+
+}/* i2c_init */
+
+
+/*************************************************************************
+ Issues a start condition and sends address and transfer direction.
+ return 0 = device accessible, 1= failed to access device
+*************************************************************************/
+unsigned char i2c_start(unsigned char address)
+{
+ uint8_t twst;
+
+ // send START condition
+ TWCR = (1<<TWINT) | (1<<TWSTA) | (1<<TWEN);
+
+ // wait until transmission completed
+ while(!(TWCR & (1<<TWINT)));
+
+ // check value of TWI Status Register. Mask prescaler bits.
+ twst = TW_STATUS & 0xF8;
+ if ( (twst != TW_START) && (twst != TW_REP_START)) return 1;
+
+ // send device address
+ TWDR = address;
+ TWCR = (1<<TWINT) | (1<<TWEN);
+
+ // wail until transmission completed and ACK/NACK has been received
+ while(!(TWCR & (1<<TWINT)));
+
+ // check value of TWI Status Register. Mask prescaler bits.
+ twst = TW_STATUS & 0xF8;
+ if ( (twst != TW_MT_SLA_ACK) && (twst != TW_MR_SLA_ACK) ) return 1;
+
+ return 0;
+
+}/* i2c_start */
+
+
+/*************************************************************************
+ Issues a start condition and sends address and transfer direction.
+ If device is busy, use ack polling to wait until device is ready
+
+ Input: address and transfer direction of I2C device
+*************************************************************************/
+void i2c_start_wait(unsigned char address)
+{
+ uint8_t twst;
+
+
+ while ( 1 )
+ {
+ // send START condition
+ TWCR = (1<<TWINT) | (1<<TWSTA) | (1<<TWEN);
+
+ // wait until transmission completed
+ while(!(TWCR & (1<<TWINT)));
+
+ // check value of TWI Status Register. Mask prescaler bits.
+ twst = TW_STATUS & 0xF8;
+ if ( (twst != TW_START) && (twst != TW_REP_START)) continue;
+
+ // send device address
+ TWDR = address;
+ TWCR = (1<<TWINT) | (1<<TWEN);
+
+ // wail until transmission completed
+ while(!(TWCR & (1<<TWINT)));
+
+ // check value of TWI Status Register. Mask prescaler bits.
+ twst = TW_STATUS & 0xF8;
+ if ( (twst == TW_MT_SLA_NACK )||(twst ==TW_MR_DATA_NACK) )
+ {
+ /* device busy, send stop condition to terminate write operation */
+ TWCR = (1<<TWINT) | (1<<TWEN) | (1<<TWSTO);
+
+ // wait until stop condition is executed and bus released
+ while(TWCR & (1<<TWSTO));
+
+ continue;
+ }
+ //if( twst != TW_MT_SLA_ACK) return 1;
+ break;
+ }
+
+}/* i2c_start_wait */
+
+
+/*************************************************************************
+ Issues a repeated start condition and sends address and transfer direction
+
+ Input: address and transfer direction of I2C device
+
+ Return: 0 device accessible
+ 1 failed to access device
+*************************************************************************/
+unsigned char i2c_rep_start(unsigned char address)
+{
+ return i2c_start( address );
+
+}/* i2c_rep_start */
+
+
+/*************************************************************************
+ Terminates the data transfer and releases the I2C bus
+*************************************************************************/
+void i2c_stop(void)
+{
+ /* send stop condition */
+ TWCR = (1<<TWINT) | (1<<TWEN) | (1<<TWSTO);
+
+ // wait until stop condition is executed and bus released
+ while(TWCR & (1<<TWSTO));
+
+}/* i2c_stop */
+
+
+/*************************************************************************
+ Send one byte to I2C device
+
+ Input: byte to be transfered
+ Return: 0 write successful
+ 1 write failed
+*************************************************************************/
+unsigned char i2c_write( unsigned char data )
+{
+ uint8_t twst;
+
+ // send data to the previously addressed device
+ TWDR = data;
+ TWCR = (1<<TWINT) | (1<<TWEN);
+
+ // wait until transmission completed
+ while(!(TWCR & (1<<TWINT)));
+
+ // check value of TWI Status Register. Mask prescaler bits
+ twst = TW_STATUS & 0xF8;
+ if( twst != TW_MT_DATA_ACK) return 1;
+ return 0;
+
+}/* i2c_write */
+
+
+/*************************************************************************
+ Read one byte from the I2C device, request more data from device
+
+ Return: byte read from I2C device
+*************************************************************************/
+unsigned char i2c_readAck(void)
+{
+ TWCR = (1<<TWINT) | (1<<TWEN) | (1<<TWEA);
+ while(!(TWCR & (1<<TWINT)));
+
+ return TWDR;
+
+}/* i2c_readAck */
+
+
+/*************************************************************************
+ Read one byte from the I2C device, read is followed by a stop condition
+
+ Return: byte read from I2C device
+*************************************************************************/
+unsigned char i2c_readNak(void)
+{
+ TWCR = (1<<TWINT) | (1<<TWEN);
+ while(!(TWCR & (1<<TWINT)));
+
+ return TWDR;
+
+}/* i2c_readNak */
diff --git a/keyboards/ergodox_ez/util/compile_keymap.py b/keyboards/ergodox_ez/util/compile_keymap.py
new file mode 100644
index 0000000000..7076a6ecb2
--- /dev/null
+++ b/keyboards/ergodox_ez/util/compile_keymap.py
@@ -0,0 +1,710 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+"""Compiler for keymap.c files
+
+This scrip will generate a keymap.c file from a simple
+markdown file with a specific layout.
+
+Usage:
+ python compile_keymap.py INPUT_PATH [OUTPUT_PATH]
+"""
+from __future__ import division
+from __future__ import print_function
+from __future__ import absolute_import
+from __future__ import unicode_literals
+
+import os
+import io
+import re
+import sys
+import json
+import unicodedata
+import collections
+import itertools as it
+
+PY2 = sys.version_info.major == 2
+
+if PY2:
+ chr = unichr
+
+
+KEYBOARD_LAYOUTS = {
+ # These map positions in the parsed layout to
+ # positions in the KEYMAP MATRIX
+ 'ergodox_ez': [
+ [ 0, 1, 2, 3, 4, 5, 6], [38, 39, 40, 41, 42, 43, 44],
+ [ 7, 8, 9, 10, 11, 12, 13], [45, 46, 47, 48, 49, 50, 51],
+ [14, 15, 16, 17, 18, 19 ], [ 52, 53, 54, 55, 56, 57],
+ [20, 21, 22, 23, 24, 25, 26], [58, 59, 60, 61, 62, 63, 64],
+ [27, 28, 29, 30, 31 ], [ 65, 66, 67, 68, 69],
+ [ 32, 33], [70, 71 ],
+ [ 34], [72 ],
+ [ 35, 36, 37], [73, 74, 75 ],
+ ]
+}
+
+ROW_INDENTS = {
+ 'ergodox_ez': [0, 0, 0, 0, 0, 1, 0, 0, 0, 2, 5, 0, 6, 0, 4, 0]
+}
+
+BLANK_LAYOUTS = [
+# Compact Layout
+"""
+.------------------------------------.------------------------------------.
+| | | | | | | | | | | | | | |
+!-----+----+----+----+----+----------!-----+----+----+----+----+----+-----!
+| | | | | | | | | | | | | | |
+!-----+----+----+----x----x----! ! !----x----x----+----+----+-----!
+| | | | | | |-----!-----! | | | | | |
+!-----+----+----+----x----x----! ! !----x----x----+----+----+-----!
+| | | | | | | | | | | | | | |
+'-----+----+----+----+----+----------'----------+----+----+----+----+-----'
+ | | | | | | ! | | | | |
+ '------------------------' '------------------------'
+ .-----------. .-----------.
+ | | | ! | |
+ .-----+-----+-----! !-----+-----+-----.
+ ! ! | | ! | ! !
+ ! ! !-----! !-----! ! !
+ | | | | ! | | |
+ '-----------------' '-----------------'
+""",
+
+# Wide Layout
+"""
+.---------------------------------------------. .---------------------------------------------.
+| | | | | | | | ! | | | | | | |
+!-------+-----+-----+-----+-----+-------------! !-------+-----+-----+-----+-----+-----+-------!
+| | | | | | | | ! | | | | | | |
+!-------+-----+-----+-----x-----x-----! ! ! !-----x-----x-----+-----+-----+-------!
+| | | | | | |-------! !-------! | | | | | |
+!-------+-----+-----+-----x-----x-----! ! ! !-----x-----x-----+-----+-----+-------!
+| | | | | | | | ! | | | | | | |
+'-------+-----+-----+-----+-----+-------------' '-------------+-----+-----+-----+-----+-------'
+ | | | | | | ! | | | | |
+ '------------------------------' '------------------------------'
+ .---------------. .---------------.
+ | | | ! | |
+ .-------+-------+-------! !-------+-------+-------.
+ ! ! | | ! | ! !
+ ! ! !-------! !-------! ! !
+ | | | | ! | | |
+ '-----------------------' '-----------------------'
+""",
+]
+
+
+DEFAULT_CONFIG = {
+ "keymaps_includes": [
+ "keymap_common.h",
+ ],
+ 'filler': "-+.'!:x",
+ 'separator': "|",
+ 'default_key_prefix': ["KC_"],
+}
+
+
+SECTIONS = [
+ 'layout_config',
+ 'layers',
+]
+
+
+# Markdown Parsing
+
+ONELINE_COMMENT_RE = re.compile(r"""
+ ^ # comment must be at the start of the line
+ \s* # arbitrary whitespace
+ // # start of the comment
+ (.*) # the comment
+ $ # until the end of line
+""", re.MULTILINE | re.VERBOSE
+)
+
+INLINE_COMMENT_RE = re.compile(r"""
+ ([\,\"\[\]\{\}\d]) # anythig that might end a expression
+ \s+ # comment must be preceded by whitespace
+ // # start of the comment
+ \s # and succeded by whitespace
+ (?:[^\"\]\}\{\[]*) # the comment (except things which might be json)
+ $ # until the end of line
+""", re.MULTILINE | re.VERBOSE)
+
+TRAILING_COMMA_RE = re.compile(r"""
+ , # the comma
+ (?:\s*) # arbitrary whitespace
+ $ # only works if the trailing comma is followed by newline
+ (\s*) # arbitrary whitespace
+ ([\]\}]) # end of an array or object
+""", re.MULTILINE | re.VERBOSE)
+
+
+def loads(raw_data):
+ if isinstance(raw_data, bytes):
+ raw_data = raw_data.decode('utf-8')
+
+ raw_data = ONELINE_COMMENT_RE.sub(r"", raw_data)
+ raw_data = INLINE_COMMENT_RE.sub(r"\1", raw_data)
+ raw_data = TRAILING_COMMA_RE.sub(r"\1\2", raw_data)
+ return json.loads(raw_data)
+
+
+def parse_config(path):
+ def reset_section():
+ section.update({
+ 'name': section.get('name', ""),
+ 'sub_name': "",
+ 'start_line': -1,
+ 'end_line': -1,
+ 'code_lines': [],
+ })
+
+ def start_section(line_index, line):
+ end_section()
+ if line.startswith("# "):
+ name = line[2:]
+ elif line.startswith("## "):
+ name = line[3:]
+ else:
+ name = ""
+
+ name = name.strip().replace(" ", "_").lower()
+ if name in SECTIONS:
+ section['name'] = name
+ else:
+ section['sub_name'] = name
+ section['start_line'] = line_index
+
+ def end_section():
+ if section['start_line'] >= 0:
+ if section['name'] == 'layout_config':
+ config.update(loads("\n".join(
+ section['code_lines']
+ )))
+ elif section['sub_name'].startswith('layer'):
+ layer_name = section['sub_name']
+ config['layer_lines'][layer_name] = section['code_lines']
+
+ reset_section()
+
+ def amend_section(line_index, line):
+ section['end_line'] = line_index
+ section['code_lines'].append(line)
+
+ config = DEFAULT_CONFIG.copy()
+ config.update({
+ 'layer_lines': collections.OrderedDict(),
+ 'macro_ids': {'UM'},
+ 'unicode_macros': {},
+ })
+
+ section = {}
+ reset_section()
+
+ with io.open(path, encoding="utf-8") as fh:
+ for i, line in enumerate(fh):
+ if line.startswith("#"):
+ start_section(i, line)
+ elif line.startswith(" "):
+ amend_section(i, line[4:])
+ else:
+ # TODO: maybe parse description
+ pass
+
+ end_section()
+ assert 'layout' in config
+ return config
+
+# header file parsing
+
+IF0_RE = re.compile(r"""
+ ^
+ #if 0
+ $.*?
+ #endif
+""", re.MULTILINE | re.DOTALL | re.VERBOSE)
+
+
+COMMENT_RE = re.compile(r"""
+ /\*
+ .*?
+ \*/"
+""", re.MULTILINE | re.DOTALL | re.VERBOSE)
+
+
+def read_header_file(path):
+ with io.open(path, encoding="utf-8") as fh:
+ data = fh.read()
+ data, _ = COMMENT_RE.subn("", data)
+ data, _ = IF0_RE.subn("", data)
+ return data
+
+
+def regex_partial(re_str_fmt, flags):
+ def partial(*args, **kwargs):
+ re_str = re_str_fmt.format(*args, **kwargs)
+ return re.compile(re_str, flags)
+ return partial
+
+
+KEYDEF_REP = regex_partial(r"""
+ #define
+ \s
+ (
+ (?:{}) # the prefixes
+ (?:\w+) # the key name
+ ) # capture group end
+""", re.MULTILINE | re.DOTALL | re.VERBOSE)
+
+
+ENUM_RE = re.compile(r"""
+ (
+ enum
+ \s\w+\s
+ \{
+ .*? # the enum content
+ \}
+ ;
+ ) # capture group end
+""", re.MULTILINE | re.DOTALL | re.VERBOSE)
+
+
+ENUM_KEY_REP = regex_partial(r"""
+ (
+ {} # the prefixes
+ \w+ # the key name
+ ) # capture group end
+""", re.MULTILINE | re.DOTALL | re.VERBOSE)
+
+
+def parse_keydefs(config, data):
+ prefix_options = "|".join(config['key_prefixes'])
+ keydef_re = KEYDEF_REP(prefix_options)
+ enum_key_re = ENUM_KEY_REP(prefix_options)
+ for match in keydef_re.finditer(data):
+ yield match.groups()[0]
+
+ for enum_match in ENUM_RE.finditer(data):
+ enum = enum_match.groups()[0]
+ for key_match in enum_key_re.finditer(enum):
+ yield key_match.groups()[0]
+
+
+def parse_valid_keys(config, out_path):
+ basepath = os.path.abspath(os.path.join(os.path.dirname(out_path)))
+ dirpaths = []
+ subpaths = []
+ while len(subpaths) < 6:
+ path = os.path.join(basepath, *subpaths)
+ dirpaths.append(path)
+ dirpaths.append(os.path.join(path, "tmk_core", "common"))
+ dirpaths.append(os.path.join(path, "quantum"))
+ subpaths.append('..')
+
+ includes = set(config['keymaps_includes'])
+ includes.add("keycode.h")
+
+ valid_keycodes = set()
+ for dirpath, include in it.product(dirpaths, includes):
+ include_path = os.path.join(dirpath, include)
+ if os.path.exists(include_path):
+ header_data = read_header_file(include_path)
+ valid_keycodes.update(
+ parse_keydefs(config, header_data)
+ )
+ return valid_keycodes
+
+
+# Keymap Parsing
+
+def iter_raw_codes(layer_lines, filler, separator):
+ filler_re = re.compile("[" + filler + " ]")
+ for line in layer_lines:
+ line, _ = filler_re.subn("", line.strip())
+ if not line:
+ continue
+ codes = line.split(separator)
+ for code in codes[1:-1]:
+ yield code
+
+
+def iter_indexed_codes(raw_codes, key_indexes):
+ key_rows = {}
+ key_indexes_flat = []
+
+ for row_index, key_indexes in enumerate(key_indexes):
+ for key_index in key_indexes:
+ key_rows[key_index] = row_index
+ key_indexes_flat.extend(key_indexes)
+ assert len(raw_codes) == len(key_indexes_flat)
+ for raw_code, key_index in zip(raw_codes, key_indexes_flat):
+ # we keep track of the row mostly for layout purposes
+ yield raw_code, key_index, key_rows[key_index]
+
+
+LAYER_CHANGE_RE = re.compile(r"""
+ (DF|TG|MO)\(\d+\)
+""", re.VERBOSE)
+
+
+MACRO_RE = re.compile(r"""
+ M\(\w+\)
+""", re.VERBOSE)
+
+
+UNICODE_RE = re.compile(r"""
+ U[0-9A-F]{4}
+""", re.VERBOSE)
+
+
+NON_CODE = re.compile(r"""
+ ^[^A-Z0-9_]$
+""", re.VERBOSE)
+
+
+def parse_uni_code(raw_code):
+ macro_id = "UC_" + (
+ unicodedata.name(raw_code)
+ .replace(" ", "_")
+ .replace("-", "_")
+ )
+ code = "M({})".format(macro_id)
+ uc_hex = "{:04X}".format(ord(raw_code))
+ return code, macro_id, uc_hex
+
+
+def parse_key_code(raw_code, key_prefixes, valid_keycodes):
+ if raw_code in valid_keycodes:
+ return raw_code
+
+ for prefix in key_prefixes:
+ code = prefix + raw_code
+ if code in valid_keycodes:
+ return code
+
+
+def parse_code(raw_code, key_prefixes, valid_keycodes):
+ if not raw_code:
+ return 'KC_TRNS', None, None
+
+ if LAYER_CHANGE_RE.match(raw_code):
+ return raw_code, None, None
+
+ if MACRO_RE.match(raw_code):
+ macro_id = raw_code[2:-1]
+ return raw_code, macro_id, None
+
+ if UNICODE_RE.match(raw_code):
+ hex_code = raw_code[1:]
+ return parse_uni_code(chr(int(hex_code, 16)))
+
+ if NON_CODE.match(raw_code):
+ return parse_uni_code(raw_code)
+
+ code = parse_key_code(raw_code, key_prefixes, valid_keycodes)
+ return code, None, None
+
+
+def parse_keymap(config, key_indexes, layer_lines, valid_keycodes):
+ keymap = {}
+ raw_codes = list(iter_raw_codes(
+ layer_lines, config['filler'], config['separator']
+ ))
+ indexed_codes = iter_indexed_codes(raw_codes, key_indexes)
+ key_prefixes = config['key_prefixes']
+ for raw_code, key_index, row_index in indexed_codes:
+ code, macro_id, uc_hex = parse_code(
+ raw_code, key_prefixes, valid_keycodes
+ )
+ # TODO: line numbers for invalid codes
+ err_msg = "Could not parse key '{}' on row {}".format(
+ raw_code, row_index
+ )
+ assert code is not None, err_msg
+ # print(repr(raw_code), repr(code), macro_id, uc_hex)
+ if macro_id:
+ config['macro_ids'].add(macro_id)
+ if uc_hex:
+ config['unicode_macros'][macro_id] = uc_hex
+ keymap[key_index] = (code, row_index)
+ return keymap
+
+
+def parse_keymaps(config, valid_keycodes):
+ keymaps = collections.OrderedDict()
+ key_indexes = config.get(
+ 'key_indexes', KEYBOARD_LAYOUTS[config['layout']]
+ )
+ # TODO: maybe validate key_indexes
+
+ for layer_name, layer_lines, in config['layer_lines'].items():
+ keymaps[layer_name] = parse_keymap(
+ config, key_indexes, layer_lines, valid_keycodes
+ )
+ return keymaps
+
+# keymap.c output
+
+USERCODE = """
+// Runs just one time when the keyboard initializes.
+void matrix_init_user(void) {
+
+};
+
+// 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) {
+ case L1:
+ ergodox_right_led_1_on();
+ break;
+ case L2:
+ ergodox_right_led_2_on();
+ break;
+ case L3:
+ ergodox_right_led_3_on();
+ break;
+ case L4:
+ ergodox_right_led_1_on();
+ ergodox_right_led_2_on();
+ break;
+ case L5:
+ ergodox_right_led_1_on();
+ ergodox_right_led_3_on();
+ break;
+ // case L6:
+ // ergodox_right_led_2_on();
+ // ergodox_right_led_3_on();
+ // break;
+ // case L7:
+ // ergodox_right_led_1_on();
+ // ergodox_right_led_2_on();
+ // ergodox_right_led_3_on();
+ // break;
+ default:
+ ergodox_board_led_off();
+ break;
+ }
+};
+"""
+
+MACROCODE = """
+#define UC_MODE_WIN 0
+#define UC_MODE_LINUX 1
+#define UC_MODE_OSX 2
+
+// TODO: allow default mode to be configured
+static uint16_t unicode_mode = UC_MODE_WIN;
+
+uint16_t hextokeycode(uint8_t hex) {{
+ if (hex == 0x0) {{
+ return KC_P0;
+ }}
+ if (hex < 0xA) {{
+ return KC_P1 + (hex - 0x1);
+ }}
+ return KC_A + (hex - 0xA);
+}}
+
+void unicode_action_function(uint16_t hi, uint16_t lo) {{
+ switch (unicode_mode) {{
+ case UC_MODE_WIN:
+ register_code(KC_LALT);
+
+ register_code(KC_PPLS);
+ unregister_code(KC_PPLS);
+
+ register_code(hextokeycode((hi & 0xF0) >> 4));
+ unregister_code(hextokeycode((hi & 0xF0) >> 4));
+ register_code(hextokeycode((hi & 0x0F)));
+ unregister_code(hextokeycode((hi & 0x0F)));
+ register_code(hextokeycode((lo & 0xF0) >> 4));
+ unregister_code(hextokeycode((lo & 0xF0) >> 4));
+ register_code(hextokeycode((lo & 0x0F)));
+ unregister_code(hextokeycode((lo & 0x0F)));
+
+ unregister_code(KC_LALT);
+ break;
+ case UC_MODE_LINUX:
+ register_code(KC_LCTL);
+ register_code(KC_LSFT);
+
+ register_code(KC_U);
+ unregister_code(KC_U);
+
+ register_code(hextokeycode((hi & 0xF0) >> 4));
+ unregister_code(hextokeycode((hi & 0xF0) >> 4));
+ register_code(hextokeycode((hi & 0x0F)));
+ unregister_code(hextokeycode((hi & 0x0F)));
+ register_code(hextokeycode((lo & 0xF0) >> 4));
+ unregister_code(hextokeycode((lo & 0xF0) >> 4));
+ register_code(hextokeycode((lo & 0x0F)));
+ unregister_code(hextokeycode((lo & 0x0F)));
+
+ unregister_code(KC_LCTL);
+ unregister_code(KC_LSFT);
+ break;
+ case UC_MODE_OSX:
+ break;
+ }}
+}}
+
+const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) {{
+ if (!record->event.pressed) {{
+ return MACRO_NONE;
+ }}
+ // MACRODOWN only works in this function
+ switch(id) {{
+ case UM:
+ unicode_mode = (unicode_mode + 1) % 2;
+ break;
+{macro_cases}
+{unicode_macro_cases}
+ default:
+ break;
+ }}
+ return MACRO_NONE;
+}};
+"""
+
+
+UNICODE_MACRO_TEMPLATE = """
+case {macro_id}:
+ unicode_action_function(0x{hi:02x}, 0x{lo:02x});
+ break;
+""".strip()
+
+
+def unicode_macro_cases(config):
+ for macro_id, uc_hex in config['unicode_macros'].items():
+ hi = int(uc_hex, 16) >> 8
+ lo = int(uc_hex, 16) & 0xFF
+ unimacro_keys = ", ".join(
+ "T({})".format(
+ "KP_" + digit if digit.isdigit() else digit
+ ) for digit in uc_hex
+ )
+ yield UNICODE_MACRO_TEMPLATE.format(
+ macro_id=macro_id, hi=hi, lo=lo
+ )
+
+
+def iter_keymap_lines(keymap, row_indents=None):
+ col_widths = {}
+ col = 0
+ # first pass, figure out the column widths
+ prev_row_index = None
+ for code, row_index in keymap.values():
+ if row_index != prev_row_index:
+ col = 0
+ if row_indents:
+ col = row_indents[row_index]
+ col_widths[col] = max(len(code), col_widths.get(col, 0))
+ prev_row_index = row_index
+ col += 1
+
+ # second pass, yield the cell values
+ col = 0
+ prev_row_index = None
+ for key_index in sorted(keymap):
+ code, row_index = keymap[key_index]
+ if row_index != prev_row_index:
+ col = 0
+ yield "\n"
+ if row_indents:
+ for indent_col in range(row_indents[row_index]):
+ pad = " " * (col_widths[indent_col] - 4)
+ yield (" /*-*/" + pad)
+ col = row_indents[row_index]
+ else:
+ yield pad
+ yield " {}".format(code)
+ if key_index < len(keymap) - 1:
+ yield ","
+ # This will be yielded on the next iteration when
+ # we know that we're not at the end of a line.
+ pad = " " * (col_widths[col] - len(code))
+ prev_row_index = row_index
+ col += 1
+
+
+def iter_keymap_parts(config, keymaps):
+ # includes
+ for include_path in config['keymaps_includes']:
+ yield '#include "{}"\n'.format(include_path)
+
+ yield "\n"
+
+ # definitions
+ for i, macro_id in enumerate(sorted(config['macro_ids'])):
+ yield "#define {} {}\n".format(macro_id, i)
+
+ yield "\n"
+
+ for i, layer_name in enumerate(config['layer_lines']):
+ yield '#define L{0:<3} {0:<5} // {1}\n'.format(i, layer_name)
+
+ yield "\n"
+
+ # keymaps
+ yield "const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {\n"
+
+ for i, layer_name in enumerate(config['layer_lines']):
+ # comment
+ layer_lines = config['layer_lines'][layer_name]
+ prefixed_lines = " * " + " * ".join(layer_lines)
+ yield "/*\n{} */\n".format(prefixed_lines)
+
+ # keymap codes
+ keymap = keymaps[layer_name]
+ row_indents = ROW_INDENTS.get(config['layout'])
+ keymap_lines = "".join(iter_keymap_lines(keymap, row_indents))
+ yield "[L{0}] = KEYMAP({1}\n),\n".format(i, keymap_lines)
+
+ yield "};\n\n"
+
+ # no idea what this is for
+ yield "const uint16_t PROGMEM fn_actions[] = {};\n"
+
+ # macros
+ yield MACROCODE.format(
+ macro_cases="",
+ unicode_macro_cases="\n".join(unicode_macro_cases(config)),
+ )
+
+ # TODO: dynamically create blinking lights
+ yield USERCODE
+
+
+def main(argv=sys.argv[1:]):
+ if not argv or '-h' in argv or '--help' in argv:
+ print(__doc__)
+ return 0
+
+ in_path = os.path.abspath(argv[0])
+ if not os.path.exists(in_path):
+ print("No such file '{}'".format(in_path))
+ return 1
+
+ if len(argv) > 1:
+ out_path = os.path.abspath(argv[1])
+ else:
+ dirname = os.path.dirname(in_path)
+ out_path = os.path.join(dirname, "keymap.c")
+
+ config = parse_config(in_path)
+ valid_keys = parse_valid_keys(config, out_path)
+ keymaps = parse_keymaps(config, valid_keys)
+
+ with io.open(out_path, mode="w", encoding="utf-8") as fh:
+ for part in iter_keymap_parts(config, keymaps):
+ fh.write(part)
+
+
+if __name__ == '__main__':
+ sys.exit(main())
diff --git a/keyboards/ergodox_ez/util/readme.md b/keyboards/ergodox_ez/util/readme.md
new file mode 100644
index 0000000000..26c5e5d99c
--- /dev/null
+++ b/keyboards/ergodox_ez/util/readme.md
@@ -0,0 +1,3 @@
+# ErgoDox EZ Utilities
+
+The Python script in this directory, by [mbarkhau](https://github.com/mbarkhau) allows you to write out a basic ErgoDox EZ keymap using Markdown notation, and then transpile it to C, which you can then compile. It's experimental, but if you're not comfortable using C, it's a nice option.