2016-03-07 05:12:29 +00:00
|
|
|
#include "ergodox_ez.h"
|
2016-04-12 03:51:12 +00:00
|
|
|
#include "led.h"
|
2016-03-07 05:12:29 +00:00
|
|
|
#include "debug.h"
|
|
|
|
#include "action_layer.h"
|
2016-04-15 02:49:32 +00:00
|
|
|
#include "action_util.h"
|
|
|
|
|
2016-05-05 03:17:47 +00:00
|
|
|
#define BASE 0 // default layer
|
|
|
|
#define SYMB 1 // symbols layer
|
|
|
|
#define MDIA 2 // media layer
|
2016-05-06 03:55:55 +00:00
|
|
|
#define SPEC 3 // special layer
|
2016-04-23 03:33:13 +00:00
|
|
|
|
2016-05-05 03:17:47 +00:00
|
|
|
#define LCaps 10 // left caps-shift key
|
|
|
|
#define LSymb 11 // left symbol-shift key
|
|
|
|
#define LMdia 12 // left media-shift key
|
2016-05-06 03:55:55 +00:00
|
|
|
#define LSpec 13 // left special-shift key
|
|
|
|
#define RCaps 14 // right caps-shift key
|
|
|
|
#define RSymb 15 // right symbol-shift key
|
|
|
|
#define RMdia 16 // right media-shift key
|
|
|
|
#define RSpec 17 // right special-shift key
|
2016-04-23 03:33:13 +00:00
|
|
|
|
2016-05-06 03:55:55 +00:00
|
|
|
#define MUL 20 // mouse up left
|
|
|
|
#define MUR 21 // mouse up right
|
|
|
|
#define MDL 22 // mouse down left
|
|
|
|
#define MDR 23 // mouse down right
|
2016-03-07 05:12:29 +00:00
|
|
|
|
|
|
|
/*
|
2016-05-06 03:55:55 +00:00
|
|
|
* The Ordinary Layout for the Ergodox EZ keyboard, v4
|
2016-04-23 03:33:13 +00:00
|
|
|
*
|
|
|
|
* Modifications from default by Nicholas Keene ergodoxez@nicholaskeene.com
|
2016-05-06 03:55:55 +00:00
|
|
|
*
|
|
|
|
* No rights reserved. This software is in the public domain.
|
|
|
|
* Credit me if you are friendly but if you're a jerk don't bother.
|
2016-04-23 03:33:13 +00:00
|
|
|
*
|
2016-04-15 02:49:32 +00:00
|
|
|
* Details: readme.md
|
|
|
|
* https://github.com/nrrkeene/qmk_firmware/tree/master/keyboard/ergodox_ez/keymaps/ordinary
|
2016-03-07 05:12:29 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
2016-04-12 03:51:12 +00:00
|
|
|
|
2016-04-23 03:33:13 +00:00
|
|
|
/******* Base Layer ********************************************************************************************************
|
2016-03-07 05:12:29 +00:00
|
|
|
*
|
2016-05-06 03:55:55 +00:00
|
|
|
* ,------------------------------------------------------. ,------------------------------------------------------.
|
|
|
|
* | Special `~ | 1 | 2 | 3 | 4 | 5 | ESC | | - | 6 | 7 | 8 | 9 | 0 | =+ Special |
|
|
|
|
* |------------+------+------+------+------+-------------| |------+------+------+------+------+------+------------|
|
|
|
|
* | Media Tab | Q | W | E | R | T | [ | | ] | Y | U | I | O | P | \| Media |
|
|
|
|
* |------------+------+------+------+------+------| | | |------+------+------+------+------+------------|
|
|
|
|
* | Symbol | A | S | D | F | G |------| |------| H | J | K | L | ; | '" Symbol |
|
|
|
|
* |------------+------+------+------+------+------|Shift | | Tab |------+------+------+------+------+------------|
|
|
|
|
* | Capitals | Z | X | C | V | B | -Tab | | | N | M | , | . | / | Capitals |
|
|
|
|
* `------------+------+------+------+------+-------------' `-------------+------+------+------+------+------------'
|
|
|
|
* | LCtrl | Meh |Hyper | LAlt | LGui | | RGui | RAlt | Hyper| Meh | RCtrl |
|
|
|
|
* `-----------------------------------' `-----------------------------------'
|
|
|
|
* ,-------------. ,-------------.
|
|
|
|
* | Home | End | | Left | Right|
|
|
|
|
* ,------|------|------| |------+------+------.
|
|
|
|
* | | | PgUp | | Up | | |
|
|
|
|
* |Backsp| Del |------| |------| Enter| Space|
|
|
|
|
* | | | PgDn | | Down | | |
|
|
|
|
* `--------------------' `--------------------'
|
2016-03-07 05:12:29 +00:00
|
|
|
*/
|
2016-04-12 03:51:12 +00:00
|
|
|
[BASE] = KEYMAP(
|
|
|
|
// left hand
|
2016-05-06 03:55:55 +00:00
|
|
|
F(LSpec),KC_1,KC_2,KC_3 ,KC_4 ,KC_5 ,KC_ESC
|
2016-04-23 03:33:13 +00:00
|
|
|
,F(LMdia) ,KC_Q ,KC_W ,KC_E ,KC_R ,KC_T ,KC_LBRC
|
|
|
|
,M(LSymb) ,KC_A ,KC_S ,KC_D ,KC_F ,KC_G
|
2016-05-06 03:55:55 +00:00
|
|
|
,M(LCaps) ,KC_Z ,KC_X ,KC_C ,KC_V ,KC_B ,LSFT(KC_TAB)
|
2016-04-23 03:33:13 +00:00
|
|
|
,KC_LCTL ,KC_MEH ,KC_HYPR,KC_LALT,KC_LGUI
|
|
|
|
,KC_HOME,KC_END
|
|
|
|
,KC_PGUP
|
|
|
|
,KC_BSPC,KC_DEL ,KC_PGDN
|
|
|
|
// right hand
|
2016-05-06 03:55:55 +00:00
|
|
|
,KC_MINS ,KC_6 ,KC_7 ,KC_8 ,KC_9 ,KC_0 ,F(RSpec)
|
2016-04-23 03:33:13 +00:00
|
|
|
,KC_RBRC ,KC_Y ,KC_U ,KC_I ,KC_O ,KC_P ,F(RMdia)
|
|
|
|
,KC_H ,KC_J ,KC_K ,KC_L ,KC_SCLN ,F(RSymb)
|
2016-05-05 03:17:47 +00:00
|
|
|
,KC_TAB ,KC_N ,KC_M ,KC_COMM,KC_DOT ,KC_SLSH ,M(RCaps)
|
2016-04-23 03:33:13 +00:00
|
|
|
,KC_RGUI,KC_RALT,KC_HYPR ,KC_MEH ,KC_RCTL
|
|
|
|
,KC_LEFT ,KC_RGHT
|
|
|
|
,KC_UP
|
|
|
|
,KC_DOWN ,KC_ENT ,KC_SPC
|
2016-03-07 05:12:29 +00:00
|
|
|
),
|
2016-04-12 03:51:12 +00:00
|
|
|
|
2016-04-23 03:33:13 +00:00
|
|
|
/******* Symbols Layer *****************************************************************************************************
|
2016-04-12 03:51:12 +00:00
|
|
|
*
|
|
|
|
* ,-----------------------------------------------------. ,-----------------------------------------------------.
|
2016-04-23 03:33:13 +00:00
|
|
|
* | | F1 | F2 | F3 | F4 | F5 | Esc | | - | F6 | F7 | F8 | F9 | F10 | |
|
2016-04-12 03:51:12 +00:00
|
|
|
* |-----------+------+------+------+------+-------------| |------+------+------+------+------+------+-----------|
|
2016-04-23 03:33:13 +00:00
|
|
|
* | | ! | @ | { | } | & | < | | > | | | 7 | 8 | 9 | / | |
|
2016-04-12 03:51:12 +00:00
|
|
|
* |-----------+------+------+------+------+------| | | |------+------+------+------+------+-----------|
|
2016-04-23 03:33:13 +00:00
|
|
|
* | | # | $ | ( | ) | ` |------| |------| / | 4 | 5 | 6 | * | |
|
2016-04-12 03:51:12 +00:00
|
|
|
* |-----------+------+------+------+------+------| Tab | | Shift|------+------+------+------+------+-----------|
|
2016-04-23 03:33:13 +00:00
|
|
|
* | | % | ^ | [ | ] | ~ | | | -Tab| \ | 1 | 2 | 3 | - | |
|
|
|
|
* `-----------+------+------+------+------+-------------' `-------------+------+------+------+------+-----------'
|
|
|
|
* | LCtrl | Meh |Hyper | LAlt | LGui | |RGui/0|RAlt/.|Hypr/=|Meh/+ |RCtrl/Ent|
|
|
|
|
* `-----------------------------------' `-------------------------------------'
|
2016-04-12 03:51:12 +00:00
|
|
|
* ,-------------. ,-------------.
|
|
|
|
* | Left | Right| | Home | End |
|
|
|
|
* ,------|------|------| |------+------+------.
|
|
|
|
* | | | Up | | PgUp | | |
|
|
|
|
* |Space |Enter |------| |------|BackSp| Del |
|
|
|
|
* | | | Down | | PgDn | | |
|
|
|
|
* `--------------------' `--------------------'
|
|
|
|
*/
|
2016-04-23 03:33:13 +00:00
|
|
|
[SYMB] = KEYMAP(
|
2016-04-12 03:51:12 +00:00
|
|
|
// left hand
|
2016-04-23 03:33:13 +00:00
|
|
|
KC_TRNS ,KC_F1 ,KC_F2 ,KC_F3 ,KC_F4 ,KC_F5 ,KC_ESC
|
|
|
|
,KC_TRNS ,KC_EXLM ,KC_AT ,KC_LCBR ,KC_RCBR ,KC_AMPR ,LSFT(KC_COMM)
|
|
|
|
,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_TAB
|
|
|
|
,KC_LCTL ,KC_MEH ,KC_HYPR,KC_LALT ,KC_LGUI
|
|
|
|
,KC_LEFT ,KC_RGHT
|
|
|
|
,KC_UP
|
|
|
|
,KC_SPC ,KC_ENT ,KC_DOWN
|
2016-04-15 02:49:32 +00:00
|
|
|
// right hand
|
2016-04-23 03:33:13 +00:00
|
|
|
,KC_MINS ,KC_F6 ,KC_F7 ,KC_F8 ,KC_F9 ,KC_F10 ,KC_TRNS
|
|
|
|
,LSFT(KC_DOT),KC_PIPE ,KC_7 ,KC_8 ,KC_9 ,KC_SLSH ,KC_TRNS
|
|
|
|
,KC_SLSH ,KC_4 ,KC_5 ,KC_6 ,KC_ASTR ,KC_TRNS
|
|
|
|
,LSFT(KC_TAB),KC_BSLS ,KC_1 ,KC_2 ,KC_3 ,KC_MINS ,KC_TRNS
|
|
|
|
,GUI_T(KC_0),ALT_T(KC_DOT),ALL_T(KC_EQL),MEH_T(KC_PLUS),CTL_T(KC_ENT)
|
|
|
|
,KC_HOME ,KC_END
|
|
|
|
,KC_PGUP
|
|
|
|
,KC_PGDN ,KC_BSPC ,KC_DEL
|
2016-04-15 02:49:32 +00:00
|
|
|
),
|
|
|
|
|
2016-04-23 03:33:13 +00:00
|
|
|
/******* Media Layer *******************************************************************************************************
|
2016-03-07 05:12:29 +00:00
|
|
|
*
|
2016-04-23 03:33:13 +00:00
|
|
|
* ,---------------------------------------------------------------. ,---------------------------------------------------------------.
|
|
|
|
* | | F11 | F12 | F13 | F14 | F15 | Esc | | | F16 | F17 | F18 | F19 | F20 | |
|
|
|
|
* |------+---------+---------+---------+---------+----------------| |------+---------+---------+---------+---------+---------+------|
|
|
|
|
* | |Shut Down|MouseUpLf|Mouse Up |MouseUpRg|Volume Up|Scroll| |Scroll|PrintScrn| Home | Up | PgUp | Mail | |
|
|
|
|
* |------+---------+---------+---------+---------+---------| Up | | Up |---------+---------+---------+---------+---------+------|
|
|
|
|
* | | Sleep |MouseLeft|MouseDown|MouseRght|Volume Dn|------| |------| Num Lock| Left | Down | Right | MyComp | |
|
|
|
|
* |------+---------+---------+---------+---------+---------|Scroll| |Scroll|---------+---------+---------+---------+---------+------|
|
2016-05-06 03:55:55 +00:00
|
|
|
* | | |MouseDnLf|MouseDown|MouseDnRg| Mute | Down | | Down | | End | Down | PgDn | | |
|
2016-04-23 03:33:13 +00:00
|
|
|
* `------+---------+---------+---------+---------+----------------' `----------------+---------+---------+---------+---------+------'
|
|
|
|
* |LCtrl| Meh | MClick | LClick | R Click| |Cmd/Insrt|Optn/Del | Hyper | Meh |RCtrl|
|
|
|
|
* `---------------------------------------------' `---------------------------------------------'
|
|
|
|
* ,-------------. ,-------------.
|
|
|
|
* | Stop |Refrsh| | Prev | Next |
|
|
|
|
* ,------|------|------| |------+------+------.
|
|
|
|
* |Brwser|Brwser|Search| |VolUp | | |
|
|
|
|
* |Back | Fwd |------| |------| Stop | Play-|
|
|
|
|
* | | | Home | |VolDn | | Pause|
|
|
|
|
* `--------------------' `--------------------'
|
2016-03-07 05:12:29 +00:00
|
|
|
*/
|
2016-04-23 03:33:13 +00:00
|
|
|
[MDIA] = KEYMAP(
|
2016-04-12 03:51:12 +00:00
|
|
|
// left hand
|
2016-04-23 03:33:13 +00:00
|
|
|
KC_TRNS ,KC_F11 ,KC_F12 ,KC_F13 ,KC_F14 ,KC_F15 ,KC_ESC
|
|
|
|
,KC_TRNS ,KC_POWER ,M(MUL) ,KC_MS_U ,M(MUR) ,KC_VOLU ,KC_WH_U
|
|
|
|
,KC_TRNS ,KC_SLEP ,KC_MS_L ,KC_MS_D ,KC_MS_R ,KC_VOLD
|
|
|
|
,KC_TRNS ,KC_NO ,M(MDL) ,KC_MS_D ,M(MDR) ,KC_MUTE ,KC_WH_D
|
|
|
|
,KC_LCTL ,KC_MEH ,KC_BTN3 ,KC_BTN1 ,KC_BTN2
|
|
|
|
,KC_WSTP ,KC_WREF
|
|
|
|
,KC_WSCH
|
|
|
|
,KC_WBAK ,KC_NO ,KC_WHOM
|
2016-03-07 05:12:29 +00:00
|
|
|
// right hand
|
2016-04-23 03:33:13 +00:00
|
|
|
,KC_NO ,KC_F16 ,KC_F17 ,KC_F18 ,KC_F19 ,KC_F20 ,KC_TRNS
|
|
|
|
,KC_WH_U ,KC_PSCR ,KC_HOME ,KC_UP ,KC_PGUP ,KC_MAIL ,KC_TRNS
|
|
|
|
,KC_NLCK ,KC_LEFT ,KC_DOWN ,KC_RIGHT,KC_MYCM ,KC_TRNS
|
2016-05-06 03:55:55 +00:00
|
|
|
,KC_WH_D ,KC_NO ,KC_END ,KC_DOWN ,KC_PGDN ,KC_NO ,KC_TRNS
|
2016-04-23 03:33:13 +00:00
|
|
|
,GUI_T(KC_INS),ALT_T(KC_DEL),KC_HYPR ,KC_MEH ,KC_RCTL
|
2016-04-12 03:51:12 +00:00
|
|
|
,KC_MPRV ,KC_MNXT
|
|
|
|
,KC_VOLU
|
|
|
|
,KC_VOLD ,KC_MSTP ,KC_MPLY
|
2016-03-07 05:12:29 +00:00
|
|
|
),
|
2016-04-12 03:51:12 +00:00
|
|
|
|
2016-05-06 03:55:55 +00:00
|
|
|
/******* Special Layer *****************************************************************************************************
|
2016-04-12 03:51:12 +00:00
|
|
|
*
|
|
|
|
* ,-----------------------------------------------------. ,-----------------------------------------------------.
|
2016-04-23 03:33:13 +00:00
|
|
|
* | | Esc | | | | | | | | | | | | Bspc | |
|
2016-04-12 03:51:12 +00:00
|
|
|
* |-----------+------+------+------+------+-------------| |------+------+------+------+------+------+-----------|
|
2016-04-23 03:33:13 +00:00
|
|
|
* | | | | | | | | | | | | | | | |
|
2016-04-12 03:51:12 +00:00
|
|
|
* |-----------+------+------+------+------+------| | | |------+------+------+------+------+-----------|
|
|
|
|
* | | | | | | |------| |------| | | | | | |
|
|
|
|
* |-----------+------+------+------+------+------| | | |------+------+------+------+------+-----------|
|
2016-05-06 03:55:55 +00:00
|
|
|
* | | | | | | | | | | | | | | | RShift |
|
2016-04-12 03:51:12 +00:00
|
|
|
* `-----------+------+------+------+------+-------------' `-------------+------+------+------+------+-----------'
|
|
|
|
* | | | | | | | | | | | |
|
|
|
|
* `----------------------------------' `----------------------------------'
|
|
|
|
* ,-------------. ,-------------.
|
|
|
|
* | | | | | |
|
|
|
|
* ,------|------|------| |------+------+------.
|
|
|
|
* | | | | | | | |
|
|
|
|
* | | |------| |------| | |
|
|
|
|
* | | | | | | | |
|
|
|
|
* `--------------------' `--------------------'
|
|
|
|
*/
|
2016-05-06 03:55:55 +00:00
|
|
|
[SPEC] = KEYMAP(
|
2016-04-12 03:51:12 +00:00
|
|
|
// left hand
|
2016-04-15 02:49:32 +00:00
|
|
|
KC_TRNS ,KC_ESC ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
|
2016-04-23 03:33:13 +00:00
|
|
|
,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
|
2016-04-15 02:49:32 +00:00
|
|
|
,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
|
2016-05-06 03:55:55 +00:00
|
|
|
,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
|
2016-04-15 02:49:32 +00:00
|
|
|
,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
|
2016-04-12 03:51:12 +00:00
|
|
|
|
2016-04-15 02:49:32 +00:00
|
|
|
,KC_TRNS ,KC_TRNS
|
|
|
|
,KC_TRNS
|
2016-04-23 03:33:13 +00:00
|
|
|
,KC_TRNS,KC_TRNS ,KC_TRNS
|
|
|
|
// right hand
|
|
|
|
,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_BSPC ,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
|
2016-05-06 03:55:55 +00:00
|
|
|
,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_RSFT
|
2016-04-23 03:33:13 +00:00
|
|
|
,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
|
2016-04-12 04:28:16 +00:00
|
|
|
|
2016-04-23 03:33:13 +00:00
|
|
|
,KC_TRNS ,KC_TRNS
|
|
|
|
,KC_TRNS
|
|
|
|
,KC_TRNS ,KC_TRNS ,KC_TRNS
|
2016-04-12 03:51:12 +00:00
|
|
|
)
|
2016-03-07 05:12:29 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
const uint16_t PROGMEM fn_actions[] = {
|
2016-05-06 03:55:55 +00:00
|
|
|
// the faux shift keys are implemented as macro taps
|
|
|
|
[LCaps] = ACTION_MACRO_TAP(LCaps)
|
|
|
|
,[LSymb] = ACTION_MACRO_TAP(LSymb)
|
2016-04-23 03:33:13 +00:00
|
|
|
,[LMdia] = ACTION_MACRO_TAP(LMdia)
|
2016-05-06 03:55:55 +00:00
|
|
|
,[LSpec] = ACTION_MACRO_TAP(LSpec)
|
|
|
|
,[RCaps] = ACTION_MACRO_TAP(RCaps)
|
2016-04-23 03:33:13 +00:00
|
|
|
,[RSymb] = ACTION_MACRO_TAP(RSymb)
|
|
|
|
,[RMdia] = ACTION_MACRO_TAP(RMdia)
|
2016-05-06 03:55:55 +00:00
|
|
|
,[RSpec] = ACTION_MACRO_TAP(RSpec)
|
2016-03-07 05:12:29 +00:00
|
|
|
};
|
|
|
|
|
2016-05-05 03:17:47 +00:00
|
|
|
uint16_t caps_shift = 0;
|
2016-05-06 03:55:55 +00:00
|
|
|
uint16_t symb_shift = 0;
|
|
|
|
uint16_t mdia_shift = 0;
|
2016-04-23 03:33:13 +00:00
|
|
|
|
2016-05-06 03:55:55 +00:00
|
|
|
bool symb_lock = false;
|
|
|
|
bool mdia_lock = false;
|
2016-04-23 03:33:13 +00:00
|
|
|
|
2016-03-07 05:12:29 +00:00
|
|
|
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
|
|
|
|
{
|
2016-04-23 03:33:13 +00:00
|
|
|
switch(id) {
|
2016-05-06 03:55:55 +00:00
|
|
|
// There are two shift keys for each layer so we increment a layer_shift var when one
|
|
|
|
// is pressed and decrement when one is released. If both are pressed at the same time
|
|
|
|
// then the layer is locked (or unlocked). The shift counts are bound between 0 and 2
|
|
|
|
// only because sometimes rapid pressing led to irregular events; this way the states
|
|
|
|
// are self healing during use.
|
2016-05-05 03:17:47 +00:00
|
|
|
|
|
|
|
case LCaps: // both caps-shift keys trigger Left Shift
|
|
|
|
case RCaps: // so they don't interfere with the magic combo
|
|
|
|
if (record->event.pressed && !record->tap.count) {
|
|
|
|
if(++caps_shift > 2) caps_shift = 2;
|
2016-05-06 03:55:55 +00:00
|
|
|
if(caps_shift == 2) {
|
2016-05-05 03:17:47 +00:00
|
|
|
register_code(KC_CAPS);
|
|
|
|
unregister_code(KC_CAPS);
|
2016-05-06 03:55:55 +00:00
|
|
|
} else if(caps_shift == 1) {
|
|
|
|
register_code(KC_LSFT);
|
2016-05-05 03:17:47 +00:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if(--caps_shift < 0) caps_shift = 0;
|
2016-05-06 03:55:55 +00:00
|
|
|
if(caps_shift == 0) unregister_code(KC_LSFT);
|
2016-05-05 03:17:47 +00:00
|
|
|
}
|
|
|
|
break;
|
2016-04-23 03:33:13 +00:00
|
|
|
|
|
|
|
case LSymb:
|
|
|
|
if (record->event.pressed) {
|
2016-05-05 03:17:47 +00:00
|
|
|
if(++symb_shift > 2) symb_shift = 2;
|
2016-05-06 03:55:55 +00:00
|
|
|
if(symb_shift == 2) {
|
|
|
|
symb_lock = !symb_lock;
|
|
|
|
} else if(symb_shift == 1) {
|
|
|
|
layer_on(SYMB);
|
|
|
|
}
|
2016-04-23 03:33:13 +00:00
|
|
|
} else {
|
2016-05-05 03:17:47 +00:00
|
|
|
if(--symb_shift < 0) symb_shift = 0;
|
2016-05-06 03:55:55 +00:00
|
|
|
if((symb_shift == 0) && (!symb_lock)) layer_off(SYMB);
|
2016-04-23 03:33:13 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case LMdia:
|
2016-03-07 05:12:29 +00:00
|
|
|
if (record->event.pressed) {
|
2016-05-06 03:55:55 +00:00
|
|
|
if (record->tap.count && (!mdia_shift) && (!mdia_lock)) {
|
2016-04-23 03:33:13 +00:00
|
|
|
register_code(KC_TAB);
|
|
|
|
} else {
|
2016-05-05 03:17:47 +00:00
|
|
|
if(++mdia_shift > 2) mdia_shift = 2;
|
2016-05-06 03:55:55 +00:00
|
|
|
if(mdia_shift == 2) {
|
|
|
|
mdia_lock = !mdia_lock;
|
|
|
|
} else if(mdia_shift == 1) {
|
|
|
|
layer_on(MDIA);
|
|
|
|
}
|
2016-04-23 03:33:13 +00:00
|
|
|
}
|
2016-03-07 05:12:29 +00:00
|
|
|
} else {
|
2016-05-06 03:55:55 +00:00
|
|
|
if(record->tap.count && (!mdia_shift) && (!mdia_lock)) {
|
2016-04-23 03:33:13 +00:00
|
|
|
unregister_code(KC_TAB);
|
|
|
|
} else {
|
2016-05-05 03:17:47 +00:00
|
|
|
if(--mdia_shift < 0) mdia_shift = 0;
|
2016-04-23 03:33:13 +00:00
|
|
|
if((!mdia_shift) && (!mdia_lock)) layer_off(MDIA);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2016-05-06 03:55:55 +00:00
|
|
|
case LSpec:
|
2016-04-23 03:33:13 +00:00
|
|
|
if (record->event.pressed) {
|
2016-05-06 03:55:55 +00:00
|
|
|
if (record->tap.count && !record->tap.interrupted) {
|
2016-04-23 03:33:13 +00:00
|
|
|
register_code(KC_GRV);
|
2016-05-06 03:55:55 +00:00
|
|
|
} else {
|
|
|
|
layer_on(SPEC);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if(record->tap.count && !record->tap.interrupted) {
|
2016-04-23 03:33:13 +00:00
|
|
|
unregister_code(KC_GRV);
|
2016-05-06 03:55:55 +00:00
|
|
|
} else {
|
|
|
|
layer_off(SPEC);
|
2016-04-23 03:33:13 +00:00
|
|
|
}
|
2016-03-07 05:12:29 +00:00
|
|
|
}
|
|
|
|
break;
|
2016-04-23 03:33:13 +00:00
|
|
|
|
|
|
|
case RSymb:
|
|
|
|
if (record->event.pressed) {
|
2016-05-06 03:55:55 +00:00
|
|
|
if (record->tap.count && (!symb_shift) && (!symb_lock)) {
|
2016-04-23 03:33:13 +00:00
|
|
|
register_code(KC_QUOT);
|
|
|
|
} else {
|
2016-05-05 03:17:47 +00:00
|
|
|
if(++symb_shift > 2) symb_shift = 2;
|
2016-05-06 03:55:55 +00:00
|
|
|
if(symb_shift == 2) {
|
|
|
|
symb_lock = !symb_lock;
|
|
|
|
} else if(symb_shift == 1) {
|
|
|
|
layer_on(SYMB);
|
|
|
|
}
|
2016-04-23 03:33:13 +00:00
|
|
|
}
|
|
|
|
} else {
|
2016-05-06 03:55:55 +00:00
|
|
|
if(record->tap.count && symb_shift == 0) {
|
2016-04-23 03:33:13 +00:00
|
|
|
unregister_code(KC_QUOT);
|
|
|
|
} else {
|
2016-05-05 03:17:47 +00:00
|
|
|
if(--symb_shift < 0) symb_shift = 0;
|
2016-04-23 03:33:13 +00:00
|
|
|
if((!symb_shift) && (!symb_lock)) layer_off(SYMB);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case RMdia:
|
|
|
|
if (record->event.pressed) {
|
2016-05-06 03:55:55 +00:00
|
|
|
if (record->tap.count && (!mdia_shift) && (!mdia_lock)) {
|
2016-04-23 03:33:13 +00:00
|
|
|
register_code(KC_BSLS);
|
|
|
|
} else {
|
2016-05-05 03:17:47 +00:00
|
|
|
if(++mdia_shift > 2) mdia_shift = 2;
|
2016-05-06 03:55:55 +00:00
|
|
|
if(mdia_shift == 2) {
|
|
|
|
mdia_lock = !mdia_lock;
|
|
|
|
} else if(mdia_shift == 1) {
|
|
|
|
layer_on(MDIA);
|
|
|
|
}
|
2016-04-23 03:33:13 +00:00
|
|
|
}
|
|
|
|
} else {
|
2016-05-06 03:55:55 +00:00
|
|
|
if(record->tap.count && (!mdia_shift) && (!mdia_lock)) {
|
2016-04-23 03:33:13 +00:00
|
|
|
unregister_code(KC_BSLS);
|
|
|
|
} else {
|
2016-05-05 03:17:47 +00:00
|
|
|
if(--mdia_shift < 0) mdia_shift = 0;
|
2016-04-23 03:33:13 +00:00
|
|
|
if((!mdia_shift) && (!mdia_lock)) layer_off(MDIA);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2016-05-06 03:55:55 +00:00
|
|
|
case RSpec:
|
2016-04-23 03:33:13 +00:00
|
|
|
if (record->event.pressed) {
|
2016-05-06 03:55:55 +00:00
|
|
|
if (record->tap.count && !record->tap.interrupted) {
|
|
|
|
register_code(KC_EQL);
|
|
|
|
} else {
|
|
|
|
layer_on(SPEC);
|
2016-05-05 03:17:47 +00:00
|
|
|
}
|
2016-04-23 03:33:13 +00:00
|
|
|
} else {
|
2016-05-06 03:55:55 +00:00
|
|
|
if(record->tap.count && !record->tap.interrupted) {
|
2016-04-23 03:33:13 +00:00
|
|
|
unregister_code(KC_EQL);
|
2016-05-06 03:55:55 +00:00
|
|
|
} else {
|
|
|
|
layer_off(SPEC);
|
2016-04-23 03:33:13 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
// mouse diagonals
|
|
|
|
|
|
|
|
case MUL: // mouse up left
|
|
|
|
if (record->event.pressed) {
|
|
|
|
mousekey_on(KC_MS_UP);
|
|
|
|
mousekey_on(KC_MS_LEFT);
|
|
|
|
mousekey_send();
|
|
|
|
} else {
|
|
|
|
mousekey_off(KC_MS_UP);
|
|
|
|
mousekey_off(KC_MS_LEFT);
|
|
|
|
mousekey_send();
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MUR: // mouse up right
|
|
|
|
if (record->event.pressed) {
|
|
|
|
mousekey_on(KC_MS_UP);
|
|
|
|
mousekey_on(KC_MS_RIGHT);
|
|
|
|
mousekey_send();
|
|
|
|
} else {
|
|
|
|
mousekey_off(KC_MS_UP);
|
|
|
|
mousekey_off(KC_MS_RIGHT);
|
|
|
|
mousekey_send();
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MDL: // mouse down left
|
|
|
|
if (record->event.pressed) {
|
|
|
|
mousekey_on(KC_MS_DOWN);
|
|
|
|
mousekey_on(KC_MS_LEFT);
|
|
|
|
mousekey_send();
|
|
|
|
} else {
|
|
|
|
mousekey_off(KC_MS_DOWN);
|
|
|
|
mousekey_off(KC_MS_LEFT);
|
|
|
|
mousekey_send();
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MDR: // mouse down right
|
|
|
|
if (record->event.pressed) {
|
|
|
|
mousekey_on(KC_MS_DOWN);
|
|
|
|
mousekey_on(KC_MS_RIGHT);
|
|
|
|
mousekey_send();
|
|
|
|
} else {
|
|
|
|
mousekey_off(KC_MS_DOWN);
|
|
|
|
mousekey_off(KC_MS_RIGHT);
|
|
|
|
mousekey_send();
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
// none
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2016-03-07 05:12:29 +00:00
|
|
|
return MACRO_NONE;
|
|
|
|
};
|
|
|
|
|
|
|
|
// Runs just one time when the keyboard initializes.
|
2016-03-10 16:28:34 +00:00
|
|
|
void matrix_init_user(void) {
|
2016-03-07 05:12:29 +00:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
// Runs constantly in the background, in a loop.
|
2016-03-10 16:28:34 +00:00
|
|
|
void matrix_scan_user(void) {
|
2016-04-15 02:49:32 +00:00
|
|
|
// shift or caps lock turns on red light
|
2016-05-06 04:18:48 +00:00
|
|
|
if(caps_shift || (keyboard_report->mods & MOD_BIT(KC_RSFT)) || (host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK))) {
|
2016-04-15 02:49:32 +00:00
|
|
|
ergodox_right_led_1_on();
|
|
|
|
} else {
|
|
|
|
ergodox_right_led_1_off();
|
2016-04-12 04:28:16 +00:00
|
|
|
}
|
|
|
|
|
2016-04-23 03:33:13 +00:00
|
|
|
// Symbol layer turns on green light
|
|
|
|
if(layer_state & (1UL<<SYMB)) {
|
2016-04-12 03:51:12 +00:00
|
|
|
ergodox_right_led_2_on();
|
2016-04-15 02:49:32 +00:00
|
|
|
} else {
|
|
|
|
ergodox_right_led_2_off();
|
2016-04-12 03:51:12 +00:00
|
|
|
}
|
|
|
|
|
2016-04-23 03:33:13 +00:00
|
|
|
// Media layer turns on blue light
|
|
|
|
if(layer_state & (1UL<<MDIA)) {
|
2016-04-12 03:51:12 +00:00
|
|
|
ergodox_right_led_3_on();
|
2016-04-15 02:49:32 +00:00
|
|
|
} else {
|
|
|
|
ergodox_right_led_3_off();
|
2016-04-12 03:51:12 +00:00
|
|
|
}
|
2016-03-07 05:12:29 +00:00
|
|
|
};
|
2016-03-24 04:33:26 +00:00
|
|
|
|