1
0
Fork 0
This commit is contained in:
Stephan Bösebeck 2016-04-20 11:15:59 +02:00
commit 13244a259c
13 changed files with 464 additions and 513 deletions

View file

@ -2,29 +2,31 @@
#include "led.h"
#include "debug.h"
#include "action_layer.h"
#include "action_util.h"
#define BASE 0 // default layer
#define LOCK 1 // layer lock keys
#define SYMB_MO 2 // symbols momentary layer
#define SYMB_TG 3 // symbols lock layer
#define SYMB_XX 4 // symbols exit layer
#define MDIA_MO 5 // media momentary layer
#define MDIA_TG 6 // media lock layer
#define MDIA_XX 7 // media exit layer
#define UNLOCK 8 // clear to base layer
#define BASE 0 // default layer
#define LOCK 1 // shift-lock layer
#define SYMB_SH 2 // symbols shift layer
#define SYMB_LK 3 // symbols lock layer
#define SYMB_UN 4 // symbols unlock layer
#define MDIA_SH 5 // media shift layer
#define MDIA_LK 6 // media lock layer
#define MDIA_UN 7 // media unlock layer
#define UNLOCK 8 // clear to base layer
/*
* Ordinary Ergodox EZ keyboard layout, v3
* The Ordinary Layout for the Ergodox EZ keyboard, v3.1
* modifications from default by Nicholas Keene ergodoxez@nicholaskeene.com
* Details: http://nicholas.rinard.us/2016/03/ergodox-ez-layout.html
* Details: readme.md
* https://github.com/nrrkeene/qmk_firmware/tree/master/keyboard/ergodox_ez/keymaps/ordinary
*/
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Keymap 0: Basic layer
/* Keymap 0: Base Layer
*
* ,-----------------------------------------------------. ,-----------------------------------------------------.
* | LOCK Grv | 1 | 2 | 3 | 4 | 5 | ESC | | - | 6 | 7 | 8 | 9 | 0 | = LOCK |
* | LOCK `~ | 1 | 2 | 3 | 4 | 5 | ESC | | - | 6 | 7 | 8 | 9 | 0 | = LOCK |
* |-----------+------+------+------+------+-------------| |------+------+------+------+------+------+-----------|
* | Media Tab | Q | W | E | R | T | [ | | ] | Y | U | I | O | P | \ Media |
* |-----------+------+------+------+------+------| | | |------+------+------+------+------+-----------|
@ -32,8 +34,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* |-----------+------+------+------+------+------|Shift | | Tab |------+------+------+------+------+-----------|
* | LShift | Z | X | C | V | B | -Tab | | | N | M | , | . | / | RShift |
* `-----------+------+------+------+------+-------------' `-------------+------+------+------+------+-----------'
* |LCtrl | Meh |Hyper | LAlt | LGui | | RGui | RAlt | Hyper| Meh |RCtrl |
* `----------------------------------' `----------------------------------'
* | LCtrl | Meh |Hyper | LAlt | LGui | | RGui | RAlt | Hyper| Meh | RCtrl |
* `-----------------------------------' `-----------------------------------'
* ,-------------. ,-------------.
* | Home | End | | Left | Right|
* ,------|------|------| |------+------+------.
@ -44,20 +46,20 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
*/
[BASE] = KEYMAP(
// left hand
LT(LOCK, KC_GRV),KC_1 ,KC_2 ,KC_3 ,KC_4 ,KC_5 ,KC_ESC
,LT(MDIA_MO, KC_TAB),KC_Q ,KC_W ,KC_E ,KC_R ,KC_T ,KC_LBRC
,MO(SYMB_MO) ,KC_A ,KC_S ,KC_D ,KC_F ,KC_G
,KC_LSFT ,KC_Z ,KC_X ,KC_C ,KC_V ,KC_B ,LSFT(KC_TAB)
,KC_LCTL ,MEH_T(KC_NO),ALL_T(KC_NO),KC_LALT,KC_LGUI
LT(LOCK, KC_GRV) ,KC_1 ,KC_2 ,KC_3 ,KC_4 ,KC_5 ,KC_ESC
,LT(MDIA_SH, KC_TAB),KC_Q ,KC_W ,KC_E ,KC_R ,KC_T ,KC_LBRC
,MO(SYMB_SH) ,KC_A ,KC_S ,KC_D ,KC_F ,KC_G
,KC_LSFT ,KC_Z ,KC_X ,KC_C ,KC_V ,KC_B ,LSFT(KC_TAB)
,KC_LCTL ,MEH_T(KC_NO),ALL_T(KC_NO),KC_LALT,KC_LGUI
,KC_HOME,KC_END
,KC_PGUP
,KC_BSPC,KC_DEL ,KC_PGDN
,KC_HOME,KC_END
,KC_PGUP
,KC_BSPC,KC_DEL ,KC_PGDN
// right hand
,KC_MINS ,KC_6 ,KC_7 ,KC_8 ,KC_9 ,KC_0 ,LT(LOCK, KC_EQL)
,KC_RBRC ,KC_Y ,KC_U ,KC_I ,KC_O ,KC_P ,LT(MDIA_MO, KC_BSLS)
,KC_H ,KC_J ,KC_K ,KC_L ,KC_SCLN ,LT(SYMB_MO, KC_QUOT)
,KC_RBRC ,KC_Y ,KC_U ,KC_I ,KC_O ,KC_P ,LT(MDIA_SH, KC_BSLS)
,KC_H ,KC_J ,KC_K ,KC_L ,KC_SCLN ,LT(SYMB_SH, KC_QUOT)
,KC_TAB ,KC_N ,KC_M ,KC_COMM,KC_DOT ,KC_SLSH ,KC_RSFT
,KC_RGUI,KC_RALT,ALL_T(KC_NO),MEH_T(KC_NO),KC_RCTL
@ -68,59 +70,59 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Keymap 1: Layer Lock Keys
*
* ,-----------------------------------------------------. ,-----------------------------------------------------.
* | | Esc | | | | | | | | | | | | | |
* |-----------+------+------+------+------+-------------| |------+------+------+------+------+------+-----------|
* | Media LOCK| | | | | | | | | | | | | | Media LOCK|
* |-----------+------+------+------+------+------| | | |------+------+------+------+------+-----------|
* |Symbol LOCK| | | | | |------| |------| | | | | |Symbol LOCK|
* |-----------+------+------+------+------+------| | | |------+------+------+------+------+-----------|
* | Caps LOCK| | | | | | | | | | | | | | Caps LOCK|
* `-----------+------+------+------+------+-------------' `-------------+------+------+------+------+-----------'
* | | | | | | | | | | | |
* `----------------------------------' `----------------------------------'
* ,-------------. ,-------------.
* | | | | | |
* ,------|------|------| |------+------+------.
* | | | | | | | |
* | | |------| |------| | |
* | | | | | | | |
* `--------------------' `--------------------'
* ,-------------------------------------------------------. ,-------------------------------------------------------.
* | | Esc | | | | | | | | | | | | Bspc | |
* |-------------+------+------+------+------+-------------| |------+------+------+------+------+------+-------------|
* | Media LOCK | | | | | | | | | | | | | | Media LOCK |
* |-------------+------+------+------+------+------| | | |------+------+------+------+------+-------------|
* | Symbol LOCK | | | | | |------| |------| | | | | | Symbol LOCK |
* |-------------+------+------+------+------+------| | | |------+------+------+------+------+-------------|
* | Caps LOCK | | | | | | | | | | | | | | Caps LOCK |
* `-------------+------+------+------+------+-------------' `-------------+------+------+------+------+-------------'
* | | | | | | | | | | | |
* `------------------------------------' `------------------------------------'
* ,-------------. ,-------------.
* | | | | | |
* ,------|------|------| |------+------+------.
* | | | | | | | |
* | | |------| |------| | |
* | | | | | | | |
* `--------------------' `--------------------'
*/
[LOCK] = KEYMAP(
// left hand
KC_TRNS ,KC_ESC ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
,KC_FN3 ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
,KC_FN2 ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
,KC_CAPS ,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_ESC ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
,KC_FN3 ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
,KC_FN2 ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
,KC_CAPS ,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_FN3
,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_FN2
,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_CAPS
,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
,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_FN3
,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_FN2
,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_CAPS
,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
),
/* Keymap 2: Symbol Momentary Layer
/* Keymap 2: Symbol Shift Layer
*
* ,-----------------------------------------------------. ,-----------------------------------------------------.
* | | F1 | F2 | F3 | F4 | F5 | | | | F6 | F7 | F8 | F9 | F10 | |
* | LOCK | F1 | F2 | F3 | F4 | F5 | | | - | F6 | F7 | F8 | F9 | F10 | LOCK |
* |-----------+------+------+------+------+-------------| |------+------+------+------+------+------+-----------|
* | Media | ! | @ | { | } | & | < | | > | | | 7 | 8 | 9 | / | Media |
* | Media | ! | @ | { | } | & | < | | > | | | 7 | 8 | 9 | / | Media |
* |-----------+------+------+------+------+------| | | |------+------+------+------+------+-----------|
* | Symbol | # | $ | ( | ) | ` |------| |------| / | 4 | 5 | 6 | * | Symbol |
* | Symbol | # | $ | ( | ) | ` |------| |------| / | 4 | 5 | 6 | * | Symbol |
* |-----------+------+------+------+------+------| Tab | | Shift|------+------+------+------+------+-----------|
* | Shift | % | ^ | [ | ] | ~ | | | -Tab| \ | 1 | 2 | 3 | - | Shift |
* | LShift | % | ^ | [ | ] | ~ | | | -Tab| \ | 1 | 2 | 3 | - | RShift |
* `-----------+------+------+------+------+-------------' `------------+------+------+------+------+------------'
* | | | | | | | 0 | . | = | + | Entr |
* `----------------------------------' `----------------------------------'
@ -132,22 +134,22 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* | | | Down | | PgDn | | |
* `--------------------' `--------------------'
*/
[SYMB_MO] = KEYMAP(
[SYMB_SH] = KEYMAP(
// left hand
KC_FN2 ,KC_F1 ,KC_F2 ,KC_F3 ,KC_F4 ,KC_F5 ,KC_TRNS
,MO(MDIA_MO) ,KC_EXLM ,KC_AT ,KC_LCBR ,KC_RCBR ,KC_AMPR ,LSFT(KC_COMM)
,MO(SYMB_MO) ,KC_HASH ,KC_DLR ,KC_LPRN ,KC_RPRN ,KC_GRV
,MO(MDIA_SH) ,KC_EXLM ,KC_AT ,KC_LCBR ,KC_RCBR ,KC_AMPR ,LSFT(KC_COMM)
,MO(SYMB_SH) ,KC_HASH ,KC_DLR ,KC_LPRN ,KC_RPRN ,KC_GRV
,KC_LSFT ,KC_PERC ,KC_CIRC ,KC_LBRC ,KC_RBRC ,KC_TILD ,KC_TAB
,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
,KC_LEFT ,KC_RGHT
,KC_UP
,KC_SPC ,KC_ENT ,KC_DOWN
// right hand
,KC_TRNS ,KC_F6 ,KC_F7 ,KC_F8 ,KC_F9 ,KC_F10 ,KC_FN2
,LSFT(KC_DOT),KC_PIPE ,KC_7 ,KC_8 ,KC_9 ,KC_SLSH ,MO(MDIA_MO)
,KC_SLSH ,KC_4 ,KC_5 ,KC_6 ,KC_ASTR ,MO(SYMB_MO)
,KC_MINS ,KC_F6 ,KC_F7 ,KC_F8 ,KC_F9 ,KC_F10 ,KC_FN2
,LSFT(KC_DOT),KC_PIPE ,KC_7 ,KC_8 ,KC_9 ,KC_SLSH ,MO(MDIA_SH)
,KC_SLSH ,KC_4 ,KC_5 ,KC_6 ,KC_ASTR ,MO(SYMB_SH)
,LSFT(KC_TAB),KC_BSLS ,KC_1 ,KC_2 ,KC_3 ,KC_MINS ,KC_RSFT
,KC_0 ,KC_DOT ,KC_EQL,KC_PLUS ,KC_ENT
,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
@ -156,13 +158,13 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Keymap 3: Symbol Lock Layer
*
* ,-----------------------------------------------------. ,-----------------------------------------------------.
* | Lock | F1 | F2 | F3 | F4 | F5 | | | | F6 | F7 | F8 | F9 | F10 | Lock |
* | LOCK | F1 | F2 | F3 | F4 | F5 | | | - | F6 | F7 | F8 | F9 | F10 | LOCK |
* |-----------+------+------+------+------+-------------| |------+------+------+------+------+------+-----------|
* | Media | ! | @ | { | } | & | < | | > | | | 7 | 8 | 9 | / | Media |
* | Media | ! | @ | { | } | & | < | | > | | | 7 | 8 | 9 | / | Media |
* |-----------+------+------+------+------+------| | | |------+------+------+------+------+-----------|
* | | # | $ | ( | ) | ` |------| |------| / | 4 | 5 | 6 | * | |
* | Symbol | # | $ | ( | ) | ` |------| |------| / | 4 | 5 | 6 | * | Symbol |
* |-----------+------+------+------+------+------| Tab | | Shift|------+------+------+------+------+-----------|
* | Shift | % | ^ | [ | ] | ~ | | | -Tab| \ | 1 | 2 | 3 | - | Shift |
* | LShift | % | ^ | [ | ] | ~ | | | -Tab| \ | 1 | 2 | 3 | - | RShift |
* `-----------+------+------+------+------+-------------' `------------+------+------+------+------+------------'
* | | | | | | | 0 | . | = | + | Entr |
* `----------------------------------' `----------------------------------'
@ -174,22 +176,22 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* | | | Down | | PgDn | | |
* `--------------------' `--------------------'
*/
[SYMB_TG] = KEYMAP( // layer 3 : return key for symbol lock layer
[SYMB_LK] = KEYMAP(
// left hand
MO(SYMB_XX) ,KC_F1 ,KC_F2 ,KC_F3 ,KC_F4 ,KC_F5 ,KC_TRNS
,MO(MDIA_MO) ,KC_EXLM ,KC_AT ,KC_LCBR ,KC_RCBR ,KC_AMPR ,LSFT(KC_COMM)
,MO(UNLOCK) ,KC_HASH ,KC_DLR ,KC_LPRN ,KC_RPRN ,KC_GRV
,KC_LSFT ,KC_PERC ,KC_CIRC ,KC_LBRC ,KC_RBRC ,KC_TILD ,KC_TAB
,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
,KC_LEFT ,KC_RGHT
,KC_UP
,KC_SPC ,KC_ENT ,KC_DOWN
MO(SYMB_UN) ,KC_F1 ,KC_F2 ,KC_F3 ,KC_F4 ,KC_F5 ,KC_TRNS
,MO(MDIA_SH) ,KC_EXLM ,KC_AT ,KC_LCBR ,KC_RCBR ,KC_AMPR ,LSFT(KC_COMM)
,MO(UNLOCK) ,KC_HASH ,KC_DLR ,KC_LPRN ,KC_RPRN ,KC_GRV
,KC_LSFT ,KC_PERC ,KC_CIRC ,KC_LBRC ,KC_RBRC ,KC_TILD ,KC_TAB
,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
,KC_LEFT ,KC_RGHT
,KC_UP
,KC_SPC ,KC_ENT ,KC_DOWN
// right hand
,KC_TRNS ,KC_F6 ,KC_F7 ,KC_F8 ,KC_F9 ,KC_F10 ,MO(SYMB_XX)
,LSFT(KC_DOT),KC_PIPE ,KC_7 ,KC_8 ,KC_9 ,KC_SLSH ,MO(MDIA_MO)
,KC_MINS ,KC_F6 ,KC_F7 ,KC_F8 ,KC_F9 ,KC_F10 ,MO(SYMB_UN)
,LSFT(KC_DOT),KC_PIPE ,KC_7 ,KC_8 ,KC_9 ,KC_SLSH ,MO(MDIA_SH)
,KC_SLSH ,KC_4 ,KC_5 ,KC_6 ,KC_ASTR ,MO(UNLOCK)
,LSFT(KC_TAB),KC_BSLS ,KC_1 ,KC_2 ,KC_3 ,KC_MINS ,KC_RSFT
,KC_0 ,KC_DOT ,KC_EQL,KC_PLUS ,KC_ENT
,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
@ -197,58 +199,58 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Keymap 4: Symbol Unlock Layer
*
* ,-----------------------------------------------------. ,-----------------------------------------------------.
* | | Esc | | | | | | | | | | | | | |
* |-----------+------+------+------+------+-------------| |------+------+------+------+------+------+-----------|
* | Unlock | | | | | | | | | | | | | | Unlock |
* |-----------+------+------+------+------+------| | | |------+------+------+------+------+-----------|
* | | | | | | |------| |------| | | | | | |
* |-----------+------+------+------+------+------| | | |------+------+------+------+------+-----------|
* | Caps LOCK | | | | | | | | | | | | | | Caps LOCK |
* `-----------+------+------+------+------+-------------' `-------------+------+------+------+------+-----------'
* | | | | | | | | | | | |
* `----------------------------------' `----------------------------------'
* ,-------------. ,-------------.
* | | | | | |
* ,------|------|------| |------+------+------.
* | | | | | | | |
* | | |------| |------| | |
* | | | | | | | |
* `--------------------' `--------------------'
* ,------------------------------------------------------. ,------------------------------------------------------.
* | | Esc | | | | | | | | | | | | Bspc | |
* |------------+------+------+------+------+-------------| |------+------+------+------+------+------+------------|
* | Media LOCK | | | | | | | | | | | | | | Media LOCK |
* |------------+------+------+------+------+------| | | |------+------+------+------+------+------------|
* | UNLOCK | | | | | |------| |------| | | | | | UNLOCK |
* |------------+------+------+------+------+------| | | |------+------+------+------+------+------------|
* | Caps LOCK | | | | | | | | | | | | | | Caps LOCK |
* `------------+------+------+------+------+-------------' `-------------+------+------+------+------+------------'
* | | | | | | | | | | | |
* `----------------------------------' `----------------------------------'
* ,-------------. ,-------------.
* | | | | | |
* ,------|------|------| |------+------+------.
* | | | | | | | |
* | | |------| |------| | |
* | | | | | | | |
* `--------------------' `--------------------'
*/
[SYMB_XX] = KEYMAP(
[SYMB_UN] = KEYMAP(
// left hand
KC_TRNS ,KC_ESC ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
,TG(MDIA_TG) ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
,KC_FN1 ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
,KC_CAPS ,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 ,TG(MDIA_TG)
,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_FN1
,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_CAPS
,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_ESC ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
,TG(MDIA_LK) ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
,KC_FN1 ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
,KC_CAPS ,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_BSPC ,KC_TRNS
,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,TG(MDIA_LK)
,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_FN1
,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_CAPS
,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
,KC_TRNS ,KC_TRNS
,KC_TRNS
,KC_TRNS ,KC_TRNS ,KC_TRNS
),
/* Keymap 5: Media Momentary Layer
/* Keymap 5: Media Shift Layer
*
* ,-----------------------------------------------------. ,-----------------------------------------------------.
* | | F11 | F12 | F13 | F14 | F15 | | | | F16 | F17 | F18 | F19 | F20 | |
* | LOCK | F11 | F12 | F13 | F14 | F15 | | | | F16 | F17 | F18 | F19 | F20 | LOCK |
* |-----------+------+------+------+------+-------------| |------+------+------+------+------+------+-----------|
* | |ShutDn| | MsUp | | |ScrlUp| |ScrlUp|PrtScr| Home | Up | PgUp | Mail | |
* | Media |ShutDn|LClick| MsUp |RClick|Vol Up|ScrlUp| |ScrlUp|PrtScr| Home | Up | PgUp | Mail | Media |
* |-----------+------+------+------+------+------| | | |------+------+------+------+------+-----------|
* | | Sleep|MsLeft|MsDown|MsRght| |------| |------|NumLok| Left | Down | Right|MyComp| |
* | Symbol | Sleep|MsLeft|MsDown|MsRght|Vol Dn|------| |------|NumLok| Left | Down | Right|MyComp| Symbol |
* |-----------+------+------+------+------+------| | | |------+------+------+------+------+-----------|
* | | | |MsDown| | |ScrlDn| |ScrlDn| | End | Down | PgDn | | |
* | LShift | | |MsDown| | Mute |ScrlDn| |ScrlDn| | End | Down | PgDn | | RShift |
* `-----------+------+------+------+------+-------------' `-------------+------+------+------+------+-----------'
* | Mute |Vol Dn|Vol Up| Lclk | Rclk | |Insert|Delete| | | |
* | LCtrl| Meh |Hyper | LAlt | LGui | |Insert|Delete| Hyper| LAlt | LGui |
* `----------------------------------' `----------------------------------'
* ,-------------. ,-------------.
* | Stop |Refrsh| | Prev | Next |
@ -258,22 +260,22 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* | | | Home | |VolDn | | Pause|
* `--------------------' `--------------------'
*/
[MDIA_MO] = KEYMAP(
[MDIA_SH] = KEYMAP(
// left hand
KC_FN3 ,KC_F11 ,KC_F12 ,KC_F13 ,KC_F14 ,KC_F15 ,KC_TRNS
,MO(MDIA_MO) ,KC_POWER,KC_TRNS ,KC_MS_U ,KC_TRNS ,KC_TRNS ,KC_WH_U
,MO(SYMB_MO) ,KC_SLEP ,KC_MS_L ,KC_MS_D ,KC_MS_R ,KC_TRNS
,KC_LSFT ,KC_TRNS ,KC_TRNS ,KC_MS_D ,KC_TRNS ,KC_TRNS ,KC_WH_D
,KC_MUTE ,KC_VOLD ,KC_VOLU ,KC_BTN1 ,KC_BTN2
,KC_WSTP ,KC_WREF
,KC_WSCH
,KC_WBAK ,KC_TRNS ,KC_WHOM
KC_FN3 ,KC_F11 ,KC_F12 ,KC_F13 ,KC_F14 ,KC_F15 ,KC_NO
,MO(MDIA_SH) ,KC_POWER ,KC_BTN1 ,KC_MS_U ,KC_BTN2 ,KC_VOLU ,KC_WH_U
,MO(SYMB_SH) ,KC_SLEP ,KC_MS_L ,KC_MS_D ,KC_MS_R ,KC_VOLD
,KC_LSFT ,KC_NO ,KC_NO ,KC_MS_D ,KC_NO ,KC_MUTE ,KC_WH_D
,KC_LCTL ,MEH_T(KC_NO),ALL_T(KC_NO),KC_LALT,KC_LGUI
,KC_WSTP ,KC_WREF
,KC_WSCH
,KC_WBAK ,KC_NO ,KC_WHOM
// right hand
,KC_TRNS ,KC_F16 ,KC_F17 ,KC_F18 ,KC_F19 ,KC_F20 ,KC_FN3
,KC_WH_U ,KC_PSCR ,KC_HOME,KC_UP ,KC_PGUP ,KC_MAIL ,MO(MDIA_MO)
,KC_NLCK ,KC_LEFT,KC_DOWN ,KC_RIGHT,KC_MYCM ,MO(SYMB_MO)
,KC_WH_D ,KC_TRNS ,KC_END ,KC_DOWN ,KC_PGDN ,KC_TRNS ,KC_RSFT
,KC_INS ,KC_DEL ,KC_TRNS ,KC_TRNS ,KC_TRNS
,KC_NO ,KC_F16 ,KC_F17 ,KC_F18 ,KC_F19 ,KC_F20 ,KC_FN3
,KC_WH_U ,KC_PSCR ,KC_HOME,KC_UP ,KC_PGUP ,KC_MAIL ,MO(MDIA_SH)
,KC_NLCK ,KC_LEFT,KC_DOWN ,KC_RIGHT,KC_MYCM ,MO(SYMB_SH)
,KC_WH_D ,KC_NO ,KC_END ,KC_DOWN ,KC_PGDN ,KC_NO ,KC_RSFT
,GUI_T(KC_INS),ALT_T(KC_DEL),ALL_T(KC_NO),MEH_T(KC_NO),KC_RCTL
,KC_MPRV ,KC_MNXT
,KC_VOLU
,KC_VOLD ,KC_MSTP ,KC_MPLY
@ -282,15 +284,15 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Keymap 6: Media Lock Layer
*
* ,-----------------------------------------------------. ,-----------------------------------------------------.
* | | F11 | F12 | F13 | F14 | F15 | | | | F16 | F17 | F18 | F19 | F20 | |
* | LOCK | F11 | F12 | F13 | F14 | F15 | | | | F16 | F17 | F18 | F19 | F20 | LOCK |
* |-----------+------+------+------+------+-------------| |------+------+------+------+------+------+-----------|
* | |ShutDn| | MsUp | | |ScrlUp| |ScrlUp|PrtScr| Home | Up | PgUp | Mail | |
* | Media |ShutDn|LClick| MsUp |RClick|Vol Up|ScrlUp| |ScrlUp|PrtScr| Home | Up | PgUp | Mail | Media |
* |-----------+------+------+------+------+------| | | |------+------+------+------+------+-----------|
* | | Sleep|MsLeft|MsDown|MsRght| |------| |------|NumLok| Left | Down | Right|MyComp| |
* | | Sleep|MsLeft|MsDown|MsRght|Vol Dn|------| |------|NumLok| Left | Down | Right|MyComp| |
* |-----------+------+------+------+------+------| | | |------+------+------+------+------+-----------|
* | | | |MsDown| | |ScrlDn| |ScrlDn| | End | Down | PgDn | | |
* | LShift | | |MsDown| | Mute |ScrlDn| |ScrlDn| | End | Down | PgDn | | RShift |
* `-----------+------+------+------+------+-------------' `-------------+------+------+------+------+-----------'
* | Mute |Vol Dn|Vol Up| Lclk | Rclk | |Insert|Delete| | | |
* | LCtrl| Meh |Hyper | LAlt | LGui | |Insert|Delete| Hyper| LAlt | LGui |
* `----------------------------------' `----------------------------------'
* ,-------------. ,-------------.
* | Stop |Refrsh| | Prev | Next |
@ -300,22 +302,22 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* | | | Home | |VolDn | | Pause|
* `--------------------' `--------------------'
*/
[MDIA_TG] = KEYMAP(
[MDIA_LK] = KEYMAP(
// left hand
MO(MDIA_XX) ,KC_F11 ,KC_F12 ,KC_F13 ,KC_F14 ,KC_F15 ,KC_TRNS
,MO(UNLOCK) ,KC_POWER,KC_TRNS ,KC_MS_U ,KC_TRNS ,KC_TRNS ,KC_WH_U
,KC_NO ,KC_SLEP ,KC_MS_L ,KC_MS_D ,KC_MS_R ,KC_TRNS
,KC_LSFT ,KC_TRNS ,KC_TRNS ,KC_MS_D ,KC_TRNS ,KC_TRNS ,KC_WH_D
,KC_MUTE ,KC_VOLD ,KC_VOLU ,KC_BTN1 ,KC_BTN2
MO(MDIA_UN),KC_F11 ,KC_F12 ,KC_F13 ,KC_F14 ,KC_F15 ,KC_NO
,MO(UNLOCK) ,KC_POWER ,KC_BTN1 ,KC_MS_U ,KC_BTN2 ,KC_VOLU ,KC_WH_U
,KC_NO ,KC_SLEP ,KC_MS_L ,KC_MS_D ,KC_MS_R ,KC_VOLD
,KC_LSFT ,KC_NO ,KC_NO ,KC_MS_D ,KC_NO ,KC_MUTE ,KC_WH_D
,KC_LCTL ,MEH_T(KC_NO),ALL_T(KC_NO),KC_LALT,KC_LGUI
,KC_WSTP ,KC_WREF
,KC_WSCH
,KC_WBAK ,KC_TRNS ,KC_WHOM
,KC_WBAK ,KC_NO ,KC_WHOM
// right hand
,KC_TRNS ,KC_F16 ,KC_F17 ,KC_F18 ,KC_F19 ,KC_F20 ,MO(MDIA_XX)
,KC_NO ,KC_F16 ,KC_F17 ,KC_F18 ,KC_F19 ,KC_F20 ,MO(MDIA_UN)
,KC_WH_U ,KC_PSCR ,KC_HOME,KC_UP ,KC_PGUP ,KC_MAIL ,MO(UNLOCK)
,KC_NLCK ,KC_LEFT,KC_DOWN ,KC_RIGHT,KC_MYCM ,KC_NO
,KC_WH_D ,KC_TRNS ,KC_END ,KC_DOWN ,KC_PGDN ,KC_TRNS ,KC_RSFT
,KC_INS ,KC_DEL ,KC_TRNS ,KC_TRNS ,KC_TRNS
,KC_WH_D ,KC_NO ,KC_END ,KC_DOWN ,KC_PGDN ,KC_NO ,KC_RSFT
,GUI_T(KC_INS),ALT_T(KC_DEL),ALL_T(KC_NO),MEH_T(KC_NO),KC_RCTL
,KC_MPRV ,KC_MNXT
,KC_VOLU
,KC_VOLD ,KC_MSTP ,KC_MPLY
@ -324,9 +326,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Keymap 7: Media Unlock Layer
*
* ,-----------------------------------------------------. ,-----------------------------------------------------.
* | | Esc | | | | | | | | | | | | | |
* | | Esc | | | | | | | | | | | | Bspc | |
* |-----------+------+------+------+------+-------------| |------+------+------+------+------+------+-----------|
* | Unlock | | | | | | | | | | | | | | Unlock |
* | UNLOCK | | | | | | | | | | | | | | UNLOCK |
* |-----------+------+------+------+------+------| | | |------+------+------+------+------+-----------|
* | | | | | | |------| |------| | | | | | |
* |-----------+------+------+------+------+------| | | |------+------+------+------+------+-----------|
@ -342,34 +344,34 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* | | | | | | | |
* `--------------------' `--------------------'
*/
[MDIA_XX] = KEYMAP(
[MDIA_UN] = KEYMAP(
// left hand
KC_TRNS ,KC_ESC ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
,KC_FN1 ,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_CAPS ,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_ESC ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
,KC_FN1 ,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_CAPS ,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_FN1
,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_CAPS
,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
,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_FN1
,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_CAPS
,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
),
/* Keymap 8: Unlock Layer
*
* ,-----------------------------------------------------. ,-----------------------------------------------------.
* | Unlock | | | | | | | | | | | | | | Unlock |
* | UNLOCK | | | | | | | | | | | | | | UNLOCK |
* |-----------+------+------+------+------+-------------| |------+------+------+------+------+------+-----------|
* | | | | | | | | | | | | | | | |
* |-----------+------+------+------+------+------| | | |------+------+------+------+------+-----------|
@ -389,22 +391,22 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
*/
[UNLOCK] = KEYMAP(
// left hand
KC_FN1 ,KC_ESC ,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_FN1 ,KC_ESC ,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
,KC_TRNS
,KC_TRNS ,KC_TRNS ,KC_TRNS
// right hand
,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_FN1
,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_FN1
,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
@ -413,9 +415,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
};
const uint16_t PROGMEM fn_actions[] = {
[1] = ACTION_LAYER_CLEAR(ON_PRESS) // FN1 - clear to base layer
,[2] = ACTION_LAYER_INVERT(SYMB_TG, ON_PRESS) // FN2 - toggle to Symbols on press
,[3] = ACTION_LAYER_INVERT(MDIA_TG, ON_PRESS) // FN3 - toggle to Media on press
[1] = ACTION_LAYER_CLEAR(ON_PRESS) // FN1 - clear to base layer
,[2] = ACTION_LAYER_INVERT(SYMB_LK, ON_PRESS) // FN2 - toggle to Symbols on press
,[3] = ACTION_LAYER_INVERT(MDIA_LK, ON_PRESS) // FN3 - toggle to Media on press
};
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
@ -440,31 +442,34 @@ void matrix_init_user(void) {
// Runs constantly in the background, in a loop.
void matrix_scan_user(void) {
uint8_t layer = biton32(layer_state);
uint8_t layer = biton32(layer_state);
// do not change lights for locking and unlocking
if(layer == UNLOCK || layer == LOCK || layer == SYMB_XX || layer == MDIA_XX) {
// shift or caps lock turns on red light
if((keyboard_report->mods & (MOD_BIT(KC_LSFT) | MOD_BIT(KC_RSFT))) || (host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK))) {
ergodox_right_led_1_on();
} else {
ergodox_right_led_1_off();
}
// do not change lights while locking and unlocking
if(layer == LOCK || layer == SYMB_UN || layer == MDIA_UN || layer == UNLOCK) {
return;
}
ergodox_board_led_off();
ergodox_right_led_1_off();
ergodox_right_led_2_off();
ergodox_right_led_3_off();
//ergodox_board_led_off();
// caps lock turns on red light
if(host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK)) {
ergodox_right_led_1_on();
}
// symbol lock turns on green light
if(layer == SYMB_MO || layer == SYMB_TG) {
// symbol turns on green light
if(layer == SYMB_SH || layer == SYMB_LK) {
ergodox_right_led_2_on();
} else {
ergodox_right_led_2_off();
}
// media lock turns on blue light
if(layer == MDIA_MO || layer == MDIA_TG) {
// media turns on blue light
if(layer == MDIA_SH || layer == MDIA_LK) {
ergodox_right_led_3_on();
} else {
ergodox_right_led_3_off();
}
};

Binary file not shown.

Before

Width:  |  Height:  |  Size: 116 KiB

After

Width:  |  Height:  |  Size: 118 KiB

View file

@ -3,25 +3,25 @@
[{y:-0.875,x:5.5},"F15",{c:"#ff4444"},"Esc",{x:4.5,c:"#cccccc",a:7},"",{c:"#99de2a",a:4},"F16"],
[{y:-0.875,c:"#2277ff",w:1.5},"Shift\n\n\n\n\n\nLock",{c:"#99de2a"},"F11",{x:14.5},"F20",{c:"#2277ff",w:1.5},"\n\nShift\n\n\n\n\nLock"],
[{y:-0.375,x:3.5,c:"#ff8500"},"Mouse\n\n\n\n\n\nUp",{x:10.5},"Cursor\n\n\n\n\n\nUp"],
[{y:-0.875,x:2.5,c:"#cccccc",a:7},"",{x:1,c:"#ffb063",a:4},"Scroll\n\n\n\n\n\nUp",{x:8.5},"Home",{x:1},"Page\n\n\n\n\n\nUp"],
[{y:-0.875,x:5.5,c:"#cccccc",a:7},"",{c:"#ffb063",a:4,h:1.5},"Scroll\n\n\n\n\n\nUp",{x:4.5,h:1.5},"Scroll\n\n\n\n\n\nUp",{c:"#e6e067"},"Print\n\n\n\n\n\nScreen"],
[{y:-0.875,x:2.5},"Left\n\n\n\n\n\nClick",{x:1},"Right\n\n\n\n\n\nClick",{x:8.5,c:"#ffb063"},"Home",{x:1},"Page\n\n\n\n\n\nUp"],
[{y:-0.875,x:5.5,c:"#e6e067"},"Vol\n\n\n\n\n\nUp",{c:"#ffb063",h:1.5},"Scroll\n\n\n\n\n\nUp",{x:4.5,h:1.5},"Scroll\n\n\n\n\n\nUp",{c:"#e6e067"},"Print\n\n\n\n\n\nScreen"],
[{y:-0.875,c:"#000000",t:"#ff0000",w:1.5},"Media\n\n\n\n\n\nShift",{c:"#e6e067",t:"#000000"},"Shut\n\n\n\n\n\nDown",{x:14.5},"Mail",{c:"#000000",t:"#ff0000",w:1.5},"\n\nMedia\n\n\n\n\nShift"],
[{y:-0.375,x:3.5,c:"#ff8500",t:"#000000"},"Mouse\n\n\n\n\n\nDown",{x:10.5},"Cursor\n\n\n\n\n\nDown"],
[{y:-0.875,x:2.5},"Mouse\n\n\n\n\n\nLeft",{x:1},"Mouse\n\n\n\n\n\nRight",{x:8.5},"Cursor\n\n\n\n\n\nLeft",{x:1},"Cursor\n\n\n\n\n\nRight"],
[{y:-0.875,x:5.5,c:"#cccccc",a:7},"",{x:6.5,c:"#e6e067",a:4},"Num\n\n\n\n\n\nLock"],
[{y:-0.875,x:5.5,c:"#e6e067"},"Vol\n\n\n\n\n\nDown",{x:6.5},"Num\n\n\n\n\n\nLock"],
[{y:-0.875,c:"#cccccc",a:7,w:1.5},"",{c:"#e6e067",a:4},"Sleep",{x:14.5},"My\n\n\n\n\n\nComp",{c:"#cccccc",a:7,w:1.5},""],
[{y:-0.625,x:6.5,c:"#ffb063",a:4,h:1.5},"Scroll\n\n\n\n\n\nDown",{x:4.5,h:1.5},"Scroll\n\n\n\n\n\nDown"],
[{y:-0.75,x:3.5,c:"#ff8500"},"Mouse\n\n\n\n\n\nDown",{x:10.5},"Cursor\n\n\n\n\n\nDown"],
[{y:-0.875,x:2.5,c:"#cccccc",a:7},"",{x:1,c:"#ffb063",a:4},"Scroll\n\n\n\n\n\nDown",{x:8.5},"End",{x:1},"Page\n\n\n\n\n\nDown"],
[{y:-0.875,x:5.5,c:"#cccccc",a:7},"",{x:6.5},""],
[{y:-0.875,c:"#2277ff",a:4,fa:[0,1,0,0,0,0,0],w:1.5},"Capitals\nShift\n\n\n\n\nShift",{c:"#cccccc",a:7},"",{x:14.5},"",{c:"#2277ff",a:4,fa:[0,1,0,1],w:1.5},"\n\nCapitals\nShift\n\n\n\nShift"],
[{y:-0.375,x:3.5,c:"#ff8500"},"Left\n\n\n\n\n\nClick",{x:10.5,c:"#ffb063"},"Delete"],
[{y:-0.875,x:2.5,c:"#e6e067"},"Vol\n\n\n\n\n\nUp",{x:1,c:"#ff8500"},"Right\n\n\n\n\n\nClick",{x:8.5,c:"#ffb063"},"Insert",{x:1,c:"#cccccc",a:7},""],
[{y:-0.75,x:0.5,c:"#e6e067",a:4},"Mute","Vol\n\n\n\n\n\nDown",{x:14.5,c:"#cccccc",a:7},"",""],
[{r:30,rx:6.5,ry:4.25,y:-1,x:1,c:"#cfc82b",a:4},"Stop\n\n\nBrowser","Reload\n\n\nBrowser"],
[{y:-0.875,x:2.5,c:"#cccccc",a:7},"",{x:1},"",{x:8.5,c:"#ffb063",a:4},"End",{x:1},"Page\n\n\n\n\n\nDown"],
[{y:-0.875,x:5.5,c:"#e6e067"},"Mute",{x:6.5,c:"#cccccc",a:7},""],
[{y:-0.875,c:"#2277ff",a:4,f2:1,w:1.5},"Capitals\nShift\n\n\n\n\nShift",{c:"#cccccc",a:7},"",{x:14.5},"",{c:"#2277ff",a:4,fa:[0,1,0,1],w:1.5},"\n\nCapitals\nShift\n\n\n\nShift"],
[{y:-0.375,x:3.5,c:"#77aaff"},"Option\n\n\nLAlt",{x:10.5,c:"#ffb063"},"Delete\n\n\nOption"],
[{y:-0.875,x:2.5,c:"#77aaff"},"Hyper",{x:1},"Cmd\n\n\nSuper",{x:8.5,c:"#ffb063"},"Insert\n\n\nCmd",{x:1,c:"#77aaff"},"Hyper"],
[{y:-0.75,x:0.5},"Ctrl\n\n\nLCtrl","Meh",{x:14.5},"Meh","Crtl\n\n\nRCtrl"],
[{r:30,rx:6.5,ry:4.25,y:-1,x:1,c:"#ccbb00"},"Stop\n\n\nBrowser","Reload\n\n\nBrowser"],
[{h:2},"< Web\n\n\nBrowser",{h:2},"Web >\n\n\nBrowser","Search\n\n\nBrowser"],
[{x:2},"Home\n\n\nBrowser"],
[{r:-30,rx:13,y:-1,x:-3},"Prev\n\n\nAudio\n\n\nTrack","Next\n\n\nAudio\n\n\nTrack"],
[{x:-3,c:"#e6e067"},"Vol\n\n\n\n\n\nUp",{c:"#cfc82b",h:2},"Stop\n\n\nAudio",{h:2},"Play\n\n\nAudio\n\n\nPause"],
[{x:-3,c:"#e6e067"},"Vol\n\n\n\n\n\nUp",{c:"#ccbb00",h:2},"Stop\n\n\nAudio",{h:2},"Play\n\n\nAudio\n\n\nPause"],
[{x:-3,c:"#e6e067"},"Vol\n\n\n\n\n\nDown"]

Binary file not shown.

Before

Width:  |  Height:  |  Size: 96 KiB

After

Width:  |  Height:  |  Size: 101 KiB

View file

@ -1,27 +1,27 @@
[{x:3.5,c:"#99de2a"},"F3",{x:10.5},"F8"],
[{y:-0.875,x:2.5},"F2",{x:1},"F4",{x:8.5},"F7",{x:1},"F9"],
[{y:-0.875,x:5.5},"F5",{c:"#ff4444"},"Esc",{x:4.5,c:"#cccccc",a:7},"",{c:"#99de2a",a:4},"F6"],
[{y:-0.875,x:5.5},"F5",{c:"#ff4444"},"Esc",{x:4.5,c:"#bbddbb"},"_\n\n\n\n\n\n-",{c:"#99de2a"},"F6"],
[{y:-0.875,c:"#2277ff",w:1.5},"Shift\n\n\n\n\n\nLock",{c:"#99de2a"},"F1",{x:14.5},"F10",{c:"#2277ff",w:1.5},"\n\nShift\n\n\n\n\nLock"],
[{y:-0.375,x:3.5,c:"#c4e0bf"},"{",{x:10.5,c:"#89b087"},"8"],
[{y:-0.875,x:2.5,c:"#c4e0bf"},"@",{x:1},"}",{x:8.5,c:"#89b087"},"7",{x:1},"9"],
[{y:-0.875,x:5.5,c:"#c4e0bf"},"&",{h:1.5},"<",{x:4.5,h:1.5},">","|"],
[{y:-0.875,c:"#2277ff",w:1.5},"Media\n\n\n\n\n\nShift",{c:"#c4e0bf"},"!",{x:14.5,c:"#89b087"},"/",{c:"#2277ff",w:1.5},"\n\nMedia\n\n\n\n\nShift"],
[{y:-0.375,x:3.5,c:"#c4e0bf"},"(",{x:10.5,c:"#89b087"},"5"],
[{y:-0.875,x:2.5,c:"#c4e0bf"},"$",{x:1},")",{x:8.5,c:"#89b087"},"4",{x:1},"6"],
[{y:-0.875,x:5.5,c:"#c4e0bf"},"`",{x:6.5},"/"],
[{y:-0.875,c:"#000000",t:"#ff0000",w:1.5},"Symbols\n\n\n\n\n\nShift",{c:"#c4e0bf",t:"#000000"},"#",{x:14.5,c:"#89b087"},"*",{c:"#000000",t:"#ff0000",w:1.5},"\n\nSymbols\n\n\n\n\nShift"],
[{y:-0.375,x:3.5,c:"#bbddbb"},"{",{x:10.5,c:"#89b087"},"8"],
[{y:-0.875,x:2.5,c:"#bbddbb"},"@",{x:1},"}",{x:8.5,c:"#89b087"},"7",{x:1},"9"],
[{y:-0.875,x:5.5,c:"#bbddbb"},"&",{h:1.5},"<",{x:4.5,h:1.5},">","|"],
[{y:-0.875,c:"#2277ff",w:1.5},"Media\n\n\n\n\n\nShift",{c:"#bbddbb"},"!",{x:14.5,c:"#89b087"},"/",{c:"#2277ff",w:1.5},"\n\nMedia\n\n\n\n\nShift"],
[{y:-0.375,x:3.5,c:"#bbddbb"},"(",{x:10.5,c:"#89b087"},"5"],
[{y:-0.875,x:2.5,c:"#bbddbb"},"$",{x:1},")",{x:8.5,c:"#89b087"},"4",{x:1},"6"],
[{y:-0.875,x:5.5,c:"#bbddbb"},"`",{x:6.5},"/"],
[{y:-0.875,c:"#000000",t:"#ff0000",w:1.5},"Symbols\n\n\n\n\n\nShift",{c:"#bbddbb",t:"#000000"},"#",{x:14.5,c:"#89b087"},"*",{c:"#000000",t:"#ff0000",w:1.5},"\n\nSymbols\n\n\n\n\nShift"],
[{y:-0.625,x:6.5,c:"#54d6de",t:"#000000",fa:[0,0,0,1],h:1.5},"Tab >\n\n\nTab",{x:4.5,h:1.5},"< Tab\n\n\nShift Tab"],
[{y:-0.75,x:3.5,c:"#c4e0bf"},"[",{x:10.5,c:"#89b087"},"2"],
[{y:-0.875,x:2.5,c:"#c4e0bf"},"^",{x:1},"]",{x:8.5,c:"#89b087"},"1",{x:1},"3"],
[{y:-0.875,x:5.5,c:"#c4e0bf"},"~",{x:6.5},"\\"],
[{y:-0.875,c:"#2277ff",f2:1,w:1.5},"Capitals\nShift\n\n\n\n\nShift",{c:"#c4e0bf"},"%",{x:14.5,c:"#89b087"},"-",{c:"#2277ff",fa:[0,1,0,1],w:1.5},"\n\nCapitals\nShift\n\n\n\nShift"],
[{y:-0.375,x:3.5,c:"#cccccc",a:7},"",{x:10.5,c:"#89b087",a:4},"."],
[{y:-0.875,x:2.5,c:"#cccccc",a:7},"",{x:1},"",{x:8.5,c:"#89b087",a:4},"0",{x:1},"="],
[{y:-0.75,x:0.5,c:"#cccccc",a:7},"","",{x:14.5,c:"#89b087",a:4},"+","Enter"],
[{y:-0.75,x:3.5,c:"#bbddbb"},"[",{x:10.5,c:"#89b087"},"2"],
[{y:-0.875,x:2.5,c:"#bbddbb"},"^",{x:1},"]",{x:8.5,c:"#89b087"},"1",{x:1},"3"],
[{y:-0.875,x:5.5,c:"#bbddbb"},"~",{x:6.5},"\\"],
[{y:-0.875,c:"#2277ff",fa:[0,1,0,1,0,0,1],w:1.5},"Capitals\nShift\n\n\n\n\nShift",{c:"#bbddbb"},"%",{x:14.5,c:"#89b087"},"-",{c:"#2277ff",w:1.5},"\n\nCapitals\nShift\n\n\n\nShift"],
[{y:-0.375,x:3.5,c:"#77aaff"},"Option\n\n\nLAlt",{x:10.5,c:"#89b087"},".\n\n\nOption"],
[{y:-0.875,x:2.5,c:"#77aaff"},"Hyper",{x:1},"Cmd\n\n\nSuper",{x:8.5,c:"#89b087"},"0\n\n\nCmd",{x:1},"=\n\n\nHyper"],
[{y:-0.75,x:0.5,c:"#77aaff"},"Ctrl\n\n\nLCtrl","Meh",{x:14.5,c:"#89b087"},"+\n\n\nMeh","Enter\n\n\nCtrl"],
[{r:30,rx:6.5,ry:4.25,y:-1,x:1,c:"#54d6de"},"Left","Right"],
[{h:2},"Space",{h:2},"Enter","Up"],
[{x:2},"Down"],
[{r:-30,rx:13,y:-1,x:-3},"Home","End"],
[{x:-3},"Page\n\n\n\n\n\nUp",{h:2},"< Del\n\n\nBackspace",{h:2},"Del >\n\n\nDelete"],
[{x:-3},"Page\n\n\n\n\n\nDown"]
[{x:-3,f:3},"Page\n\n\n\n\n\nUp",{h:2},"< Del\n\n\nBackspace",{h:2},"Del >\n\n\nDelete"],
[{x:-3,f:3},"Page\n\n\n\n\n\nDown"]

View file

@ -18,7 +18,7 @@ no rights reserved, use for any purposes, credit me if you are a nice person
![Ordinary base layout](ordinary-base.png)
This layout puts the modifier keys along the bottom of the keyboard where they are on most keyboards. They are in the regular order, with the addition of Hyper and Meh keys. On the outside edges are the Shift keys. The traditional shift key is called Capitals Shift and it is in the normal location. Above that are Symbols Shift and Media Shift. Each Shift key momentarily switches the layout to that layer, and if you use the Shift Lock button you can lock the layout to that layer.
This layout puts the modifier keys along the bottom of the keyboard where they are on most keyboards. They are in the regular order, with the addition of Hyper and Meh keys. The modifier keys are all in the same place on all layers, although some layers also assign symbols on those buttons. On the outside edges are the Shift keys. The traditional shift key is called Capitals Shift and it is in the normal location. Above that are Symbols Shift and Media Shift. Each Shift key momentarily switches the layout to that layer, and if you use the Shift Lock button you can lock the layout to that layer.
Touch typists will also find tilde, tab, equals/plus, slash/pipe, and quote/double-quote sharing space on those Shift keys where they would probably be on a common keyboard. Other than the turquoise keys the only buttons which move to new locations are the Brackets and Dash and Escape. Most touch typists dont touch-type brackets or dash anyway so only Escape really requires retraining of muscle memory, and see below for the Special Escape Sequence.
@ -45,7 +45,7 @@ The symbol keys are mostly the same as on the default layout, which did a good j
The number pad area here, in green, includes all four arithmetic operations in the same order found on most number pads and features an Enter key. The keycodes emitted here are normal numeric keycodes, not the number-pad specific keycodes emitted by most number pads, because this layout does not use a Num Lock key to switch the buttons between numeric keycodes and navigational keycodes. See the explanation in The Media Layout section about navigation using these same buttons.
Finally, consider the turquoise text-nav keys. Here in the Symbols layer, these are *reversed* from the base layer, with most keys mirrored, but the Delete keys shifted to maintain the directional significance of their arrangement. This is powerful! Often I find myself using the mouse with my right hand, and the left hand needs to press Enter. Instead of reaching the left hand over to the right side of the keyboard, now I simply tap Symbols to reverse the yellow keys, and Enter is right where it should be.
Finally, consider the turquoise text-nav keys. Here in the Symbols layer, these are *reversed* from the base layer, with the keys either mirrored or shifted. This is powerful! Often I find myself using the mouse with my right hand, and the left hand needs to press Enter. Instead of reaching the left hand over to the right side of the keyboard, now I simply tap Symbols to reverse the turquoise keys, and Enter is right where it should be.
## The Media Layer ##
@ -55,6 +55,7 @@ Finally, consider the turquoise text-nav keys. Here in the Symbols layer, these
* The bright green keys are more F-keys
* The dark yellow keys signal Web and Audio applications
* The light yellow keys signal the operating system
* The uncolored keys do nothing in case you bump them by accident
![Ordinary media layout](ordinary-media.png)
@ -62,14 +63,18 @@ This layer was inspired by the Media layer on the Ergodox EZ but takes it farthe
Moreover, the orange keys on the right overlay the numberpad from the Symbols Layer, such that in the Media Layer the same keys can be used as if they were a number pad in navigational mode (Num Lock off). For instance, in traditional number pads the '3' key became 'Page Down', and so it is here. This means a user can do text navigation without moving either hand.
Alas, the yellow keys have at best spotty success with common software. Good luck with those but don't expect too much.
## Switching Between Layers ##
The three Shift keys correspond to three logical layers on top of the ever-present base layer, and are represented in the three LEDs on the keyboard: Capitals (red), Symbols (green), Media (blue). The color of a layer illuminates when the layer is active. Shift keys work in the expected way: press them and the keys shift to that layer; release them and the keys shift back to the base layer. The Ordinary Layout also features a Shift Lock key to keep a layer active indefinitely. Hold down the Shift Lock key then press any Shift key to lock to that layer. Or, hold down the Shift key and press the Shift Lock key; either way works. To revert to the base layer, use the Shift Lock key again in combination with the Shift key.
The three Shift keys correspond to three logical layers on top of the ever-present base layer, and are represented in the three LEDs on the keyboard: Capitals (red), Symbols (green), Media (blue). The color of a layer illuminates when the layer is active. Shift keys work in the expected way: press them and the keys shift to that layer; release them and the keys shift back to the base layer. The Ordinary Layout also features a Shift Lock key to keep a layer active indefinitely. Hold down the Shift Lock key then press any Shift key to lock to that layer. Or, hold down the Shift key and press the Shift Lock key; it works either way. To revert to the base layer, use the Shift Lock key again in combination with the Shift key.
This layout attempts to treat the Capitals Shift layer the same as the other two Shift layers, but internally they are different which causes some inconsistencies. For instance, it is possible to switch from any layer to any other layer, and to lock to any layer, *except* it is not possible to go from Media to Symbols. You must exit the Media layer before engaging the Symbols layer. Also, the Caps Lock feature must be triggered by first pressing the Shift Lock key then a Capitals Shift key; it doesn't work if you press the Shift key first (instead you get the secondary symbol associated with the Shift Lock button).
This layout attempts to treat the Capitals Shift layer the same as the other two Shift layers, but internally they are different which causes some inconsistencies. For instance, it is possible to switch from any layer to any other layer, and to lock to any layer, *except* it is not possible to go from Media to Symbols. You must exit the Media layer before engaging the Symbols layer. Also, the Caps Lock feature must be triggered by first pressing the Shift Lock key then a Capitals Shift key; it doesn't work if you press the Shift key first (instead you get the secondary symbol character associated with the Shift Lock button).
## Special Escape Sequence ##
## Special Escape & Backspace Sequences ##
In the Ordinary Layout, the most unsatisfying key location is the Escape key which rightly belongs segregated on its own way up on the top left of the keyboard. The Ergodox does not have a physical button in such a location and the nearest one, in the top left corner, was assigned to the tilde button which is traditionally found in that location. The Escape key is important so it features prominently on the other top corner on the left side of the keyboard, and is always there in all layers. Nevertheless, alas, it isn't Ordinary to put the escape in that different corner!
In the Ordinary Layout, the most unsatisfying key location is the Escape key which rightly belongs segregated on its own way up on the top left of the keyboard. The Ergodox does not have a physical button in such a location and the nearest one, in the top left corner, is home to the tilde (er, grave) which is commonly found there. The Escape key is important so it features prominently on the other top corner on the left side of the keyboard, and is always there in all layers. Nevertheless, alas, it isn't Ordinary to put the escape in that different corner!
That tilde key has a second function as the Shift Lock key and that makes possible a special feature. To make this layout as Ordinary as possible, the Escape key can *also* be accessed by pressing Shift Lock then the 1 button right next to it. This easy gesture is a way to partially maintain the ease of flicking your wrist to the left and tapping Escape. This gesture works in all layers.
Finally, because the special Escape sequence is so natural and useful, on the top right corner of the Ergodox EZ you can do the same gesture with the 0 key to produce a Backspace. Users of this keyboard and this layout are well advised to learn to use their thumbs for deleting text, but sometimes you are doing other computery things and just want to flick your digits up to the right and press backspace a bunch times. These special sequences should feel unremarkably mundane but might prove to be remarkably useful.

View file

@ -145,7 +145,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
{XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, LOWER, XXXXXXX, XXXXXXX, RAISE, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX}
},
/* Plover layer (http://openstenoproject.org)
/* Plover layer (http://opensteno.org)
* ,-----------------------------------------------------------------------------------.
* | # | # | # | # | # | # | # | # | # | # | # | # |
* |------+------+------+------+------+-------------+------+------+------+------+------|
@ -225,16 +225,10 @@ float tone_dvorak[][2] = {
{440.0*pow(2.0,(31)/12.0), 8}
};
float tone_music[][2] = {
{440.0*pow(2.0,(12)/12.0), 8},
{440.0*pow(2.0,(14)/12.0), 8},
{440.0*pow(2.0,(16)/12.0), 8},
{440.0*pow(2.0,(17)/12.0), 8},
{440.0*pow(2.0,(19)/12.0), 8},
{440.0*pow(2.0,(21)/12.0), 8},
{440.0*pow(2.0,(23)/12.0), 8},
{440.0*pow(2.0,(24)/12.0), 8}
};
float music_scale[][2] = SONG(MUSIC_SCALE_SOUND);
float goodbye[][2] = SONG(GOODBYE_SOUND);
#endif
@ -324,7 +318,7 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
case 9:
if (record->event.pressed) {
#ifdef AUDIO_ENABLE
PLAY_NOTE_ARRAY(tone_music, false, 0);
PLAY_NOTE_ARRAY(music_scale, false, 0);
layer_on(_MUSIC);
#endif
}
@ -370,7 +364,12 @@ void process_action_user(keyrecord_t *record) {
void matrix_init_user(void) {
#ifdef AUDIO_ENABLE
init_notes();
PLAY_NOTE_ARRAY(tone_startup, false, 0);
#endif
}
void play_goodbye_tone()
{
PLAY_NOTE_ARRAY(goodbye, false, 0);
_delay_ms(150);
}

View file

@ -133,7 +133,7 @@ OPT_DEFS += -DBOOTLOADER_SIZE=4096
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)
CONSOLE_ENABLE = on # Console for debug(+400)
COMMAND_ENABLE = yes # Commands for debug and configuration
NKRO_ENABLE = no # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality

View file

@ -3,6 +3,7 @@
#include "eeconfig.h"
#ifdef AUDIO_ENABLE
#include "audio.h"
#include "song_list.h"
#endif
// Each layer gets a name for readability, which is then used in the keymap matrix below.
@ -15,7 +16,7 @@
#define _LOWER 3
#define _RAISE 4
#define _MUSIC 5
#define _ADJUST 6
#define _ADJUST 16
// Macro name shortcuts
#define QWERTY M(_QWERTY)
@ -142,6 +143,17 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
{_______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY}
},
/* Music (reserved for process_action_user)
*
*/
[_MUSIC] = {
{XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX},
{XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX},
{XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX},
{XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX},
{XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, LOWER, XXXXXXX, XXXXXXX, RAISE, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX}
},
/* Adjust (Lower + Raise)
* ,-----------------------------------------------------------------------------------.
* | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 |
@ -161,19 +173,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
{_______, _______, _______, AUD_ON, AUD_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, _______, _______},
{_______, _______, _______, MUS_ON, MUS_OFF, _______, _______, _______, _______, _______, _______, _______},
{_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______}
},
/* Music (reserved for process_action_user)
*
*/
[_MUSIC] = {
{XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX},
{XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX},
{XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX},
{XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX},
{XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, LOWER, XXXXXXX, XXXXXXX, RAISE, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX}
}
};
const uint16_t PROGMEM fn_actions[] = {
@ -188,43 +190,10 @@ float start_up[][2] = {
{440.0*pow(2.0,(26)/12.0), 8}
};
float tone_qwerty[][2] = {
{440.0*pow(2.0,(23)/12.0), 8},
{440.0*pow(2.0,(24)/12.0), 8},
{0, 4},
{440.0*pow(2.0,(31)/12.0), 16}
};
float tone_qwerty[][2] = SONG(QWERTY_SOUND);
float tone_dvorak[][2] = SONG(DVORAK_SOUND);
float tone_colemak[][2] = SONG(COLEMAK_SOUND);
float tone_colemak[][2] = {
{440.0*pow(2.0,(23)/12.0), 8},
{440.0*pow(2.0,(24)/12.0), 8},
{0, 4},
{440.0*pow(2.0,(31)/12.0), 12},
{0, 4},
{440.0*pow(2.0,(35)/12.0), 12}
};
float tone_dvorak[][2] = {
{440.0*pow(2.0,(23)/12.0), 8},
{440.0*pow(2.0,(24)/12.0), 8},
{0, 4},
{440.0*pow(2.0,(31)/12.0), 8},
{0, 4},
{440.0*pow(2.0,(33)/12.0), 8},
{0, 4},
{440.0*pow(2.0,(31)/12.0), 8}
};
float tone_music[][2] = {
{440.0*pow(2.0,(12)/12.0), 8},
{440.0*pow(2.0,(14)/12.0), 8},
{440.0*pow(2.0,(16)/12.0), 8},
{440.0*pow(2.0,(17)/12.0), 8},
{440.0*pow(2.0,(19)/12.0), 8},
{440.0*pow(2.0,(21)/12.0), 8},
{440.0*pow(2.0,(23)/12.0), 8},
{440.0*pow(2.0,(24)/12.0), 8}
};
float music_scale[][2] = SONG(MUSIC_SCALE_SOUND);
float goodbye[][2] = SONG(GOODBYE_SOUND);
#endif
@ -315,7 +284,6 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
case 9:
if (record->event.pressed) {
#ifdef AUDIO_ENABLE
init_notes();
PLAY_NOTE_ARRAY(music_scale, false, 0);
layer_on(_MUSIC);
#endif
@ -341,11 +309,13 @@ void process_action_user(keyrecord_t *record) {
}
void matrix_init_user(void) {
#ifdef AUDIO_ENABLE
init_notes();
_delay_ms(10);
PLAY_NOTE_ARRAY(start_up, false, 0);
#endif
// audio_init();
play_startup_tone();
}
void play_startup_tone()
{
PLAY_NOTE_ARRAY(music_scale, false, 0);
}
void play_goodbye_tone()

View file

@ -10,20 +10,23 @@
#include "eeconfig.h"
#include "vibrato_lut.h"
#ifdef VIBRATO_ENABLE
#include "vibrato_lut.h"
#endif
#define PI 3.14159265
#define CPU_PRESCALER 8
// Largely untested PWM audio mode (doesn't sound as good)
// #define PWM_AUDIO
#ifdef PWM_AUDIO
#include "wave.h"
#define SAMPLE_DIVIDER 39
#define SAMPLE_RATE (2000000.0/SAMPLE_DIVIDER/2048)
// Resistor value of 1/ (2 * PI * 10nF * (2000000 hertz / SAMPLE_DIVIDER / 10)) for 10nF cap
float places[8] = {0, 0, 0, 0, 0, 0, 0, 0};
uint16_t place_int = 0;
bool repeat = true;
#endif
void delay_us(int count) {
@ -34,25 +37,21 @@ void delay_us(int count) {
int voices = 0;
int voice_place = 0;
double frequency = 0;
float frequency = 0;
int volume = 0;
long position = 0;
double frequencies[8] = {0, 0, 0, 0, 0, 0, 0, 0};
float frequencies[8] = {0, 0, 0, 0, 0, 0, 0, 0};
int volumes[8] = {0, 0, 0, 0, 0, 0, 0, 0};
bool sliding = false;
int max = 0xFF;
float sum = 0;
int value = 128;
float place = 0;
float places[8] = {0, 0, 0, 0, 0, 0, 0, 0};
uint16_t place_int = 0;
bool repeat = true;
uint8_t * sample;
uint16_t sample_length = 0;
double freq = 0;
// float freq = 0;
bool notes = false;
bool note = false;
@ -62,7 +61,7 @@ float note_tempo = TEMPO_DEFAULT;
float note_timbre = TIMBRE_DEFAULT;
uint16_t note_position = 0;
float (* notes_pointer)[][2];
uint8_t notes_count;
uint16_t notes_count;
bool notes_repeat;
float notes_rest;
bool note_resting = false;
@ -70,11 +69,15 @@ bool note_resting = false;
uint8_t current_note = 0;
uint8_t rest_counter = 0;
#ifdef VIBRATO_ENABLE
float vibrato_counter = 0;
float vibrato_strength = .5;
float vibrato_rate = 0.125;
#endif
float polyphony_rate = .5;
float polyphony_rate = 0;
bool inited = false;
audio_config_t audio_config;
@ -94,6 +97,7 @@ void audio_off(void) {
eeconfig_write_audio(audio_config.raw);
}
#ifdef VIBRATO_ENABLE
// Vibrato rate functions
void set_vibrato_rate(float rate) {
@ -124,6 +128,8 @@ void decrease_vibrato_strength(float change) {
#endif
#endif
// Polyphony functions
void set_polyphony_rate(float rate) {
@ -170,66 +176,7 @@ void increase_tempo(uint8_t tempo_change) {
}
}
void stop_all_notes() {
voices = 0;
#ifdef PWM_AUDIO
TIMSK3 &= ~_BV(OCIE3A);
#else
TIMSK3 &= ~_BV(OCIE3A);
TCCR3A &= ~_BV(COM3A1);
#endif
notes = false;
note = false;
frequency = 0;
volume = 0;
for (int i = 0; i < 8; i++) {
frequencies[i] = 0;
volumes[i] = 0;
}
}
void stop_note(double freq) {
if (note) {
cli();
#ifdef PWM_AUDIO
freq = freq / SAMPLE_RATE;
#endif
for (int i = 7; i >= 0; i--) {
if (frequencies[i] == freq) {
frequencies[i] = 0;
volumes[i] = 0;
for (int j = i; (j < 7); j++) {
frequencies[j] = frequencies[j+1];
frequencies[j+1] = 0;
volumes[j] = volumes[j+1];
volumes[j+1] = 0;
}
break;
}
}
voices--;
if (voices < 0)
voices = 0;
if (voice_place >= voices) {
voice_place = 0;
}
if (voices == 0) {
#ifdef PWM_AUDIO
TIMSK3 &= ~_BV(OCIE3A);
#else
TIMSK3 &= ~_BV(OCIE3A);
TCCR3A &= ~_BV(COM3A1);
#endif
frequency = 0;
volume = 0;
note = false;
}
sei();
}
}
void init_notes() {
void audio_init() {
/* check signature */
if (!eeconfig_is_enabled()) {
@ -264,8 +211,76 @@ void init_notes() {
TCCR3A = (0 << COM3A1) | (0 << COM3A0) | (1 << WGM31) | (0 << WGM30);
TCCR3B = (1 << WGM33) | (1 << WGM32) | (0 << CS32) | (1 << CS31) | (0 << CS30);
#endif
inited = true;
_delay_ms(500);
}
void stop_all_notes() {
if (!inited) {
audio_init();
}
voices = 0;
#ifdef PWM_AUDIO
TIMSK3 &= ~_BV(OCIE3A);
#else
TIMSK3 &= ~_BV(OCIE3A);
TCCR3A &= ~_BV(COM3A1);
#endif
notes = false;
note = false;
frequency = 0;
volume = 0;
for (int i = 0; i < 8; i++) {
frequencies[i] = 0;
volumes[i] = 0;
}
}
void stop_note(float freq) {
if (note) {
if (!inited) {
audio_init();
}
#ifdef PWM_AUDIO
freq = freq / SAMPLE_RATE;
#endif
for (int i = 7; i >= 0; i--) {
if (frequencies[i] == freq) {
frequencies[i] = 0;
volumes[i] = 0;
for (int j = i; (j < 7); j++) {
frequencies[j] = frequencies[j+1];
frequencies[j+1] = 0;
volumes[j] = volumes[j+1];
volumes[j+1] = 0;
}
break;
}
}
voices--;
if (voices < 0)
voices = 0;
if (voice_place >= voices) {
voice_place = 0;
}
if (voices == 0) {
#ifdef PWM_AUDIO
TIMSK3 &= ~_BV(OCIE3A);
#else
TIMSK3 &= ~_BV(OCIE3A);
TCCR3A &= ~_BV(COM3A1);
#endif
frequency = 0;
volume = 0;
note = false;
}
}
}
#ifdef VIBRATO_ENABLE
float mod(float a, int b)
{
float r = fmod(a, b);
@ -282,6 +297,8 @@ float vibrato(float average_freq) {
return vibrated_freq;
}
#endif
ISR(TIMER3_COMPA_vect) {
if (note) {
#ifdef PWM_AUDIO
@ -333,6 +350,7 @@ ISR(TIMER3_COMPA_vect) {
}
#else
if (voices > 0) {
float freq;
if (polyphony_rate > 0) {
if (voices > 1) {
voice_place %= voices;
@ -341,9 +359,13 @@ ISR(TIMER3_COMPA_vect) {
place = 0.0;
}
}
#ifdef VIBRATO_ENABLE
if (vibrato_strength > 0) {
freq = vibrato(frequencies[voice_place]);
} else {
#else
{
#endif
freq = frequencies[voice_place];
}
} else {
@ -355,9 +377,14 @@ ISR(TIMER3_COMPA_vect) {
frequency = frequencies[voices - 1];
}
#ifdef VIBRATO_ENABLE
if (vibrato_strength > 0) {
freq = vibrato(frequency);
} else {
#else
{
#endif
freq = frequency;
}
}
@ -390,9 +417,13 @@ ISR(TIMER3_COMPA_vect) {
if (note_frequency > 0) {
float freq;
#ifdef VIBRATO_ENABLE
if (vibrato_strength > 0) {
freq = vibrato(note_frequency);
} else {
#else
{
#endif
freq = note_frequency;
}
@ -453,10 +484,45 @@ ISR(TIMER3_COMPA_vect) {
}
}
void play_notes(float (*np)[][2], uint8_t n_count, bool n_repeat, float n_rest) {
void play_note(float freq, int vol) {
if (!inited) {
audio_init();
}
if (audio_config.enable && voices < 8) {
TIMSK3 &= ~_BV(OCIE3A);
// Cancel notes if notes are playing
if (notes)
stop_all_notes();
note = true;
#ifdef PWM_AUDIO
freq = freq / SAMPLE_RATE;
#endif
if (freq > 0) {
frequencies[voices] = freq;
volumes[voices] = vol;
voices++;
}
#ifdef PWM_AUDIO
TIMSK3 |= _BV(OCIE3A);
#else
TIMSK3 |= _BV(OCIE3A);
TCCR3A |= _BV(COM3A1);
#endif
}
}
void play_notes(float (*np)[][2], uint16_t n_count, bool n_repeat, float n_rest) {
if (!inited) {
audio_init();
}
if (audio_config.enable) {
cli();
TIMSK3 &= ~_BV(OCIE3A);
// Cancel note if a note is playing
if (note)
stop_all_notes();
@ -485,57 +551,28 @@ if (audio_config.enable) {
TIMSK3 |= _BV(OCIE3A);
TCCR3A |= _BV(COM3A1);
#endif
sei();
}
}
#ifdef PWM_AUDIO
void play_sample(uint8_t * s, uint16_t l, bool r) {
if (audio_config.enable) {
stop_all_notes();
place_int = 0;
sample = s;
sample_length = l;
repeat = r;
#ifdef PWM_AUDIO
TIMSK3 |= _BV(OCIE3A);
#else
#endif
}
}
void play_note(double freq, int vol) {
if (audio_config.enable && voices < 8) {
cli();
// Cancel notes if notes are playing
if (notes)
stop_all_notes();
note = true;
#ifdef PWM_AUDIO
freq = freq / SAMPLE_RATE;
#endif
if (freq > 0) {
frequencies[voices] = freq;
volumes[voices] = vol;
voices++;
if (!inited) {
audio_init();
}
#ifdef PWM_AUDIO
TIMSK3 |= _BV(OCIE3A);
#else
TIMSK3 |= _BV(OCIE3A);
TCCR3A |= _BV(COM3A1);
#endif
sei();
}
if (audio_config.enable) {
TIMSK3 &= ~_BV(OCIE3A);
stop_all_notes();
place_int = 0;
sample = s;
sample_length = l;
repeat = r;
TIMSK3 |= _BV(OCIE3A);
}
}
#endif
//------------------------------------------------------------------------------
// Override these functions in your keymap file to play different tunes on
@ -545,8 +582,11 @@ void play_startup_tone()
{
}
__attribute__ ((weak))
void play_goodbye_tone()
{
}
//------------------------------------------------------------------------------

View file

@ -8,6 +8,11 @@
#ifndef AUDIO_H
#define AUDIO_H
// Largely untested PWM audio mode (doesn't sound as good)
// #define PWM_AUDIO
// #define VIBRATO_ENABLE
// Enable vibrato strength/amplitude - slows down ISR too much
// #define VIBRATO_STRENGTH_ENABLE
@ -25,6 +30,8 @@ void audio_off(void);
// Vibrato rate functions
#ifdef VIBRATO_ENABLE
void set_vibrato_rate(float rate);
void increase_vibrato_rate(float change);
void decrease_vibrato_rate(float change);
@ -37,6 +44,8 @@ void decrease_vibrato_strength(float change);
#endif
#endif
// Polyphony functions
void set_polyphony_rate(float rate);
@ -51,12 +60,15 @@ void set_tempo(float tempo);
void increase_tempo(uint8_t tempo_change);
void decrease_tempo(uint8_t tempo_change);
void audio_init();
#ifdef PWM_AUDIO
void play_sample(uint8_t * s, uint16_t l, bool r);
void play_note(double freq, int vol);
void stop_note(double freq);
#endif
void play_note(float freq, int vol);
void stop_note(float freq);
void stop_all_notes(void);
void init_notes(void);
void play_notes(float (*np)[][2], uint8_t n_count, bool n_repeat, float n_rest);
void play_notes(float (*np)[][2], uint16_t n_count, bool n_repeat, float n_rest);
#define SCALE (int []){ 0 + (12*0), 2 + (12*0), 4 + (12*0), 5 + (12*0), 7 + (12*0), 9 + (12*0), 11 + (12*0), \
0 + (12*1), 2 + (12*1), 4 + (12*1), 5 + (12*1), 7 + (12*1), 9 + (12*1), 11 + (12*1), \
@ -67,7 +79,7 @@ void play_notes(float (*np)[][2], uint8_t n_count, bool n_repeat, float n_rest);
// These macros are used to allow play_notes to play an array of indeterminate
// length. This works around the limitation of C's sizeof operation on pointers.
// The global float array for the song must be used here.
#define NOTE_ARRAY_SIZE(x) ((int)(sizeof(x) / (sizeof(x[0]))))
#define NOTE_ARRAY_SIZE(x) ((int16_t)(sizeof(x) / (sizeof(x[0]))))
#define PLAY_NOTE_ARRAY(note_array, note_repeat, note_rest_style) play_notes(&note_array, NOTE_ARRAY_SIZE((note_array)), (note_repeat), (note_rest_style));
void play_goodbye_tone(void);

View file

@ -2,107 +2,27 @@
#include <avr/interrupt.h>
#include <avr/pgmspace.h>
#define VIBRATO_LUT_LENGTH 100
#define VIBRATO_LUT_LENGTH 20
const float VIBRATO_LUT[VIBRATO_LUT_LENGTH] = { \
1.00045346811453,
1.00090535101508,
1.00135386178926,
1.00179722447259,
1.00223368114872,
1.0026614990145,
1.00307897737994,
1.00348445457284,
1.00387631471807,
1.00425299436105,
1.00461298890553,
1.00495485883603,
1.00527723569589,
1.00557882779254,
1.00585842560279,
1.00611490685176,
1.00634724124066,
1.00655449479987,
1.00673583384565,
1.00689052852052,
1.00701795589922,
1.00711760264454,
1.0071890671992,
1.00723206150266,
1.0072464122237,
1.00723206150266,
1.0071890671992,
1.00711760264454,
1.00701795589922,
1.00689052852052,
1.00673583384565,
1.00655449479987,
1.00634724124066,
1.00611490685176,
1.00585842560279,
1.00557882779254,
1.00527723569589,
1.00495485883603,
1.00461298890553,
1.00425299436105,
1.00387631471807,
1.00348445457284,
1.00307897737994,
1.0026614990145,
1.00223368114872,
1.00179722447259,
1.00135386178926,
1.00090535101508,
1.00045346811453,
1,
0.999546737425598,
0.999095467903976,
0.998647968674285,
0.998205999748565,
0.99777129706302,
0.997345565759612,
0.996930473622346,
0.996527644691494,
0.996138653077835,
0.99576501699778,
0.995408193048995,
0.995069570744927,
0.994750467325326,
0.994452122858643,
0.994175695650927,
0.993922257974591,
0.99369279212925,
0.993488186845591,
0.993309234042139,
0.993156625943589,
0.993030952568311,
0.99293269959154,
0.992862246589715,
0.992819865670409,
0.992805720491269,
0.992819865670409,
0.992862246589715,
0.99293269959154,
0.993030952568311,
0.993156625943589,
0.993309234042139,
0.993488186845591,
0.99369279212925,
0.993922257974591,
0.994175695650927,
0.994452122858643,
0.994750467325326,
0.995069570744927,
0.995408193048995,
0.99576501699778,
0.996138653077835,
0.996527644691494,
0.996930473622346,
0.997345565759612,
0.99777129706302,
0.998205999748565,
0.998647968674285,
0.999095467903976,
0.999546737425598,
1
};