This commit is contained in:
cbbrowne 2016-09-07 13:09:14 -04:00
commit 73fdd8a769
51 changed files with 2844 additions and 821 deletions

View File

@ -148,6 +148,11 @@ ifeq ($(strip $(AUDIO_ENABLE)), yes)
SRC += $(QUANTUM_DIR)/audio/luts.c SRC += $(QUANTUM_DIR)/audio/luts.c
endif endif
ifeq ($(strip $(UCIS_ENABLE)), yes)
OPT_DEFS += -DUCIS_ENABLE
UNICODE_ENABLE = yes
endif
ifeq ($(strip $(UNICODE_ENABLE)), yes) ifeq ($(strip $(UNICODE_ENABLE)), yes)
OPT_DEFS += -DUNICODE_ENABLE OPT_DEFS += -DUNICODE_ENABLE
SRC += $(QUANTUM_DIR)/process_keycode/process_unicode.c SRC += $(QUANTUM_DIR)/process_keycode/process_unicode.c

View File

@ -1,22 +1,23 @@
BOOTMAGIC_ENABLE=no BOOTMAGIC_ENABLE=no
COMMAND_ENABLE=no COMMAND_ENABLE=no
SLEEP_LED_ENABLE=no SLEEP_LED_ENABLE=no
UNICODE_ENABLE=no
FORCE_NKRO ?= yes FORCE_NKRO ?= yes
DEBUG_ENABLE = no DEBUG_ENABLE = no
CONSOLE_ENABLE = no CONSOLE_ENABLE = no
TAP_DANCE_ENABLE = yes TAP_DANCE_ENABLE = yes
KEYLOGGER_ENABLE ?= yes KEYLOGGER_ENABLE ?= yes
UCIS_ENABLE = yes
MOUSEKEY_ENABLE ?= yes
ADORE_AUTOLOG ?= no AUTOLOG_ENABLE ?= no
ifeq (${FORCE_NKRO},yes) ifeq (${FORCE_NKRO},yes)
OPT_DEFS += -DFORCE_NKRO OPT_DEFS += -DFORCE_NKRO
endif endif
ifeq (${ADORE_AUTOLOG},yes) ifeq (${AUTOLOG_ENABLE},yes)
KEYLOGGER_ENABLE = yes KEYLOGGER_ENABLE = yes
OPT_DEFS += -DADORE_AUTOLOG OPT_DEFS += -DAUTOLOG_ENABLE
endif endif
ifeq (${KEYLOGGER_ENABLE},yes) ifeq (${KEYLOGGER_ENABLE},yes)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 92 KiB

After

Width:  |  Height:  |  Size: 92 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 93 KiB

After

Width:  |  Height:  |  Size: 93 KiB

View File

@ -2,6 +2,7 @@
* algernon's ErgoDox EZ layout, please see the readme.md file! * algernon's ErgoDox EZ layout, please see the readme.md file!
*/ */
#include <stdarg.h>
#include "ergodox.h" #include "ergodox.h"
#include "led.h" #include "led.h"
#include "debug.h" #include "debug.h"
@ -33,7 +34,6 @@ enum {
// Buttons that do extra stuff // Buttons that do extra stuff
A_GUI, A_GUI,
A_PLVR, A_PLVR,
A_ESC,
A_MPN, A_MPN,
// Function / number keys // Function / number keys
@ -47,7 +47,6 @@ enum {
KF_8, KF_8,
KF_9, KF_9,
KF_10, KF_10,
KF_11, // =, F11
// Application select keys // Application select keys
APP_SLK, // Slack APP_SLK, // Slack
@ -62,6 +61,11 @@ enum {
A_MDL, A_MDL,
A_MDR, A_MDR,
// Mouse acceleration
A_ACL0,
A_ACL1,
A_ACL2,
// Hungarian layer keys // Hungarian layer keys
HU_AA, // Á HU_AA, // Á
HU_OO, // Ó HU_OO, // Ó
@ -89,7 +93,6 @@ enum {
enum { enum {
CT_CLN = 0, CT_CLN = 0,
CT_MNS,
CT_TA, CT_TA,
CT_LBP, CT_LBP,
CT_RBP CT_RBP
@ -102,7 +105,11 @@ uint16_t gui_timer = 0;
uint16_t kf_timers[12]; uint16_t kf_timers[12];
#if KEYLOGGER_ENABLE #if KEYLOGGER_ENABLE
# ifdef AUTOLOG_ENABLE
bool log_enable = true;
# else
bool log_enable = false; bool log_enable = false;
# endif
#endif #endif
bool time_travel = false; bool time_travel = false;
@ -114,12 +121,12 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Keymap 0: Base Layer /* Keymap 0: Base Layer
* *
* ,-----------------------------------------------------. ,-----------------------------------------------------. * ,-----------------------------------------------------. ,-----------------------------------------------------.
* | Next/Prev | 1 F1 | 2 F2 | 3 F3 | 4 F4 | 5 F5 | Plvr | | Apps | 6 F6 | 7 F7 | 8 F8 | 9 F9 | 0 F10| F11 | * | Next/Prev | 1 F1 | 2 F2 | 3 F3 | 4 F4 | 5 F5 | Plvr | | F12 | 6 F6 | 7 F7 | 8 F8 | 9 F9 | 0 F10| F11 |
* |-----------+------+------+------+------+-------------| |------+------+------+------+------+------+-----------| * |-----------+------+------+------+------+-------------| |------+------+------+------+------+------+-----------|
* | ~ | ' | , | . | P | Y | [ | | ] | F | G | C | R | L | \ | * | ~ | ' | , | . | P | Y | ( | | ) | F | G | C | R | L | \ |
* |-----------+------+------+------+------+------| | | |------+------+------+------+------+-----------| * |-----------+------+------+------+------+------| [ | | ] |------+------+------+------+------+-----------|
* | Tab/ARROW | A | O | E | U | I |------| |------| D | H | T | N | S | = / Arrow | * | Tab/ARROW | A | O | E | U | I |------| |------| D | H | T | N | S | = / Arrow |
* |-----------+------+------+------+------+------| ( | | ) |------+------+------+------+------+-----------| * |-----------+------+------+------+------+------| : | | - |------+------+------+------+------+-----------|
* | Play/Pause| / | Q | J | K | X | | | | B | M | W | V | Z | Stop | * | Play/Pause| / | Q | J | K | X | | | | B | M | W | V | Z | Stop |
* `-----------+------+------+------+------+-------------' `-------------+------+------+------+------+-----------' * `-----------+------+------+------+------+-------------' `-------------+------+------+------+------+-----------'
* | | | | | : | | - | | | | | * | | | | | : | | - | | | | |
@ -135,21 +142,21 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[BASE] = KEYMAP( [BASE] = KEYMAP(
// left hand // left hand
M(A_MPN) ,M(KF_1) ,M(KF_2) ,M(KF_3),M(KF_4),M(KF_5),M(A_PLVR) M(A_MPN) ,M(KF_1) ,M(KF_2) ,M(KF_3),M(KF_4),M(KF_5),M(A_PLVR)
,KC_GRV ,KC_QUOT ,KC_COMM ,KC_DOT ,KC_P ,KC_Y ,KC_LBRC ,KC_GRV ,KC_QUOT ,KC_COMM ,KC_DOT ,KC_P ,KC_Y ,TD(CT_LBP)
,TD(CT_TA) ,KC_A ,KC_O ,KC_E ,KC_U ,KC_I ,TD(CT_TA) ,KC_A ,KC_O ,KC_E ,KC_U ,KC_I
,KC_MPLY ,KC_SLSH ,KC_Q ,KC_J ,KC_K ,KC_X ,KC_LPRN ,KC_MPLY ,KC_SLSH ,KC_Q ,KC_J ,KC_K ,KC_X ,TD(CT_CLN)
,KC_NO ,KC_NO ,KC_NO ,KC_NO ,TD(CT_CLN) ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,TD(CT_CLN)
,F(F_ALT),F(F_GUI) ,F(F_ALT),F(F_GUI)
,F(F_CTRL) ,F(F_CTRL)
,KC_BSPC,F(F_SFT),M(A_ESC) ,KC_BSPC,F(F_SFT),KC_ESC
// right hand // right hand
,KC_APP ,M(KF_6),M(KF_7) ,M(KF_8),M(KF_9) ,M(KF_10) ,KC_F11 ,KC_F12 ,M(KF_6),M(KF_7) ,M(KF_8),M(KF_9) ,M(KF_10) ,KC_F11
,KC_RBRC ,KC_F ,KC_G ,KC_C ,KC_R ,KC_L ,KC_BSLS ,TD(CT_RBP),KC_F ,KC_G ,KC_C ,KC_R ,KC_L ,KC_BSLS
,KC_D ,KC_H ,KC_T ,KC_N ,KC_S ,KC_EQL ,KC_D ,KC_H ,KC_T ,KC_N ,KC_S ,KC_EQL
,KC_RPRN ,KC_B ,KC_M ,KC_W ,KC_V ,KC_Z ,KC_MSTP ,KC_MINS ,KC_B ,KC_M ,KC_W ,KC_V ,KC_Z ,KC_MSTP
,TD(CT_MNS),KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_MINS ,KC_NO ,KC_NO ,KC_NO ,KC_NO
,OSL(NMDIA),KC_DEL ,OSL(NMDIA),KC_DEL
,KC_LEAD ,KC_LEAD
@ -159,13 +166,13 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Keymap 1: Adore layer /* Keymap 1: Adore layer
* *
* ,-----------------------------------------------------. ,-----------------------------------------------------. * ,-----------------------------------------------------. ,-----------------------------------------------------.
* | Play/Pause| 1 F1 | 2 F2 | 3 F3 | 4 F4 | 5 F5 | Plvr | | Apps | 6 F6 | 7 F7 | 8 F8 | 9 F9 | 0 F10| F11 | * | Play/Pause| 1 F1 | 2 F2 | 3 F3 | 4 F4 | 5 F5 | Plvr | | F12 | 6 F6 | 7 F7 | 8 F8 | 9 F9 | 0 F10| F11 |
* |-----------+------+------+------+------+-------------| |------+------+------+------+------+------+-----------| * |-----------+------+------+------+------+-------------| |------+------+------+------+------+------+-----------|
* | `~ | X | W | K | L | M | ( | | ) | F | H | C | P | Y | \ | * | `~ | Y | W | G | L | M | ( | | ) | F | H | C | P | X | \ |
* |-----------+------+------+------+------+------| [ | | ] |------+------+------+------+------+-----------| * |-----------+------+------+------+------+------| [ | | ] |------+------+------+------+------+-----------|
* | Tab/Arrow | A | O | E | I | U |------| |------| D | R | T | N | S | = | * | Tab/Arrow | A | O | E | I | U |------| |------| D | R | T | N | S | = |
* |-----------+------+------+------+------+------| | | |------+------+------+------+------+-----------| * |-----------+------+------+------+------+------| | | |------+------+------+------+------+-----------|
* | | Z | Q | ' | , | . | : | | - | B | G | V | J | / | | * | | Z | Q | ' | , | . | : | | - | B | K | V | J | / | |
* `-----------+------+------+------+------+-------------' `-------------+------+------+------+------+-----------' * `-----------+------+------+------+------+-------------' `-------------+------+------+------+------+-----------'
* | | | | | | | | | | | | * | | | | | | | | | | | |
* `-----------------------------------' `-----------------------------------' * `-----------------------------------' `-----------------------------------'
@ -180,20 +187,20 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[ADORE] = KEYMAP( [ADORE] = KEYMAP(
// left hand // left hand
KC_MPLY ,M(KF_1) ,M(KF_2) ,M(KF_3),M(KF_4),M(KF_5),M(A_PLVR) KC_MPLY ,M(KF_1) ,M(KF_2) ,M(KF_3),M(KF_4),M(KF_5),M(A_PLVR)
,KC_GRV ,KC_X ,KC_W ,KC_K ,KC_L ,KC_M ,TD(CT_LBP) ,KC_GRV ,KC_Y ,KC_W ,KC_G ,KC_L ,KC_M ,TD(CT_LBP)
,TD(CT_TA) ,KC_A ,KC_O ,KC_E ,KC_I ,KC_U ,TD(CT_TA) ,KC_A ,KC_O ,KC_E ,KC_I ,KC_U
,KC_NO ,KC_Z ,KC_Q ,KC_QUOT,KC_COMM,KC_DOT ,TD(CT_CLN) ,KC_NO ,KC_Z ,KC_Q ,KC_QUOT,KC_COMM,KC_DOT ,TD(CT_CLN)
,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO
,F(F_ALT),F(F_GUI) ,F(F_ALT),F(F_GUI)
,F(F_CTRL) ,F(F_CTRL)
,KC_BSPC,F(F_SFT),M(A_ESC) ,KC_BSPC,F(F_SFT),KC_ESC
// right hand // right hand
,KC_APP ,M(KF_6),M(KF_7),M(KF_8),M(KF_9) ,M(KF_10) ,KC_F11 ,KC_F12 ,M(KF_6),M(KF_7),M(KF_8),M(KF_9) ,M(KF_10) ,KC_F11
,TD(CT_RBP),KC_F ,KC_H ,KC_C ,KC_P ,KC_Y ,KC_BSLS ,TD(CT_RBP),KC_F ,KC_H ,KC_C ,KC_P ,KC_X ,KC_BSLS
,KC_D ,KC_R ,KC_T ,KC_N ,KC_S ,KC_EQL ,KC_D ,KC_R ,KC_T ,KC_N ,KC_S ,KC_EQL
,TD(CT_MNS),KC_B ,KC_G ,KC_V ,KC_J ,KC_SLSH ,KC_NO ,KC_MINS ,KC_B ,KC_K ,KC_V ,KC_J ,KC_SLSH ,KC_NO
,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO
,OSL(NMDIA),KC_DEL ,OSL(NMDIA),KC_DEL
@ -363,14 +370,14 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
*/ */
[NMDIA] = KEYMAP( [NMDIA] = KEYMAP(
// left hand // left hand
KC_ACL0 ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,LGUI(KC_L) M(A_ACL0) ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,LGUI(KC_L)
,KC_ACL1 ,KC_NO ,KC_HOME ,KC_UP ,KC_PGUP ,KC_NO ,KC_NO ,M(A_ACL1) ,KC_NO ,KC_HOME ,KC_UP ,KC_PGUP ,KC_NO ,KC_NO
,KC_ACL2 ,KC_NO ,KC_LEFT ,KC_DOWN ,KC_RIGHT,KC_NO ,M(A_ACL2) ,KC_NO ,KC_LEFT ,KC_DOWN ,KC_RIGHT,KC_NO
,KC_MPLY ,KC_NO ,KC_END ,KC_DOWN ,KC_PGDN ,KC_NO ,KC_NO ,KC_MPLY ,KC_NO ,KC_END ,KC_DOWN ,KC_PGDN ,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_MUTE ,KC_VOLU ,KC_MUTE ,KC_VOLU
,KC_VOLD ,KC_VOLD
,KC_SPC,KC_ENTER,M(A_ESC) ,KC_SPC,KC_ENTER,KC_ESC
// right hand // right hand
,LGUI(KC_L),KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,LGUI(KC_L),KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO
@ -439,7 +446,7 @@ const uint16_t PROGMEM fn_actions[] = {
,[F_CTRL] = ACTION_MODS_ONESHOT (MOD_LCTL) ,[F_CTRL] = ACTION_MODS_ONESHOT (MOD_LCTL)
}; };
void toggle_steno(int pressed) static void toggle_steno(int pressed)
{ {
uint8_t layer = biton32(layer_state); uint8_t layer = biton32(layer_state);
@ -462,7 +469,7 @@ void toggle_steno(int pressed)
} }
} }
macro_t *ang_do_hun (keyrecord_t *record, uint16_t accent, uint16_t hun_char) static macro_t *ang_do_hun (keyrecord_t *record, uint16_t accent, uint16_t hun_char)
{ {
uint8_t need_shift = 0; uint8_t need_shift = 0;
uint8_t hold_shift = 0; uint8_t hold_shift = 0;
@ -507,46 +514,43 @@ macro_t *ang_do_hun (keyrecord_t *record, uint16_t accent, uint16_t hun_char)
return MACRO_NONE; return MACRO_NONE;
} }
void ang_handle_kf (keyrecord_t *record, uint8_t id) static bool from_appsel;
static void ang_handle_kf (keyrecord_t *record, uint8_t id)
{ {
uint8_t code = id - KF_1; uint8_t code = id - KF_1;
if (record->event.pressed) { if (record->event.pressed) {
kf_timers[code] = timer_read (); kf_timers[code] = timer_read ();
} else { } else {
uint8_t kc; uint8_t kc_base;
if (timer_elapsed (kf_timers[code]) > TAPPING_TERM) { if (from_appsel) {
// Long press from_appsel = false;
kc = KC_F1 + code; return;
} else {
if (id == KF_11)
kc = KC_EQL;
else
kc = KC_1 + code;
} }
register_code (kc); if (kf_timers[code] && timer_elapsed (kf_timers[code]) > TAPPING_TERM) {
unregister_code (kc); // Long press
kc_base = KC_F1;
} else {
kc_base = KC_1;
}
kf_timers[code] = 0;
code += kc_base;
register_code (code);
unregister_code (code);
} }
} }
static struct {
uint8_t idx;
} m_accel_state;
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
{ {
switch(id) { switch(id) {
case A_ESC:
if (record->event.pressed) {
if ((get_oneshot_mods ()) && !has_oneshot_mods_timed_out ()) {
clear_oneshot_mods ();
} else {
register_code (KC_ESC);
}
layer_off (HUN);
} else {
unregister_code (KC_ESC);
}
break;
case A_MPN: case A_MPN:
if (record->event.pressed) { if (record->event.pressed) {
if (keyboard_report->mods & MOD_BIT(KC_LSFT) || if (keyboard_report->mods & MOD_BIT(KC_LSFT) ||
@ -588,6 +592,7 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
case HU_UEE: case HU_UEE:
return ang_do_hun (record, KC_EQL, KC_U); return ang_do_hun (record, KC_EQL, KC_U);
#if MOUSEKEY_ENABLE
/* Mouse movement */ /* Mouse movement */
case A_MUL: case A_MUL:
if (record->event.pressed) { if (record->event.pressed) {
@ -633,6 +638,24 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
mousekey_send(); mousekey_send();
break; break;
case A_ACL0 ... A_ACL2:
if (record->event.pressed) {
uint8_t idx = id - A_ACL0;
if (m_accel_state.idx == id) {
mousekey_off(m_accel_state.idx - A_ACL0 + KC_ACL0);
m_accel_state.idx = 0;
} else {
if (m_accel_state.idx) {
mousekey_off(m_accel_state.idx - A_ACL0 + KC_ACL0);
m_accel_state.idx = 0;
}
mousekey_on(KC_ACL0 + idx);
m_accel_state.idx = id;
}
}
break;
#endif
/* Plover base */ /* Plover base */
case A_PLVR: case A_PLVR:
toggle_steno(record->event.pressed); toggle_steno(record->event.pressed);
@ -663,22 +686,34 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
break; break;
case APP_SLK: case APP_SLK:
from_appsel = true;
return MACRODOWN(T(S), T(L), T(A), T(C), T(K), T(ENT), END); return MACRODOWN(T(S), T(L), T(A), T(C), T(K), T(ENT), END);
case APP_EMCS: case APP_EMCS:
from_appsel = true;
return MACRODOWN(T(G), T(N), T(U), T(SPC), T(E), T(M), T(A), T(C), T(S), T(SPC), T(2), T(4), T(ENT), END); return MACRODOWN(T(G), T(N), T(U), T(SPC), T(E), T(M), T(A), T(C), T(S), T(SPC), T(2), T(4), T(ENT), END);
case APP_TERM: case APP_TERM:
return MACRODOWN(T(T), T(E), T(R), T(M), T(ENT), END); from_appsel = true;
if (!record->event.pressed) {
register_code(KC_ESC);
unregister_code(KC_ESC);
wait_ms(TAPPING_TERM + 25);
register_code(KC_DEL);
unregister_code(KC_DEL);
}
break;
case APP_CHRM: case APP_CHRM:
from_appsel = true;
return MACRODOWN(T(C), T(H), T(R), T(O), T(M), T(ENT), END); return MACRODOWN(T(C), T(H), T(R), T(O), T(M), T(ENT), END);
case APP_MSIC: case APP_MSIC:
from_appsel = true;
return MACRODOWN(T(R), T(H), T(Y), T(T), T(H), T(M), T(B), T(O), T(X), T(ENT), END); return MACRODOWN(T(R), T(H), T(Y), T(T), T(H), T(M), T(B), T(O), T(X), T(ENT), END);
/* Function keys */ /* Function keys */
case KF_1 ... KF_11: case KF_1 ... KF_10:
ang_handle_kf (record, id); ang_handle_kf (record, id);
break; break;
} }
@ -686,12 +721,14 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
return MACRO_NONE; return MACRO_NONE;
}; };
uint8_t is_adore = 0; static uint8_t is_adore = 0;
// Runs just one time when the keyboard initializes. // Runs just one time when the keyboard initializes.
void matrix_init_user(void) { void matrix_init_user(void) {
uint8_t dl; uint8_t dl;
set_unicode_input_mode(UC_LNX);
ergodox_led_all_on(); ergodox_led_all_on();
for (int i = LED_BRIGHTNESS_HI; i > LED_BRIGHTNESS_LO; i--) { for (int i = LED_BRIGHTNESS_HI; i > LED_BRIGHTNESS_LO; i--) {
ergodox_led_all_set (i); ergodox_led_all_set (i);
@ -709,120 +746,38 @@ void matrix_init_user(void) {
dl = eeconfig_read_default_layer (); dl = eeconfig_read_default_layer ();
if (dl == (1UL << ADORE)) { if (dl == (1UL << ADORE)) {
is_adore = 1; is_adore = 1;
#if ADORE_AUTOLOG
log_enable = true;
#endif
} }
}; };
LEADER_EXTERNS(); LEADER_EXTERNS();
void ang_do_unicode (void) { static void ang_tap (uint8_t code, ...) {
register_code (KC_RCTL); uint8_t kc = code;
register_code (KC_RSFT); va_list ap;
register_code (KC_U);
unregister_code (KC_U);
unregister_code (KC_RSFT);
unregister_code (KC_RCTL);
wait_ms (100);
}
void ang_tap (uint16_t codes[]) { va_start(ap, code);
for (int i = 0; codes[i] != 0; i++) {
register_code (codes[i]); do {
unregister_code (codes[i]); register_code(kc);
wait_ms (50); unregister_code(kc);
} wait_ms(50);
kc = va_arg(ap, int);
} while (kc != 0);
va_end(ap);
} }
#define TAP_ONCE(code) \ #define TAP_ONCE(code) \
register_code (code); \ register_code (code); \
unregister_code (code) unregister_code (code)
void ang_tap_dance_bp_finished (qk_tap_dance_state_t *state, void *user_data) {
bool left, parens;
if (state->count > 2) {
state->count = 0;
return;
}
if (state->keycode == TD(CT_LBP))
left = true;
else
left = false;
if (state->count == 1)
parens = false;
else
parens = true;
if (parens) {
register_code (KC_RSFT);
if (left) {
TAP_ONCE(KC_9);
} else {
TAP_ONCE(KC_0);
}
unregister_code (KC_RSFT);
} else {
if (left) {
TAP_ONCE (KC_LBRC);
} else {
TAP_ONCE (KC_RBRC);
}
}
}
void ang_tap_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 if (state->count == 2) {
register_code (KC_SCLN);
}
}
void ang_tap_dance_cln_reset (qk_tap_dance_state_t *state, void *user_data) {
if (state->count == 1) {
unregister_code (KC_SCLN);
unregister_code (KC_RSFT);
} else if (state->count == 2) {
unregister_code (KC_SCLN);
}
}
void ang_tap_dance_mns_finished (qk_tap_dance_state_t *state, void *user_data) {
if (state->count == 1) {
register_code (KC_MINS);
} else if (state->count == 2) {
register_code (KC_RSFT);
register_code (KC_MINS);
}
}
void ang_tap_dance_mns_reset (qk_tap_dance_state_t *state, void *user_data) {
if (state->count == 1) {
unregister_code (KC_MINS);
} else if (state->count == 2) {
unregister_code (KC_RSFT);
unregister_code (KC_MINS);
}
}
typedef struct { typedef struct {
bool layer_toggle; bool layer_toggle;
bool sticky; bool sticky;
bool finished_once;
} td_ta_state_t; } td_ta_state_t;
void ang_tap_dance_ta_finished (qk_tap_dance_state_t *state, void *user_data) { static void ang_tap_dance_ta_finished (qk_tap_dance_state_t *state, void *user_data) {
td_ta_state_t *td_ta = (td_ta_state_t *) user_data; td_ta_state_t *td_ta = (td_ta_state_t *) user_data;
if (td_ta->finished_once) {
return;
}
if (td_ta->sticky) { if (td_ta->sticky) {
td_ta->sticky = false; td_ta->sticky = false;
td_ta->layer_toggle = false; td_ta->layer_toggle = false;
@ -830,7 +785,6 @@ void ang_tap_dance_ta_finished (qk_tap_dance_state_t *state, void *user_data) {
return; return;
} }
td_ta->finished_once = true;
if (state->count == 1 && !state->pressed) { if (state->count == 1 && !state->pressed) {
register_code (KC_TAB); register_code (KC_TAB);
td_ta->sticky = false; td_ta->sticky = false;
@ -842,35 +796,29 @@ void ang_tap_dance_ta_finished (qk_tap_dance_state_t *state, void *user_data) {
} }
} }
void ang_tap_dance_ta_reset (qk_tap_dance_state_t *state, void *user_data) { static void ang_tap_dance_ta_reset (qk_tap_dance_state_t *state, void *user_data) {
td_ta_state_t *td_ta = (td_ta_state_t *) user_data; td_ta_state_t *td_ta = (td_ta_state_t *) user_data;
if (!td_ta->layer_toggle) if (!td_ta->layer_toggle)
unregister_code (KC_TAB); unregister_code (KC_TAB);
if (!td_ta->sticky) if (!td_ta->sticky)
layer_off (ARRW); layer_off (ARRW);
td_ta->finished_once = false;
} }
qk_tap_dance_action_t tap_dance_actions[] = { qk_tap_dance_action_t tap_dance_actions[] = {
[CT_CLN] = ACTION_TAP_DANCE_FN_ADVANCED (NULL, ang_tap_dance_cln_finished, ang_tap_dance_cln_reset) [CT_CLN] = ACTION_TAP_DANCE_DOUBLE (KC_COLN, KC_SCLN)
,[CT_MNS] = ACTION_TAP_DANCE_FN_ADVANCED (NULL, ang_tap_dance_mns_finished, ang_tap_dance_mns_reset)
,[CT_TA] = { ,[CT_TA] = {
.fn = { NULL, ang_tap_dance_ta_finished, ang_tap_dance_ta_reset }, .fn = { NULL, ang_tap_dance_ta_finished, ang_tap_dance_ta_reset },
.user_data = (void *)&((td_ta_state_t) { false, false, false }) .user_data = (void *)&((td_ta_state_t) { false, false })
} }
,[CT_LBP] = ACTION_TAP_DANCE_FN (ang_tap_dance_bp_finished) ,[CT_LBP] = ACTION_TAP_DANCE_DOUBLE (KC_LBRC, KC_LPRN)
,[CT_RBP] = ACTION_TAP_DANCE_FN (ang_tap_dance_bp_finished) ,[CT_RBP] = ACTION_TAP_DANCE_DOUBLE (KC_RBRC, KC_RPRN)
}; };
static uint16_t uni[32];
static uint8_t unicnt;
static bool unimagic = false;
// Runs constantly in the background, in a loop. // Runs constantly in the background, in a loop.
void matrix_scan_user(void) { void matrix_scan_user(void) {
uint8_t layer = biton32(layer_state); uint8_t layer = biton32(layer_state);
bool is_arrow = false;
if (gui_timer && timer_elapsed (gui_timer) > TAPPING_TERM) if (gui_timer && timer_elapsed (gui_timer) > TAPPING_TERM)
unregister_code (KC_LGUI); unregister_code (KC_LGUI);
@ -893,13 +841,19 @@ void matrix_scan_user(void) {
ergodox_right_led_2_set (LED_BRIGHTNESS_HI); ergodox_right_led_2_set (LED_BRIGHTNESS_HI);
} }
if (layer_state & (1UL << ARRW)) {
ergodox_right_led_1_on ();
ergodox_right_led_3_on ();
is_arrow = true;
}
if (keyboard_report->mods & MOD_BIT(KC_LSFT) || if (keyboard_report->mods & MOD_BIT(KC_LSFT) ||
((get_oneshot_mods() & MOD_BIT(KC_LSFT)) && !has_oneshot_mods_timed_out())) { ((get_oneshot_mods() & MOD_BIT(KC_LSFT)) && !has_oneshot_mods_timed_out())) {
ergodox_right_led_1_set (LED_BRIGHTNESS_HI); ergodox_right_led_1_set (LED_BRIGHTNESS_HI);
ergodox_right_led_1_on (); ergodox_right_led_1_on ();
} else { } else {
ergodox_right_led_1_set (LED_BRIGHTNESS_LO); ergodox_right_led_1_set (LED_BRIGHTNESS_LO);
if (layer != NMDIA && layer != PLVR && layer != ADORE) if (layer != NMDIA && layer != PLVR && layer != ADORE && !is_arrow)
ergodox_right_led_1_off (); ergodox_right_led_1_off ();
} }
@ -919,7 +873,7 @@ void matrix_scan_user(void) {
ergodox_right_led_3_on (); ergodox_right_led_3_on ();
} else { } else {
ergodox_right_led_3_set (LED_BRIGHTNESS_LO); ergodox_right_led_3_set (LED_BRIGHTNESS_LO);
if (layer != HUN && layer != PLVR && layer != ADORE) if (layer != HUN && layer != PLVR && layer != ADORE && !is_arrow)
ergodox_right_led_3_off (); ergodox_right_led_3_off ();
} }
@ -936,20 +890,17 @@ void matrix_scan_user(void) {
} }
#endif #endif
SEQ_ONE_KEY (KC_Q) {
register_code16 (LCTL(KC_1));
unregister_code16 (LCTL(KC_1));
}
SEQ_ONE_KEY (KC_T) { SEQ_ONE_KEY (KC_T) {
time_travel = !time_travel; time_travel = !time_travel;
} }
SEQ_ONE_KEY (KC_U) { SEQ_ONE_KEY (KC_U) {
ang_do_unicode (); qk_ucis_start();
}
SEQ_TWO_KEYS (KC_LEAD, KC_U) {
unicnt = 0;
unimagic = true;
register_code(KC_RSFT);
TAP_ONCE(KC_U);
unregister_code(KC_RSFT);
} }
SEQ_ONE_KEY (KC_V) { SEQ_ONE_KEY (KC_V) {
@ -958,25 +909,23 @@ void matrix_scan_user(void) {
SEQ_ONE_KEY (KC_L) { SEQ_ONE_KEY (KC_L) {
/* λ */ /* λ */
ang_do_unicode (); unicode_input_start();
register_hex(0x03bb);
uint16_t codes[] = {KC_0, KC_3, KC_B, KC_B, KC_ENT, 0}; unicode_input_finish();
ang_tap (codes);
} }
SEQ_ONE_KEY (KC_Y) { SEQ_ONE_KEY (KC_Y) {
uint16_t codes[] = {KC_BSLS, KC_O, KC_SLSH, 0}; ang_tap (KC_BSLS, KC_O, KC_SLSH, 0);
ang_tap (codes);
} }
SEQ_ONE_KEY (KC_S) { SEQ_ONE_KEY (KC_S) {
ang_do_unicode (); TAP_ONCE (KC_A); TAP_ONCE (KC_F); TAP_ONCE (KC_SPC); unicode_input_start(); register_hex(0xaf); unicode_input_finish();
TAP_ONCE (KC_BSLS); TAP_ONCE (KC_BSLS);
register_code (KC_RSFT); TAP_ONCE (KC_MINS); TAP_ONCE (KC_9); unregister_code (KC_RSFT); register_code (KC_RSFT); TAP_ONCE (KC_MINS); TAP_ONCE (KC_9); unregister_code (KC_RSFT);
ang_do_unicode (); TAP_ONCE (KC_3); TAP_ONCE (KC_0); TAP_ONCE (KC_C); TAP_ONCE (KC_4); TAP_ONCE (KC_SPC); unicode_input_start (); register_hex(0x30c4); unicode_input_finish();
register_code (KC_RSFT); TAP_ONCE (KC_0); TAP_ONCE (KC_MINS); unregister_code (KC_RSFT); register_code (KC_RSFT); TAP_ONCE (KC_0); TAP_ONCE (KC_MINS); unregister_code (KC_RSFT);
TAP_ONCE (KC_SLSH); TAP_ONCE (KC_SLSH);
ang_do_unicode (); TAP_ONCE (KC_A); TAP_ONCE (KC_F); TAP_ONCE (KC_SPC); unicode_input_start (); register_hex(0xaf); unicode_input_finish();
} }
SEQ_TWO_KEYS (KC_W, KC_M) { SEQ_TWO_KEYS (KC_W, KC_M) {
@ -987,8 +936,7 @@ void matrix_scan_user(void) {
wait_ms (1000); wait_ms (1000);
uint16_t codes[] = {KC_M, KC_A, KC_X, KC_MINS, KC_F, KC_O, KC_C, KC_U, KC_S, KC_E, KC_D, KC_ENT, 0}; ang_tap (KC_M, KC_A, KC_X, KC_MINS, KC_F, KC_O, KC_C, KC_U, KC_S, KC_E, KC_D, KC_ENT, 0);
ang_tap (codes);
register_code (KC_LGUI); register_code (KC_LGUI);
register_code (KC_UP); register_code (KC_UP);
unregister_code (KC_UP); unregister_code (KC_UP);
@ -1013,13 +961,7 @@ void matrix_scan_user(void) {
ergodox_right_led_2_off (); ergodox_right_led_2_off ();
wait_ms (100); wait_ms (100);
ergodox_right_led_1_off (); ergodox_right_led_1_off ();
#if ADORE_AUTOLOG
log_enable = true;
#endif
} else { } else {
#if ADORE_AUTOLOG
log_enable = false;
#endif
is_adore = 0; is_adore = 0;
default_layer_and (0); default_layer_and (0);
default_layer_or (1UL << BASE); default_layer_or (1UL << BASE);
@ -1043,140 +985,38 @@ void matrix_scan_user(void) {
static uint16_t last4[4]; static uint16_t last4[4];
bool is_uni_seq(char *seq) { const qk_ucis_symbol_t ucis_symbol_table[] = UCIS_TABLE
uint8_t i; (
UCIS_SYM("poop", 0x1f4a9),
for (i = 0; seq[i]; i++) { UCIS_SYM("rofl", 0x1f923),
uint16_t code; UCIS_SYM("kiss", 0x1f619),
if (('1' <= seq[i]) && (seq[i] <= '9')) UCIS_SYM("snowman", 0x2603),
code = seq[i] - '1' + KC_1; UCIS_SYM("coffee", 0x2615),
else if (seq[i] == '0') UCIS_SYM("heart", 0x2764),
code = KC_0; UCIS_SYM("bolt", 0x26a1)
else );
code = seq[i] - 'a' + KC_A;
if (i > unicnt)
return false;
if (uni[i] != code)
return false;
}
if (uni[i] == KC_ENT || uni[i] == KC_SPC)
return true;
return false;
}
uint16_t hex_to_keycode(uint8_t hex)
{
if (hex == 0x0) {
return KC_0;
} else if (hex < 0xA) {
return KC_1 + (hex - 0x1);
} else {
return KC_A + (hex - 0xA);
}
}
void register_hex(uint16_t hex) {
bool leading_zeros = true;
for(int i = 3; i >= 0; i--) {
uint8_t digit = ((hex >> (i*4)) & 0xF);
if (digit != 0)
leading_zeros = false;
else if (leading_zeros)
continue;
register_code(hex_to_keycode(digit));
unregister_code(hex_to_keycode(digit));
wait_ms(10);
}
}
typedef struct {
char *symbol;
uint16_t codes[4];
} qk_ucis_symbol_t;
static qk_ucis_symbol_t ucis_symbol_table[] = {
{"poop", {0x1, 0xf4a9, 0}},
{"rofl", {0x1, 0xf923, 0}},
{"kiss", {0x1, 0xf619, 0}},
{"snowman", {0x2603, 0}},
{NULL, {}}
};
bool process_record_ucis (uint16_t keycode, keyrecord_t *record) {
uint8_t i;
if (!unimagic)
return true;
if (!record->event.pressed)
return true;
uni[unicnt] = keycode;
unicnt++;
if (keycode == KC_BSPC) {
if (unicnt >= 2) {
unicnt-= 2;
return true;
} else {
unicnt--;
return false;
}
}
if (keycode == KC_ENT || keycode == KC_SPC) {
bool symbol_found = false;
for (i = unicnt; i > 0; i--) {
register_code (KC_BSPC);
unregister_code (KC_BSPC);
wait_ms(10);
}
ang_do_unicode();
wait_ms(10);
for (i = 0; ucis_symbol_table[i].symbol; i++) {
if (is_uni_seq (ucis_symbol_table[i].symbol)) {
symbol_found = true;
for (uint8_t j = 0; ucis_symbol_table[i].codes[j]; j++) {
register_hex(ucis_symbol_table[i].codes[j]);
}
break;
}
}
if (!symbol_found) {
for (i = 0; i < unicnt - 1; i++) {
uint8_t code;
if (uni[i] > KF_1)
code = uni[i] - KF_1 + KC_1;
else
code = uni[i];
TAP_ONCE(code);
wait_ms (10);
}
}
unimagic = false;
return true;
}
return true;
}
bool process_record_user (uint16_t keycode, keyrecord_t *record) { bool process_record_user (uint16_t keycode, keyrecord_t *record) {
#if KEYLOGGER_ENABLE #if KEYLOGGER_ENABLE
if (log_enable) { if (log_enable) {
xprintf ("KL: col=%d, row=%d\n", record->event.key.col, xprintf ("KL: col=%02d, row=%02d, pressed=%d, layer=%s\n", record->event.key.col,
record->event.key.row); record->event.key.row, record->event.pressed, (is_adore) ? "ADORE" : "Dvorak");
} }
#endif #endif
if (!process_record_ucis (keycode, record)) if (keycode == KC_ESC && record->event.pressed) {
return false; bool queue = true;
if ((get_oneshot_mods ()) && !has_oneshot_mods_timed_out ()) {
clear_oneshot_mods ();
queue = false;
}
if (layer_state & (1UL<<HUN)) {
layer_off (HUN);
queue = false;
}
return queue;
}
if (time_travel && !record->event.pressed) { if (time_travel && !record->event.pressed) {
uint8_t p; uint8_t p;
@ -1188,15 +1028,13 @@ bool process_record_user (uint16_t keycode, keyrecord_t *record) {
last4[3] = keycode; last4[3] = keycode;
if (last4[0] == KC_D && last4[1] == KC_A && last4[2] == KC_T && last4[3] == KC_E) { if (last4[0] == KC_D && last4[1] == KC_A && last4[2] == KC_T && last4[3] == KC_E) {
uint16_t codes[] = {KC_E, KC_SPC, KC_MINS, KC_D, KC_SPC, KC_QUOT, 0}; ang_tap (KC_E, KC_SPC, KC_MINS, KC_D, KC_SPC, KC_QUOT, 0);
ang_tap (codes);
register_code (KC_RSFT); register_code (KC_RSFT);
register_code (KC_EQL); register_code (KC_EQL);
unregister_code (KC_EQL); unregister_code (KC_EQL);
unregister_code (KC_RSFT); unregister_code (KC_RSFT);
uint16_t codes2[] = {KC_4, KC_SPC, KC_D, KC_A, KC_Y, KC_S, KC_QUOT, 0}; ang_tap (KC_4, KC_SPC, KC_D, KC_A, KC_Y, KC_S, KC_QUOT, 0);
ang_tap (codes2);
return false; return false;
} }
@ -1204,3 +1042,17 @@ bool process_record_user (uint16_t keycode, keyrecord_t *record) {
return true; return true;
} }
void qk_ucis_symbol_fallback (void) {
for (uint8_t i = 0; i < qk_ucis_state.count - 1; i++) {
uint8_t code;
if (qk_ucis_state.codes[i] > KF_1)
code = qk_ucis_state.codes[i] - KF_1 + KC_1;
else
code = qk_ucis_state.codes[i];
register_code(code);
unregister_code(code);
wait_ms (10);
}
}

View File

@ -3,11 +3,15 @@
algernon's layout algernon's layout
======================= =======================
This is an unconventional layout for the ErgoDox EZ. For more details about the history of the layout, see my [blog posts about my ErgoDox journey][blog-ergodox]. This is an unconventional layout for the [ErgoDox EZ][ez]. For more details about the history of the layout, see my [blog posts about my ErgoDox journey][blog-ergodox].
[ez]: https://ergodox-ez.com/
[blog-ergodox]: https://asylum.madhouse-project.org/blog/tags/ergodox/ [blog-ergodox]: https://asylum.madhouse-project.org/blog/tags/ergodox/
Some of the things in the layout only work when one uses Spacemacs and GNOME under Linux. Your mileage may vary. Some of the things in the layout only work when one uses [Spacemacs][spacemacs] and [GNOME][gnome] under Linux. Your mileage may vary.
[spacemacs]: http://spacemacs.org/
[gnome]: https://www.gnome.org/
## Table of Contents ## Table of Contents
@ -40,10 +44,10 @@ At its core, this is a Dvorak layout, with some minor changes. The more interest
* The `GUI` key is special, because when I double-tap it, it sends `GUI + w`, which pops up an application selector. It also switches to a one-shot layer, where the number row on the left half turns into app selector macros, for the most common things I usually want to switch to. Otherwise it behaves as on a normal layout. * The `GUI` key is special, because when I double-tap it, it sends `GUI + w`, which pops up an application selector. It also switches to a one-shot layer, where the number row on the left half turns into app selector macros, for the most common things I usually want to switch to. Otherwise it behaves as on a normal layout.
* The `ESC` key also doubles as a one-shot cancel key: if tapped while any of the one-shot modifiers are in-flight (as in, single-tapped, and not expired yet), it cancels all one-shot modifiers. It also cancels the **Hun** layer, if active. Otherwise it sends the usual keycode. * The `ESC` key also doubles as a one-shot cancel key: if tapped while any of the one-shot modifiers are in-flight (as in, single-tapped, and not expired yet), it cancels all one-shot modifiers. It also cancels the **Hun** layer, if active. Otherwise it sends the usual keycode.
* The **Media** and **Hun** layer keys are one-shot, the **STENO** key is a toggle. * The **Media** and **Hun** layer keys are one-shot, the **STENO** key is a toggle.
* When holding any of the **Arrow** layer keys, the arrow layer activates while the layer key is held. Tapping the key produces the normal key. * When holding the `Tab`/**Arrow** key, the arrow layer activates while the key is held. Tapping the key produces the normal, `Tab` key. Double-tapping it toggles the **Arrow** layer on until a third tap.
* Tapping the `:` key once yields `:`, tapping it twice yields `;`. * Tapping the `:` key once yields `:`, tapping it twice yields `;`.
* Tapping the `[{(`/`)}]` keys once yields `[` (or `{` when shifted), tapping them twice yields `(`.
* The **Lead** key allows me to type in a sequence of keys, and trigger some actions: * The **Lead** key allows me to type in a sequence of keys, and trigger some actions:
- `LEAD u` enters unicode input mode, by sending the GTK+ key sequence that does this.
- `LEAD l` uses the unicode input method to enter a `λ`. - `LEAD l` uses the unicode input method to enter a `λ`.
- `LEAD s` does a lot of magic to type in a shruggie: `¯\_(ツ)_/¯` - `LEAD s` does a lot of magic to type in a shruggie: `¯\_(ツ)_/¯`
- `LEAD y` types `\o/`. - `LEAD y` types `\o/`.
@ -52,7 +56,7 @@ At its core, this is a Dvorak layout, with some minor changes. The more interest
- `LEAD v` prints the firmware version, the keyboard and the keymap. - `LEAD v` prints the firmware version, the keyboard and the keymap.
- `LEAD d` toggles logging keypress positions to the HID console. - `LEAD d` toggles logging keypress positions to the HID console.
- `LEAD t` toggles time travel. Figuring out the current `date` is left as an exercise to the reader. - `LEAD t` toggles time travel. Figuring out the current `date` is left as an exercise to the reader.
- `LEAD LEAD u` enters the [Unicode symbol input][#unicode-symbol-input] mode. - `LEAD u` enters the [Unicode symbol input](#unicode-symbol-input) mode.
## ADORE layer ## ADORE layer
@ -91,6 +95,7 @@ For the layers, the following rules apply:
* When the [ADORE layer](#adore-layer) is toggled on, LEDs will light up from left to right in a sequence, then turn off. When the layer is toggled off, the LEDs light up and turn off in the other direction. No LEDs are on while the layer is active. * When the [ADORE layer](#adore-layer) is toggled on, LEDs will light up from left to right in a sequence, then turn off. When the layer is toggled off, the LEDs light up and turn off in the other direction. No LEDs are on while the layer is active.
* When the [Hungarian layer](#hungarian-layer) is active, the *green* and *blue* LEDs are on. * When the [Hungarian layer](#hungarian-layer) is active, the *green* and *blue* LEDs are on.
* When the [Navigation and media layer](#navigation-and-media-layer) is active, the *red* and *green* ones are on. * When the [Navigation and media layer](#navigation-and-media-layer) is active, the *red* and *green* ones are on.
* When the **ARROW** layer is active, the *red* and *blue* ones are on.
* For the [Steno layer](#steno-layer), all LEDs will be turned on. * For the [Steno layer](#steno-layer), all LEDs will be turned on.
Unless noted otherwise, the layers use a dim light for the LEDs, while modifiers use a stronger one, and modifiers override any layer preferences. For example, when on the one-handed layer, with the left side active (*red* light blinking), if `Shift` is on, the *red* light will be constantly on. Unless noted otherwise, the layers use a dim light for the LEDs, while modifiers use a stronger one, and modifiers override any layer preferences. For example, when on the one-handed layer, with the left side active (*red* light blinking), if `Shift` is on, the *red* light will be constantly on.
@ -116,7 +121,7 @@ This is an experimental feature, and may or may not work reliably.
When the keypress logging functionality is enabled (by `LEAD d`), the keyboard will output a line every time a key is pressed, containing the position of the key in the matrix. This allows one to collect this information, and build analytics over it, such as a heat map, including dead keys too. When the keypress logging functionality is enabled (by `LEAD d`), the keyboard will output a line every time a key is pressed, containing the position of the key in the matrix. This allows one to collect this information, and build analytics over it, such as a heat map, including dead keys too.
Included with the firmware is a small tool that can parse these logs, and create a heatmap that one can import into [KLE][kle]. To use it, simply point `tools/log-to-heatmap.py` to a base layout file (one is included in the `tools/` directory), and the key position log. The latter one can create by running `hid-listen`, and redirecting its output to a file. Included with the firmware is a small tool that can parse these logs, and create a heatmap that one can import into [KLE][kle]. To use it, either pipe the output of `hid_listen` into it, or pipe it an already saved log, and it will save the results into files in an output directory (given on the command-line). See the output of `tools/log-to-heatmap.py --help` for more information.
[kle]: http://www.keyboard-layout-editor.com/ [kle]: http://www.keyboard-layout-editor.com/
@ -151,7 +156,35 @@ The keymap default to forcing NKRO, which seems to upset Windows, and except the
# Changelog # Changelog
## v1.5 - 2016-08-12 ## v1.6
*2016-08-24*
### Base layer changes
* The parentheses & bracket keys have been merged: tapping them results in `[` or `{` (if it was shifted), double tapping leads to `(`.
* The `:;` and `-_` keys are now available on the base layer, on their [ADORE](#adore-layer) location, too, just below `[{(`/`]})`.
* The `Apps` key has been replaced by `F12`.
* The `-`/`_` is no longer a tap-dance key.
### ADORE layer changes
* Adjustments were made to the [ADORE](#adore-layer) layer, to separate some inconvenient combinations.
### Miscellaneous changes
* `LEAD u` now starts the symbolic unicode input system, instead of the OS-one.
* The mouse acceleration keys on the [Navigation and Media](#navigation-and-media-layer) layer have been turned into toggles: tap them once to turn them on, until tapped again. Tapping an accelerator button will turn all the others off.
* When the **ARROW** layer is on, the *red* and *blue* LEDs light up now.
### Heatmap
* The built-in keylogger has been greatly enhanced, it now outputs the pressed state, and the layer (Dvorak or ADORE). As such, the `ADORE_AUTOLOG` option has been removed, instead there is `AUTOLOG_ENABLE` now, which when enabled, makes the keylogger start when the keyboard boots. It defaults to off.
* The heatmap generator received a lot of updates.
## v1.5
*2016-08-12*
* The **1HAND** layer has been removed. * The **1HAND** layer has been removed.
* A `Delete` key is now available on the right thumb cluster. * A `Delete` key is now available on the right thumb cluster.
@ -161,7 +194,9 @@ The keymap default to forcing NKRO, which seems to upset Windows, and except the
* On the **ARROW** layer, `Backspace` has been replaced by `Enter`. * On the **ARROW** layer, `Backspace` has been replaced by `Enter`.
* There is some experimental support for entering Unicode symbols. * There is some experimental support for entering Unicode symbols.
## v1.4 - 2016-07-29 ## v1.4
*2016-07-29*
* When toggling the key logging on or off, the LEDs will do a little dance. * When toggling the key logging on or off, the LEDs will do a little dance.
* The keylogger is now optional, but enabled by default. Use `KEYLOGGER_ENABLE=no` on the `make` command line to disable it. * The keylogger is now optional, but enabled by default. Use `KEYLOGGER_ENABLE=no` on the `make` command line to disable it.
@ -169,14 +204,18 @@ The keymap default to forcing NKRO, which seems to upset Windows, and except the
* The `-`/`_` key was turned into a tap-dance key too. * The `-`/`_` key was turned into a tap-dance key too.
* There is now a way to travel time with the keyboard, toggle the feature on by hitting `LEAD t`. * There is now a way to travel time with the keyboard, toggle the feature on by hitting `LEAD t`.
## v1.3 - 2016-07-06 ## v1.3
*2016-07-06*
* Added support for logging keys, by pressing `LEAD d`. Also included is a tool to generate a [heatmap](#heatmap) out of the logs. * Added support for logging keys, by pressing `LEAD d`. Also included is a tool to generate a [heatmap](#heatmap) out of the logs.
* The arrow and navigation keys were rearranged again, and now require an additional key being held to activate. See the [base layer](#base-layer) for an image that shows where arrows are. * The arrow and navigation keys were rearranged again, and now require an additional key being held to activate. See the [base layer](#base-layer) for an image that shows where arrows are.
* The **experimental** layer has been redone, and is now called [ADORE](#adore-layer), and as such, can be enabled by `LEAD a` now. * The **experimental** layer has been redone, and is now called [ADORE](#adore-layer), and as such, can be enabled by `LEAD a` now.
* Switching between Dvorak and ADORE is now persisted into EEPROM, and survives a reboot. * Switching between Dvorak and ADORE is now persisted into EEPROM, and survives a reboot.
## v1.2 - 2016-06-22 ## v1.2
*2016-06-22*
* The forced NKRO mode can be easily toggled off at compile-time, to make the firmware compatible with [certain operating systems](#using-on-windows). * The forced NKRO mode can be easily toggled off at compile-time, to make the firmware compatible with [certain operating systems](#using-on-windows).
* The `:;` key has changed behaviour: to access the `;` symbol, the key needs to be double-tapped, instead of shifted. * The `:;` key has changed behaviour: to access the `;` symbol, the key needs to be double-tapped, instead of shifted.
@ -187,7 +226,9 @@ The keymap default to forcing NKRO, which seems to upset Windows, and except the
* On the **experimental** layer, the `L` and `Q`, and the `K` and `G` keys were swapped. * On the **experimental** layer, the `L` and `Q`, and the `K` and `G` keys were swapped.
* The [Steno](#steno-layer) layer gained a few more `#` and `*` keys, to make it easier on my fingers. * The [Steno](#steno-layer) layer gained a few more `#` and `*` keys, to make it easier on my fingers.
## v1.1 - 2016-06-14 ## v1.1
*2016-06-14*
* The keyboard starts in NKRO mode, bootmagic and other things are disabled. * The keyboard starts in NKRO mode, bootmagic and other things are disabled.
* A [Steno](#steno-layer) layer was added, to be used with Plover. * A [Steno](#steno-layer) layer was added, to be used with Plover.
@ -201,7 +242,9 @@ The keymap default to forcing NKRO, which seems to upset Windows, and except the
- `:` now inputs `;` when shifted. - `:` now inputs `;` when shifted.
* `ESC` cancels the [Hungarian](#hungarian-layer) layer too, not just modifiers. * `ESC` cancels the [Hungarian](#hungarian-layer) layer too, not just modifiers.
## v1.0 - 2016-05-26 ## v1.0
*2016-05-26*
Initial version. Initial version.

View File

@ -75,9 +75,9 @@
"STENO", "STENO",
{ {
"x": 4.5, "x": 4.5,
"f": 6 "f": 3
}, },
"<i class='mss mss-Unicode-Option-3'></i>", "F12",
{ {
"c": "#7adabd", "c": "#7adabd",
"a": 4, "a": 4,
@ -94,12 +94,20 @@
{ {
"y": -0.875, "y": -0.875,
"c": "#ffb2d2", "c": "#ffb2d2",
"f": 3, "f": 9,
"a": 6,
"w": 1.5 "w": 1.5
}, },
"\n\n~\n`", "\n\n<i class='kb kb-Multimedia-Play-Pause'></i>",
{ {
"t": "#0d0d0b" "t": "#0d0d0b",
"f": 3,
"a": 4,
"fa": [
0,
0,
2
]
}, },
"!\n1\nF1", "!\n1\nF1",
{ {
@ -120,7 +128,7 @@
"t": "#000000", "t": "#000000",
"a": 6 "a": 6
}, },
"L", "G",
{ {
"x": 10.5 "x": 10.5
}, },
@ -132,16 +140,16 @@
"x": 2.5, "x": 2.5,
"c": "#bfbad1", "c": "#bfbad1",
"t": "#0d0d0b", "t": "#0d0d0b",
"a": 4 "a": 6
}, },
">\n.", "W",
{ {
"x": 1, "x": 1,
"c": "#7adabd", "c": "#7adabd",
"t": "#000000", "t": "#000000",
"a": 6 "a": 6
}, },
"W", "L",
{ {
"x": 8.5 "x": 8.5
}, },
@ -164,14 +172,15 @@
{ {
"c": "#93c9b7", "c": "#93c9b7",
"a": 4, "a": 4,
"fa": [0, 0, 0],
"h": 1.5 "h": 1.5
}, },
"{\n[", "{\n(\n[",
{ {
"x": 4.5, "x": 4.5,
"h": 1.5 "h": 1.5
}, },
"}\n]", "}\n)\n]",
{ {
"c": "#7adabd", "c": "#7adabd",
"a": 6 "a": 6
@ -183,21 +192,22 @@
"y": -0.875, "y": -0.875,
"c": "#ffb07b", "c": "#ffb07b",
"t": "#0d0d0b", "t": "#0d0d0b",
"f": 6, "f": 3,
"a": 4,
"w": 1.5 "w": 1.5
}, },
"<i class='fa fa-fast-backward'></i>\n\n<i class='fa fa-fast-forward'></i>", "\n\n~\n`",
{ {
"c": "#ffb2d2", "c": "#ffb2d2",
"a": 4, "a": 6,
"f": 3 "f": 3
}, },
"<\n,", "Y",
{ {
"x": 14.5, "x": 14.5,
"a": 6 "a": 6
}, },
"Y", "X",
{ {
"a": 4, "a": 4,
"w": 1.5 "w": 1.5
@ -300,15 +310,14 @@
"x": 6.5, "x": 6.5,
"c": "#93c9b7", "c": "#93c9b7",
"t": "#000000", "t": "#000000",
"a": 7,
"h": 1.5 "h": 1.5
}, },
"(", ";\n:",
{ {
"x": 4.5, "x": 4.5,
"h": 1.5 "h": 1.5
}, },
")" "_\n-"
], ],
[ [
{ {
@ -320,7 +329,9 @@
}, },
"\"\n'", "\"\n'",
{ {
"x": 10.5 "x": 10.5,
"a": 6,
"f": 3
}, },
"V" "V"
], ],
@ -329,19 +340,22 @@
"y": -0.875, "y": -0.875,
"x": 2.5, "x": 2.5,
"c": "#bfbad1", "c": "#bfbad1",
"t": "#0d0d0b" "t": "#0d0d0b",
"a": 6
}, },
"Z", "Q",
{ {
"x": 1, "x": 1,
"c": "#7adabd", "c": "#7adabd",
"t": "#000000" "t": "#000000",
"a": 4
},
"<\n,",
{
"x": 8.5,
"a": 6
}, },
"K", "K",
{
"x": 8.5
},
"G",
{ {
"x": 1, "x": 1,
"c": "#bfbad1", "c": "#bfbad1",
@ -354,11 +368,13 @@
"y": -0.875, "y": -0.875,
"x": 5.5, "x": 5.5,
"c": "#7adabd", "c": "#7adabd",
"t": "#000000" "t": "#000000",
"a": 4
}, },
"X", ">\n.",
{ {
"x": 6.5 "x": 6.5,
"a": 6
}, },
"B" "B"
], ],
@ -367,28 +383,32 @@
"y": -0.875, "y": -0.875,
"c": "#ffb07b", "c": "#ffb07b",
"f": 9, "f": 9,
"w": 1.5 "w": 1.5,
"g": true
}, },
"\n\n<i class='kb kb-Multimedia-Play-Pause'></i>", "",
{ {
"c": "#ffb2d2", "c": "#ffb2d2",
"t": "#0d0d0b", "t": "#0d0d0b",
"a": 4, "a": 6,
"f": 3 "f": 3,
"g": false
}, },
"?\n/", "Z",
{ {
"x": 14.5, "x": 14.5,
"a": 6 "a": 4
}, },
"Q", "?\n/",
{ {
"c": "#ffb07b", "c": "#ffb07b",
"t": "#000000", "t": "#000000",
"f": 9, "f": 9,
"w": 1.5 "g": true,
"w": 1.5,
"a": 4
}, },
"<i class='kb kb-Multimedia-Stop'></i>" ""
], ],
[ [
{ {
@ -414,14 +434,14 @@
{ {
"x": 1, "x": 1,
"c": "#d4872a", "c": "#d4872a",
"g": false, "g": true,
"a": 5 "a": 5
}, },
";\n:", "",
{ {
"x": 8.5 "x": 8.5
}, },
"_\n-", "",
{ {
"x": 1, "x": 1,
"c": "#d9dae0", "c": "#d9dae0",
@ -503,13 +523,13 @@
}, },
"MEDIA", "MEDIA",
{}, {},
"1HAND" "DEL"
], ],
[ [
{ {
"x": -3 "x": -3
}, },
"LEAD", "HUN",
{ {
"c": "#d4872a", "c": "#d4872a",
"f": 9, "f": 9,
@ -528,6 +548,6 @@
"c": "#f9cd31", "c": "#f9cd31",
"f": 2 "f": 2
}, },
"HUN" "LEAD"
] ]
] ]

View File

@ -75,9 +75,9 @@
"STENO", "STENO",
{ {
"x": 4.5, "x": 4.5,
"f": 6 "f": 3
}, },
"<i class='mss mss-Unicode-Option-3'></i>", "F12",
{ {
"c": "#7adabd", "c": "#7adabd",
"a": 4, "a": 4,
@ -94,12 +94,21 @@
{ {
"y": -0.875, "y": -0.875,
"c": "#ffb2d2", "c": "#ffb2d2",
"f": 3, "f": 6,
"a": 6,
"w": 1.5 "w": 1.5
}, },
"\n\n~\n`", "<i class='fa fa-fast-backward'></i>\n\n<i class='fa fa-fast-forward'></i>",
{ {
"t": "#0d0d0b" "f": 3,
"t": "#0d0d0b",
"a": 4,
"fa": [
0,
0,
2
]
}, },
"!\n1\nF1", "!\n1\nF1",
{ {
@ -167,12 +176,12 @@
"a": 4, "a": 4,
"h": 1.5 "h": 1.5
}, },
"{\n[", "{\n(\n[",
{ {
"x": 4.5, "x": 4.5,
"h": 1.5 "h": 1.5
}, },
"}\n]", "}\n)\n]",
{ {
"c": "#7adabd", "c": "#7adabd",
"a": 6 "a": 6
@ -184,10 +193,10 @@
"y": -0.875, "y": -0.875,
"c": "#ffb07b", "c": "#ffb07b",
"t": "#0d0d0b", "t": "#0d0d0b",
"f": 6, "f": 3,
"w": 1.5 "w": 1.5
}, },
"<i class='fa fa-fast-backward'></i>\n\n<i class='fa fa-fast-forward'></i>", "\n\n~\n`",
{ {
"c": "#ffb2d2", "c": "#ffb2d2",
"a": 4, "a": 4,
@ -503,7 +512,7 @@
}, },
"MEDIA", "MEDIA",
{}, {},
"1HAND" "DEL"
], ],
[ [
{ {

View File

@ -3,143 +3,247 @@ import json
import os import os
import sys import sys
import re import re
import argparse
from math import floor from math import floor
from os.path import dirname
cr_coord_map = [ class Heatmap(object):
[ coords = [
# Row 0 [
[ 4, 0], [ 4, 2], [ 2, 0], [ 1, 0], [ 2, 2], [ 3, 0], [ 3, 2], # Row 0
[ 3, 4], [ 3, 6], [ 2, 4], [ 1, 2], [ 2, 6], [ 4, 4], [ 4, 6], [ 4, 0], [ 4, 2], [ 2, 0], [ 1, 0], [ 2, 2], [ 3, 0], [ 3, 2],
], [ 3, 4], [ 3, 6], [ 2, 4], [ 1, 2], [ 2, 6], [ 4, 4], [ 4, 6],
[ ],
# Row 1 [
[ 8, 0], [ 8, 2], [ 6, 0], [ 5, 0], [ 6, 2], [ 7, 0], [ 7, 2], # Row 1
[ 7, 4], [ 7, 6], [ 6, 4], [ 5, 2], [ 6, 6], [ 8, 4], [ 8, 6], [ 8, 0], [ 8, 2], [ 6, 0], [ 5, 0], [ 6, 2], [ 7, 0], [ 7, 2],
], [ 7, 4], [ 7, 6], [ 6, 4], [ 5, 2], [ 6, 6], [ 8, 4], [ 8, 6],
[ ],
# Row 2 [
[12, 0], [12, 2], [10, 0], [ 9, 0], [10, 2], [11, 0], [ ], # Row 2
[ ], [11, 2], [10, 4], [ 9, 2], [10, 6], [12, 4], [12, 6], [12, 0], [12, 2], [10, 0], [ 9, 0], [10, 2], [11, 0], [ ],
], [ ], [11, 2], [10, 4], [ 9, 2], [10, 6], [12, 4], [12, 6],
[ ],
# Row 3 [
[17, 0], [17, 2], [15, 0], [14, 0], [15, 2], [16, 0], [13, 0], # Row 3
[13, 2], [16, 2], [15, 4], [14, 2], [15, 6], [17, 4], [17, 6], [17, 0], [17, 2], [15, 0], [14, 0], [15, 2], [16, 0], [13, 0],
], [13, 2], [16, 2], [15, 4], [14, 2], [15, 6], [17, 4], [17, 6],
[ ],
# Row 4 [
[20, 0], [20, 2], [19, 0], [18, 0], [19, 2], [], [], [], [], # Row 4
[19, 4], [18, 2], [19, 6], [20, 4], [20, 6], [20, 0], [20, 2], [19, 0], [18, 0], [19, 2], [], [], [], [],
], [19, 4], [18, 2], [19, 6], [20, 4], [20, 6],
[ ],
# Row 5 [
[ ], [23, 0], [22, 2], [22, 0], [22, 4], [21, 0], [21, 2], # Row 5
[24, 0], [24, 2], [25, 0], [25, 4], [25, 2], [26, 0], [ ], [ ], [23, 0], [22, 2], [22, 0], [22, 4], [21, 0], [21, 2],
], [24, 0], [24, 2], [25, 0], [25, 4], [25, 2], [26, 0], [ ],
] ],
]
def set_attr_at(j, b, n, attr, fn, val): def set_attr_at(self, block, n, attr, fn, val):
blk = j[b][n] blk = self.heatmap[block][n]
if attr in blk: if attr in blk:
blk[attr] = fn(blk[attr], val) blk[attr] = fn(blk[attr], val)
else: else:
blk[attr] = fn(None, val) blk[attr] = fn(None, val)
def coord(col, row): def coord(self, col, row):
return cr_coord_map[row][col] return self.coords[row][col]
def set_attr(orig, new): @staticmethod
return new def set_attr(orig, new):
return new
def set_bg(j, (b, n), color): def set_bg(self, (block, n), color):
set_attr_at(j, b, n, "c", set_attr, color) self.set_attr_at(block, n, "c", self.set_attr, color)
#set_attr_at(j, b, n, "g", set_attr, False) #self.set_attr_at(block, n, "g", self.set_attr, False)
def _set_tap_info(o, count, cap): def set_tap_info(self, (block, n), count, cap):
ns = 4 - o.count ("\n") def _set_tap_info(o, _count, _cap):
return o + "\n" * ns + "%.02f%%" % (float(count) / float(cap) * 100) ns = 4 - o.count ("\n")
return o + "\n" * ns + "%.02f%%" % (float(_count) / float(_cap) * 100)
def set_tap_info(j, (b, n), count, cap): if not cap:
j[b][n + 1] = _set_tap_info (j[b][n + 1], count, cap) cap = 1
self.heatmap[block][n + 1] = _set_tap_info (self.heatmap[block][n + 1], count, cap)
def heatmap_color (v): @staticmethod
colors = [ [0.3, 0.3, 1], [0.3, 1, 0.3], [1, 1, 0.3], [1, 0.3, 0.3]] def heatmap_color (v):
fb = 0 colors = [ [0.3, 0.3, 1], [0.3, 1, 0.3], [1, 1, 0.3], [1, 0.3, 0.3]]
if v <= 0: fb = 0
idx1, idx2 = 0, 0 if v <= 0:
elif v >= 1: idx1, idx2 = 0, 0
idx1, idx2 = len(colors) - 1, len(colors) - 1 elif v >= 1:
else: idx1, idx2 = len(colors) - 1, len(colors) - 1
val = v * (len(colors) - 1) else:
idx1 = int(floor(val)) val = v * (len(colors) - 1)
idx2 = idx1 + 1 idx1 = int(floor(val))
fb = val - float(idx1) idx2 = idx1 + 1
fb = val - float(idx1)
r = (colors[idx2][0] - colors[idx1][0]) * fb + colors[idx1][0] r = (colors[idx2][0] - colors[idx1][0]) * fb + colors[idx1][0]
g = (colors[idx2][1] - colors[idx1][1]) * fb + colors[idx1][1] g = (colors[idx2][1] - colors[idx1][1]) * fb + colors[idx1][1]
b = (colors[idx2][2] - colors[idx1][2]) * fb + colors[idx1][2] b = (colors[idx2][2] - colors[idx1][2]) * fb + colors[idx1][2]
r, g, b = [x * 255 for x in r, g, b] r, g, b = [x * 255 for x in r, g, b]
return "#%02x%02x%02x" % (r, g, b) return "#%02x%02x%02x" % (r, g, b)
# Load the keylog def __init__(self, layout):
def load_keylog(fname, restrict_row): self.log = {}
keylog = {} self.total = 0
total = 0 self.max_cnt = 0
with open(fname, "r") as f: self.layout = layout
lines = f.readlines()
for line in lines: def update_log(self, (c, r)):
m = re.search ('KL: col=(\d+), row=(\d+)', line) if not (c, r) in self.log:
self.log[(c, r)] = 0
self.log[(c, r)] = self.log[(c, r)] + 1
self.total = self.total + 1
if self.max_cnt < self.log[(c, r)]:
self.max_cnt = self.log[(c, r)]
def get_heatmap(self):
with open("%s/heatmap-layout.%s.json" % (dirname(sys.argv[0]), self.layout), "r") as f:
self.heatmap = json.load (f)
## Reset colors
for row in self.coords:
for coord in row:
if coord != []:
self.set_bg (coord, "#d9dae0")
for (c, r) in self.log:
coords = self.coord(c, r)
b, n = coords
cap = self.max_cnt
if cap == 0:
cap = 1
v = float(self.log[(c, r)]) / cap
self.set_bg (coords, self.heatmap_color (v))
self.set_tap_info (coords, self.log[(c, r)], self.total)
return self.heatmap
def get_stats(self):
usage = [
# left hand
[0, 0, 0, 0, 0],
# right hand
[0, 0, 0, 0, 0]
]
finger_map = [0, 0, 1, 2, 3, 4, 4]
for (c, r) in self.log:
if r == 5: # thumb cluster
if c <= 6: # left side
usage[0][4] = usage[0][4] + self.log[(c, r)]
else:
usage[1][4] = usage[1][4] + self.log[(c, r)]
else:
fc = c
hand = 0
if fc >= 7:
fc = fc - 7
hand = 1
fm = finger_map[fc]
usage[hand][fm] = usage[hand][fm] + self.log[(c, r)]
hand_usage = [0, 0]
for f in usage[0]:
hand_usage[0] = hand_usage[0] + f
for f in usage[1]:
hand_usage[1] = hand_usage[1] + f
total = self.total
if total == 0:
total = 1
stats = {
"hands": {
"left": {
"usage": float(hand_usage[0]) / total * 100,
"fingers": {
"0 - pinky": 0,
"1 - ring": 0,
"2 - middle": 0,
"3 - index": 0,
"4 - thumb": 0,
}
},
"right": {
"usage": float(hand_usage[1]) / total * 100,
"fingers": {
"0 - thumb": 0,
"1 - index": 0,
"2 - middle": 0,
"3 - ring": 0,
"4 - pinky": 0,
}
},
}
}
hmap = ['left', 'right']
fmap = ['0 - pinky', '1 - ring', '2 - middle', '3 - index', '4 - thumb',
'0 - thumb', '1 - index', '2 - middle', '3 - ring', '4 - pinky']
for hand_idx in range(len(usage)):
hand = usage[hand_idx]
for finger_idx in range(len(hand)):
stats['hands'][hmap[hand_idx]]['fingers'][fmap[finger_idx + hand_idx * 5]] = float(hand[finger_idx]) / total * 100
return stats
def dump_all(out_dir, heatmaps):
for layer in heatmaps.keys():
if len(heatmaps[layer].log) == 0:
continue
with open ("%s/%s.json" % (out_dir, layer), "w") as f:
json.dump(heatmaps[layer].get_heatmap(), f)
print >>sys.stderr, "%s stats:" % (layer)
json.dump (heatmaps[layer].get_stats(), sys.stderr,
indent = 4, sort_keys = True)
print >>sys.stderr, ""
print >>sys.stderr, ""
def main(opts):
heatmaps = {"Dvorak": Heatmap("Dvorak"),
"ADORE": Heatmap("ADORE")
}
cnt = 0
restrict_row = opts.restrict_row
out_dir = opts.outdir
while True:
line = sys.stdin.readline()
if not line:
break
m = re.search ('KL: col=(\d+), row=(\d+), pressed=(\d+), layer=(.*)', line)
if not m: if not m:
continue continue
(c, r) = (int(m.group (2)), int(m.group (1)))
if restrict_row != None and r != int(restrict_row): cnt = cnt + 1
(c, r, l) = (int(m.group (2)), int(m.group (1)), m.group (4))
if restrict_row != -1 and r != restrict_row:
continue
if c in opts.ignore_columns:
continue continue
if (c, r) in keylog:
keylog[(c, r)] = keylog[(c, r)] + 1
else:
keylog[(c, r)] = 1
total = total + 1
return total / 2, keylog
def l_flat(s): heatmaps[l].update_log ((c, r))
f = s.split("\n")
return ", ".join (f)
def main(base_fn, log_fn, restrict_row = None): if opts.dump_interval != -1 and cnt >= opts.dump_interval:
cnt = 0
dump_all(out_dir, heatmaps)
with open(base_fn, "r") as f: dump_all (out_dir, heatmaps)
layout = json.load (f)
## Reset colors
for row in cr_coord_map:
for col in row:
if col != []:
set_bg (layout, col, "#d9dae0")
#set_attr_at (layout, col[0], col[1], "g", set_attr, True)
total, log = load_keylog (log_fn, restrict_row)
max_cnt = 0
for (c, r) in log:
max_cnt = max(max_cnt, log[(c, r)])
# Create the heatmap
for (c, r) in log:
coords = coord(c, r)
b, n = coords
cap = max_cnt
v = float(log[(c, r)]) / cap
print >> sys.stderr, "%s => %d/%d => %f = %s" % (l_flat(layout[b][n+1]), log[(c,r)], cap, v, heatmap_color(v))
set_bg (layout, coord(c, r), heatmap_color (v))
set_tap_info (layout, coord (c, r), log[(c, r)], total)
print json.dumps(layout)
if __name__ == "__main__": if __name__ == "__main__":
if len(sys.argv) < 3: parser = argparse.ArgumentParser (description = "keylog to heatmap processor")
print """Log to Heatmap -- creates a heatmap out of keyboard logs parser.add_argument ('outdir', action = 'store',
help = 'Output directory')
Usage: log-to-heatmap.py base-layout.json logfile [row] >layout.json""" parser.add_argument ('--row', dest = 'restrict_row', action = 'store', type = int,
sys.exit (1) default = -1, help = 'Restrict processing to this row only')
main(*sys.argv[1:]) parser.add_argument ('--dump-interval', dest = 'dump_interval', action = 'store', type = int,
default = 100, help = 'Dump stats and heatmap at every Nth event, -1 for dumping at EOF only')
parser.add_argument ('--ignore-column', dest = 'ignore_columns', action = 'append', type = int,
default = [], help = 'Ignore the specified columns')
args = parser.parse_args()
main(args)

View File

@ -1,2 +1,3 @@
SLEEP_LED_ENABLE = no SLEEP_LED_ENABLE = no
UNICODE_ENABLE = yes UNICODE_ENABLE = yes
COMMAND_ENABLE = no

View File

@ -1,5 +1,4 @@
#include "ergodox.h" #include "ergodox.h"
#include "debug.h"
#include "action_layer.h" #include "action_layer.h"
#include "led.h" #include "led.h"
#include "keymap_extras/keymap_neo2.h" #include "keymap_extras/keymap_neo2.h"
@ -138,11 +137,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* *
* *
* *
* F9 F10 F11 F12 * F9 F10 F11 F12
* *
* F5 F6 F7 F8 * F5 F6 F7 F8
* (TL2) (TL3) * (TL2) (TL3)
* F1 F2 F3 F4 * F1 F2 F3 F4
* *
* (MO1) (MO4) (MO4) (MO1) * (MO1) (MO4) (MO4) (MO1)
* *
@ -156,9 +155,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[FMU] = KEYMAP( [FMU] = KEYMAP(
// left hand // 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,UC(0x2713),KC_TRNS,KC_TRNS, KC_TRNS, UC(0x250C),UC(0x252C),UC(0x2510),UC(0x2500),UC(0x2502),KC_TRNS,
KC_TRNS, KC_TRNS,KC_TRNS,KC_TRNS,UC(0x2715),KC_TRNS, KC_TRNS, UC(0x251C),UC(0x253C),UC(0x2524),UC(0x2713),UC(0x2715),
KC_TRNS, KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, KC_TRNS, UC(0x2514),UC(0x2534),UC(0x2518),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_MS_L, KC_MS_U, KC_MS_L, KC_MS_U,
KC_BTN1, KC_BTN1,
@ -245,6 +244,7 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
// Runs just one time when the keyboard initializes. // Runs just one time when the keyboard initializes.
void matrix_init_user(void) { void matrix_init_user(void) {
set_unicode_input_mode(UC_LNX);
}; };
@ -279,3 +279,14 @@ void matrix_scan_user(void)
} }
}; };
// Override Unicode start method to use NEO_U instead of KC_U
void unicode_input_start (void) {
register_code(KC_LCTL);
register_code(KC_LSFT);
register_code(NEO_U);
unregister_code(NEO_U);
unregister_code(KC_LSFT);
unregister_code(KC_LCTL);
};

Binary file not shown.

After

Width:  |  Height:  |  Size: 137 KiB

View File

@ -0,0 +1,180 @@
#include "ergodox.h"
#include "debug.h"
#include "action_layer.h"
#include "keymap_norwegian.h"
#define BASE 0 // default layer
#define BASE_MAC 1 // default layer mac
#define NUMB_FUNC 2 // numbers and function keys
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Keymap 0: Basic layer PC
*
* ,--------------------------------------------------. ,--------------------------------------------------.
* | * | [ | ] | { | } | ~ |Mac/PC| | ^ | $ | ( | ) | < | > | @ |
* |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
* | + | Q | W | E | R | T | " | | ' | Y | U | I | O | P | Å |
* |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
* | / | A | S | D | F | G |------| |------| H | J | K | L | Ø | Æ |
* |--------+------+------+------+------+------| ; | | = |------+------+------+------+------+--------|
* | - | Z | X | C | V | B | | | | N | M | RIGHT| DOWN | UP | _ |
* `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
* |Alt/esc| ! | ? | : | TAB | | LEFT | _ | & | | |Num/fn|
* `----------------------------------' `----------------------------------'
* ,-------------. ,--------------.
* | # | ` | |Insert| % |
* ,------|------|------| |------+-------+------.
* | | | ´ | | Del | | |
* | Shift|Ctrl/.|------| |------| Enter |Space |
* | | |GUI/, | | Bspc | | |
* `--------------------' `---------------------'
*/
[BASE] = KEYMAP(
// left hand
KC_PAST, NO_LBRC, NO_RBRC, NO_LCBR, NO_RCBR, KC_FN2, TG(1),
KC_PPLS, KC_Q, KC_W, KC_E, KC_R, KC_T, NO_QUO2,
KC_PSLS, KC_A, KC_S, KC_D, KC_F, KC_G,
KC_PMNS, KC_Z, KC_X, KC_C, KC_V, KC_B, NO_SCLN,
ALT_T(KC_ESC), KC_EXLM , NO_QUES, NO_COLN, KC_TAB,
KC_HASH, KC_FN7,
KC_FN6,
KC_FN1,CTL_T(KC_DOT),GUI_T(KC_COMMA),
// right hand
KC_FN5, NO_DLR, NO_LPRN, NO_RPRN ,KC_FN3, KC_FN4,NO_AT,
NO_APOS, KC_Y, KC_U, KC_I, KC_O, KC_P, NO_AA ,
KC_H, KC_J, KC_K, KC_L, NO_OSLH, NO_AE,
NO_EQL, KC_N, KC_M, KC_RIGHT, KC_DOWN, KC_UP, NO_BSLS,
KC_LEFT, NO_UNDS, NO_AMPR, NO_PIPE, OSL(2),
KC_INSERT, KC_PERC,
KC_DELT,
KC_BSPC,KC_ENT,KC_SPC
),
/* Keymap 1: Basic layer MACS (Same as pc, except for cmd/ctrl, which are swapped)
*
* ,--------------------------------------------------. ,--------------------------------------------------.
* | \ | | | { | } | | | | | $ | | | < | > | @ |
* |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
* | | | | | | | | | | | | | | | |
* |--------+------+------+------+------+------| | | ' |------+------+------+------+------+--------|
* | | | | | | |------| |------| | | | | | |
* |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
* | | | | | | | | | | | | | | | |
* `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
* | | | | |,/Ctrl| | | | ` | |Num/fn|
* `----------------------------------' `----------------------------------'
* ,-------------. ,-------------.
* | | ` | | | |
* ,------|------|------| |------+------+------.
* | | | ´ | | | | |
* | |GUI/. |------| |------| | |
* | | |crtl/,| | | | |
* `--------------------' `--------------------'
*/
[BASE_MAC] = KEYMAP(
KC_TRNS, KC_TRNS,KC_TRNS, NO_LCBR_MAC,NO_RCBR_MAC, 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, NO_GRV_MAC,
KC_FN10,
KC_TRNS,GUI_T(KC_DOT) , CTL_T(KC_COMMA),
// right hand
KC_TRNS, NO_DLR_MAC, KC_TRNS,KC_TRNS,KC_FN8, KC_FN9,NO_AT_MAC,
NO_APOS_MAC, 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, NO_BSLS_MAC,
KC_TRNS, KC_TRNS, KC_TRNS, NO_PIPE_MAC, OSL(2),
KC_TRNS, KC_TRNS,
KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS
),
/* Keymap 2: Number ++´ánd Fn layer
*
* ,--------------------------------------------------. ,--------------------------------------------------.
* | | | | | | | | | | | F9 | F10 | F11 | F12 | |
* |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
* | | 8 | 7 | 6 | 5 | 9 | | | | | F5 | F6 | F7 | F8 | |
* |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
* | | 4 | 3 | 2 | 1 | 0 |------| |------| | F1 | F2 | F3 | F4 | |
* |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
* | | | | | | | | | | | | END | PGDWN| PGUP | |
* `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
* | | | | | | | HOME | | | | |
* `----------------------------------' `----------------------------------'
* ,-------------. ,-------------.
* | | | | | |
* ,------|------|------| |------+------+------.
* | | | | | | | |
* | | |------| |------| | |
* | | | | | | | |
* `--------------------' `--------------------'
*/
[NUMB_FUNC] = KEYMAP(
NO_ASTR, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
NO_PLUS, KC_8, KC_7,KC_6,KC_5, KC_9 , KC_TRNS,
NO_SLSH , KC_4 , KC_3 , KC_2 , KC_1 , KC_0,
NO_MINS, 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_F9, KC_F10, KC_F11, KC_F12, KC_TRNS,
KC_TRNS, KC_TRNS, KC_F5, KC_F6 , KC_F7, KC_F8, KC_TRNS,
KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_TRNS,
KC_TRNS, KC_HOME, KC_TRNS, KC_END, KC_PGDN, KC_PGUP, KC_TRNS,
KC_HOME, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS,
KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS
)
};
enum macro_id {
TILDE_NO, LESS_NO, GRTR_NO, CIRC_NO, ACUT_NO, GRV_NO, LESS_NO_MAC, GRTR_NO_MAC, ACUT_NO_MAC
};
const uint16_t PROGMEM fn_actions[] = {
[1] = ACTION_MODS_ONESHOT(MOD_LSFT), // Sticky shift light. Tap for the next keypress to be shifted. Hold for regular shift.
[2] = ACTION_MACRO(TILDE_NO), // Completed ~ character(pc and mac), no space needed.
[3] = ACTION_MACRO(LESS_NO), // < completed on keypress down, to avoid shifting the next character if it is not released first.
[4] = ACTION_MACRO(GRTR_NO), // > completed on keypress down, to avoid shifting the next character if it is not released first.
[5] = ACTION_MACRO(CIRC_NO), // Completed ^ character, no space needed.
[6] = ACTION_MACRO(ACUT_NO), // Completed ´ character, no space needed.
[7] = ACTION_MACRO(GRV_NO), // Completed ` character, no space needed.
[8] = ACTION_MACRO(LESS_NO_MAC), // < completed on keypress down, to avoid same button problem when typing <> quickly
[9] = ACTION_MACRO(GRTR_NO_MAC), // > completed on keypress down, to avoid same button problem when typing <> quickly
[10] = ACTION_MACRO(ACUT_NO_MAC), // Completed ´ character, no space needed
};
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
{
keyevent_t event = record->event;
switch (id) {
case TILDE_NO:
return (event.pressed ? MACRO( D(RALT), T(RBRC), U(RALT), T(SPC), END ) : MACRO_NONE);
case LESS_NO:
return (event.pressed ? MACRO( T(NUBS), END ) : MACRO_NONE);
case GRTR_NO:
return (event.pressed ? MACRO( D(LSFT), T(NUBS), U(LSFT), END ) : MACRO_NONE);
case CIRC_NO:
return (event.pressed ? MACRO( D(LSFT), T(RBRC), U(LSFT), T(SPC), END ) : MACRO_NONE);
case ACUT_NO:
return (event.pressed ? MACRO( D(RALT), T(EQL), U(RALT), T(SPC), END ) : MACRO_NONE);
case GRV_NO:
return (event.pressed ? MACRO( D(LSFT), T(EQL), T(SPC), U(LSFT), END ) : MACRO_NONE);
case LESS_NO_MAC:
return (event.pressed ? MACRO( T(GRV), END ) : MACRO_NONE);
case GRTR_NO_MAC:
return (event.pressed ? MACRO( D(LSFT), T(GRV), U(LSFT), END ) : MACRO_NONE);
case ACUT_NO_MAC:
return (event.pressed ? MACRO( T(EQL), T(SPC), END ) : MACRO_NONE);
}
return MACRO_NONE;
};

View File

@ -0,0 +1,30 @@
# Norwegian setup with osx/pc toggle
## Motivation
I wanted a Norwegian setup that worked in a similar way on both my Mac and PC. I also wanted the keyboard to translate from a standard Norwegian keyboard OS setup.
## Overview
The setup is created to be programmer friendly.
- Most of the symbols used in code can be activated without using layers or shift key.
- You can reach the IDE/OS shortcut activators(Ctrl, Win/Cmd, Alt, Shift) with the thumb or the wrist.
- Navigation is prioritized, arrows below the home row.
## PC/Mac toggle
The default setup is for Norwegian keyboard setting(on a PC(Windows or Linux) or Mac. Use the Mac/PC toggle button to switch between OSX and PC setup. The settings will be reverted to PC setup each time you restart/connect the keyboard.
## Layers
Since symbols are prioritized in this setup, numbers and function keys are on a new layer. The easiest way to use the layer switch(and also the alt key), is to push your hand right below the little finger, on the key. You will then have all your fingers free to type numbers or press function keys.
## Tap-shift
Tap for the next character to be shifted, hold down for regular shift.
## Comma dot and escape
Comma, dot and escape share buttons with modifier keys. Tap to access these keys, hold down to use the keys as modifier keys.
## Numpad symbols
+-/* are implemented with the numpad keycodes. The benefit is that they will work better with shortcuts in certain programs. For some reason, the default setting in the osx terminal is to not accept numpad characters for '/' and '-'. For a solution, see https://discussions.apple.com/thread/6613968?start=0&tstart=0.
If you really need the norwegian symbols in a program, you can access them using the number toggle button.
## Layout
![keyboard-layout](keyboard-layout.png)

Binary file not shown.

After

Width:  |  Height:  |  Size: 95 KiB

View File

@ -0,0 +1,180 @@
#include "ergodox.h"
#include "debug.h"
#include "action_layer.h"
#include "keymap_norwegian.h"
#define BASE 0 // default layer
#define BASE_MAC 1 // default layer mac
#define NUMB_FUNC 2 // numbers and function keys
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Keymap 0: Basic layer PC
*
* ,--------------------------------------------------. ,--------------------------------------------------.
* | * | [ | ] | { | } | ~ |Mac/PC| | ^ | $ | ( | ) | < | > | @ |
* |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
* | + | Q | W | F | P | G | " | | ' | J | L | U | Y | Å | Æ |
* |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
* | / | A | R | S | T | D |------| |------| H | N | E | I | O | Ø |
* |--------+------+------+------+------+------| ; | | = |------+------+------+------+------+--------|
* | - | Z | X | C | V | B | | | | K | M | RIGHT| DOWN | UP | _ |
* `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
* |Alt/esc| ! | ? | : | TAB | | LEFT | _ | & | | |Num/fn|
* `----------------------------------' `----------------------------------'
* ,-------------. ,--------------.
* | # | ` | |Insert| % |
* ,------|------|------| |------+-------+------.
* | | | ´ | | Del | | |
* | Shift|Ctrl/.|------| |------| Enter |Space |
* | | |GUI/, | | Bspc | | |
* `--------------------' `---------------------'
*/
[BASE] = KEYMAP(
// left hand
KC_PAST, NO_LBRC, NO_RBRC, NO_LCBR, NO_RCBR, KC_FN2, TG(1),
KC_PPLS, KC_Q, KC_W, KC_F, KC_P, KC_G, NO_QUO2,
KC_PSLS, KC_A, KC_R, KC_S, KC_T, KC_D,
KC_PMNS, KC_Z, KC_X, KC_C, KC_V, KC_B, NO_SCLN,
ALT_T(KC_ESC), KC_EXLM , NO_QUES, NO_COLN, KC_TAB,
KC_HASH, KC_FN7,
KC_FN6,
KC_FN1,CTL_T(KC_DOT),GUI_T(KC_COMMA),
// right hand
KC_FN5, NO_DLR, NO_LPRN, NO_RPRN ,KC_FN3, KC_FN4,NO_AT,
NO_APOS, KC_J, KC_L, KC_U, KC_Y, NO_AA, NO_AE ,
KC_H, KC_N, KC_E, KC_I, KC_O, NO_OSLH,
NO_EQL, KC_K, KC_M, KC_RIGHT, KC_DOWN, KC_UP, NO_BSLS,
KC_LEFT, NO_UNDS, NO_AMPR, NO_PIPE, OSL(2),
KC_INSERT, KC_PERC,
KC_DELT,
KC_BSPC,KC_ENT,KC_SPC
),
/* Keymap 1: Basic layer MAC (Same as pc, except for cmd/ctrl, which are swapped)
*
* ,--------------------------------------------------. ,--------------------------------------------------.
* | \ | | | { | } | | | | | $ | | | < | > | @ |
* |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
* | | | | | | | | | | | | | | | |
* |--------+------+------+------+------+------| | | ' |------+------+------+------+------+--------|
* | | | | | | |------| |------| | | | | | |
* |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
* | | | | | | | | | | | | | | | |
* `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
* | | | | |,/Ctrl| | | | ` | |Num/fn|
* `----------------------------------' `----------------------------------'
* ,-------------. ,-------------.
* | | ` | | | |
* ,------|------|------| |------+------+------.
* | | | ´ | | | | |
* | |GUI/. |------| |------| | |
* | | |crtl/,| | | | |
* `--------------------' `--------------------'
*/
[BASE_MAC] = KEYMAP(
KC_TRNS, KC_TRNS,KC_TRNS, NO_LCBR_MAC,NO_RCBR_MAC, 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, NO_GRV_MAC,
KC_FN10,
KC_TRNS,GUI_T(KC_DOT) , CTL_T(KC_COMMA),
// right hand
KC_TRNS, NO_DLR_MAC, KC_TRNS,KC_TRNS,KC_FN8, KC_FN9,NO_AT_MAC,
NO_APOS_MAC, 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, NO_BSLS_MAC,
KC_TRNS, KC_TRNS, KC_TRNS, NO_PIPE_MAC, OSL(2),
KC_TRNS, KC_TRNS,
KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS
),
/* Keymap 2: Number ++´ánd Fn layer pc
*
* ,--------------------------------------------------. ,--------------------------------------------------.
* | | | | | | | | | | | F9 | F10 | F11 | F12 | |
* |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
* | | 8 | 7 | 6 | 5 | 9 | | | | | F5 | F6 | F7 | F8 | |
* |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
* | | 4 | 3 | 2 | 1 | 0 |------| |------| | F1 | F2 | F3 | F4 | |
* |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
* | | | | | | | | | | | | END | PGDWN| PGUP | |
* `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
* | | | | | | | HOME | | | | |
* `----------------------------------' `----------------------------------'
* ,-------------. ,-------------.
* | | | | | |
* ,------|------|------| |------+------+------.
* | | | | | | | |
* | | |------| |------| | |
* | | | | | | | |
* `--------------------' `--------------------'
*/
[NUMB_FUNC] = KEYMAP(
NO_ASTR, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
NO_PLUS, KC_8, KC_7,KC_6,KC_5, KC_9 , KC_TRNS,
NO_SLSH , KC_4 , KC_3 , KC_2 , KC_1 , KC_0,
NO_MINS, 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_F9, KC_F10, KC_F11, KC_F12, KC_TRNS,
KC_TRNS, KC_TRNS, KC_F5, KC_F6 , KC_F7, KC_F8, KC_TRNS,
KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_TRNS,
KC_TRNS, KC_HOME, KC_TRNS, KC_END, KC_PGDN, KC_PGUP, KC_TRNS,
KC_HOME, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS,
KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS
)
};
enum macro_id {
TILDE_NO, LESS_NO, GRTR_NO, CIRC_NO, ACUT_NO, GRV_NO, LESS_NO_MAC, GRTR_NO_MAC, ACUT_NO_MAC
};
const uint16_t PROGMEM fn_actions[] = {
[1] = ACTION_MODS_ONESHOT(MOD_LSFT), // Sticky shift light. Tap for the next keypress to be shifted. Hold for regular shift.
[2] = ACTION_MACRO(TILDE_NO), // Completed ~ character(pc and mac), no space needed.
[3] = ACTION_MACRO(LESS_NO), // < completed on keypress down, to avoid shifting the next character if it is not released first.
[4] = ACTION_MACRO(GRTR_NO), // > completed on keypress down, to avoid shifting the next character if it is not released first.
[5] = ACTION_MACRO(CIRC_NO), // Completed ^ character, no space needed.
[6] = ACTION_MACRO(ACUT_NO), // Completed ´ character, no space needed.
[7] = ACTION_MACRO(GRV_NO), // Completed ` character, no space needed.
[8] = ACTION_MACRO(LESS_NO_MAC), // < completed on keypress down, to avoid same button problem when typing <> quickly
[9] = ACTION_MACRO(GRTR_NO_MAC), // > completed on keypress down, to avoid same button problem when typing <> quickly
[10] = ACTION_MACRO(ACUT_NO_MAC), // Completed ´ character, no space needed
};
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
{
keyevent_t event = record->event;
switch (id) {
case TILDE_NO:
return (event.pressed ? MACRO( D(RALT), T(RBRC), U(RALT), T(SPC), END ) : MACRO_NONE);
case LESS_NO:
return (event.pressed ? MACRO( T(NUBS), END ) : MACRO_NONE);
case GRTR_NO:
return (event.pressed ? MACRO( D(LSFT), T(NUBS), U(LSFT), END ) : MACRO_NONE);
case CIRC_NO:
return (event.pressed ? MACRO( D(LSFT), T(RBRC), U(LSFT), T(SPC), END ) : MACRO_NONE);
case ACUT_NO:
return (event.pressed ? MACRO( D(RALT), T(EQL), U(RALT), T(SPC), END ) : MACRO_NONE);
case GRV_NO:
return (event.pressed ? MACRO( D(LSFT), T(EQL), T(SPC), U(LSFT), END ) : MACRO_NONE);
case LESS_NO_MAC:
return (event.pressed ? MACRO( T(GRV), END ) : MACRO_NONE);
case GRTR_NO_MAC:
return (event.pressed ? MACRO( D(LSFT), T(GRV), U(LSFT), END ) : MACRO_NONE);
case ACUT_NO_MAC:
return (event.pressed ? MACRO( T(EQL), T(SPC), END ) : MACRO_NONE);
}
return MACRO_NONE;
};

View File

@ -0,0 +1,30 @@
# Norwegian Colemak setup with osx/pc toggle
## Motivation
I wanted a Norwegian Colemak setup that worked in a similar way on both my Mac and PC. I also wanted the keyboard to translate from a standard Norwegian keyboard OS setup.
## Overview
The setup is created to be programmer friendly.
- Most of the symbols used in code can be activated without using layers or shift key.
- You can reach the IDE/OS shortcut activators(Ctrl, Win/Cmd, Alt, Shift) with the thumb or the wrist.
- Navigation is prioritized, arrows below the home row.
## PC/Mac toggle
The default setup is for Norwegian keyboard setting(not colemak software variants) on a PC(Windows or Linux) or Mac. Use the Mac/PC toggle button to switch between OSX and PC setup. The settings will be reverted to PC setup each time you restart/connect the keyboard.
## Layers
Since symbols are prioritized in this setup, numbers and function keys are on a new layer. The easiest way to use the layer switch(and also the alt key), is to push your hand right below the little finger, on the key. You will then have all your fingers free to type numbers or press function keys.
## Tap-shift
Tap for the next character to be shifted, hold down for regular shift.
## Comma dot and escape
Comma, dot and escape share buttons with modifier keys. Tap to access these keys, hold down to use the keys as modifier keys.
## Numpad symbols
+-/* are implemented with the numpad keycodes. The benefit is that they will work better with shortcuts in certain programs. For some reason, the default setting in the osx terminal is to not accept numpad characters for '/' and '-'. For a solution, see https://discussions.apple.com/thread/6613968?start=0&tstart=0.
If you really need the norwegian symbols in a program, you can access them using the number toggle button.
## Layout
![keyboard-layout](keyboard-layout.png)

View File

@ -6,23 +6,23 @@
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[BASE] = KEYMAP( [BASE] = KEYMAP(
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_F5, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_F5,
KC_TAB, KC_Q, KC_W, KC_D, KC_F, KC_K, KC_BSLS, KC_TAB, KC_Q, KC_W, KC_D, KC_F, KC_K, KC_BSLS,
CTL_T(KC_ESC), KC_A, KC_S, KC_E, KC_T, KC_G, KC_LCTRL, KC_A, KC_S, KC_E, KC_T, KC_G,
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_LBRC, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_LBRC,
KC_F1, KC_F2, KC_F3, KC_F4, KC_LGUI, KC_F1, KC_F2, KC_F3, KC_F4, KC_LGUI,
/*-*/ /*-*/ /*-*/ /*-*/ /*-*/ KC_VOLD, KC_MUTE, /*-*/ /*-*/ /*-*/ /*-*/ /*-*/ KC_VOLD, KC_MUTE,
/*-*/ /*-*/ /*-*/ /*-*/ /*-*/ /*-*/ KC_VOLU, /*-*/ /*-*/ /*-*/ /*-*/ /*-*/ /*-*/ KC_VOLU,
/*-*/ /*-*/ /*-*/ /*-*/ /*-*/ KC_BSPC, CTL_T(KC_ESC), KC_LALT, /*-*/ /*-*/ /*-*/ /*-*/ /*-*/ KC_BSPC, CTL_T(KC_ESC), KC_LALT,
// //
/*-*/ KC_F6, KC_6, KC_7, KC_8, KC_9, KC_0, KC_EQL, /*-*/ KC_F6, KC_6, KC_7, KC_8, KC_9, KC_0, KC_EQL,
/*-*/ KC_NO, KC_J, KC_U, KC_R, KC_L, KC_SCLN, KC_MINS, /*-*/ KC_NO, KC_J, KC_U, KC_R, KC_L, KC_SCLN, KC_MINS,
/*-*/ /*-*/ KC_Y, KC_N, KC_I, KC_O, KC_H, KC_ENT, /*-*/ /*-*/ KC_Y, KC_N, KC_I, KC_O, KC_H, KC_ENT,
/*-*/ KC_RBRC, KC_P, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, /*-*/ KC_RBRC, KC_P, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT,
/*-*/ /*-*/ /*-*/ KC_RGUI, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, /*-*/ /*-*/ /*-*/ KC_RGUI, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT,
KC_MPLY, KC_MNXT, KC_MPLY, KC_MNXT,
KC_MPRV, KC_MPRV,
KC_RALT, KC_QUOT, KC_SPC KC_RALT, KC_QUOT, KC_SPC
) )
}; };

View File

@ -1,28 +1,41 @@
# Roman's Layout # Roman's Layout
There is only one layer based on [Norman layout](https://normanlayout.info/). There is only one layer, and it is based on [Norman
layout](https://normanlayout.info/).
Looking for multiple-layer layouts? Looking for multiple-layer layouts?
- [Symbols, arrows, plover, HJKL arrows](../romanzolotarev-norman-plover-osx-hjkl/) - [Symbols, arrows, plover, HJKL
arrows](../romanzolotarev-norman-plover-osx-hjkl/)
- [Same with IJKL arrows](../romanzolotarev-norman-plover-osx/) - [Same with IJKL arrows](../romanzolotarev-norman-plover-osx/)
[![keyboard-layout](romanzolotarev-norman-osx.png)](http://www.keyboard-layout-editor.com/#/gists/9e89d54f1ea6eeeb7dab1b2d19d28195) [![keyboard-layout](romanzolotarev-norman-osx.png)](http://www.keyboard-layout-editor.com/#/gists/9e89d54f1ea6eeeb7dab1b2d19d28195)
## Functional Keys ## How to use Vim key
- Tap `F1` to mute microphone via [Shush](http://mizage.com/shush/). It is `CTL_T(KC_ESC)` and it works this way:
- Tap `F2` to copy screenshot to the clipboard.
- Hold `SHIFT` and tap `F2` to save screenshot as a file.
- Tap `F3`, `F4`, `F5`, `F6` to resize a window via [Divvy](http://mizage.com/divvy/).
## CTRL/ESC
CTRL and ESC are frequently used in Vim.
- Tap `CTRL/ESC` to send `ESC`. - Tap `CTRL/ESC` to send `ESC`.
- Hold `CTRL/ESC` to use as `CTRL`. - Hold `CTRL/ESC` to use as `CTRL`.
## Activate N-rollover ## How to activate N-rollover
- Hold left `SHIFT` and right `SHIRT` and then tap `N`. - Hold left `SHIFT` and right `SHIRT` and then tap `N`.
## How to make and flash on OS X
First you need to install few brew packages.
```bash
brew tap osx-cross/avr
brew install dfu-programmer avr-libc teensy_loader_cli
```
Then you can clone this repository, make and flash your ErgoDox.
```bash
git clone https://github.com/romanzolotarev/qmk_firmware
cd qmk_firmware/keyboards/ergodox
# Optionally tweak ./keymaps/romanzolotarev-norman-osx/keymap.c
SLEEP_LED_ENABLED=no KEYMAP=romanzolotarev-norman-osx make teensy
```

View File

@ -0,0 +1,6 @@
Section "InputClass"
Identifier "ErgoDox EZ"
MatchIsKeyboard "on"
MatchProduct "ErgoDox EZ ErgoDox EZ"
Option "XkbLayout" "ergodox_yoruian"
EndSection

View File

@ -0,0 +1,13 @@
ifndef QUANTUM_DIR
include ../../../../Makefile
endif
install-xorg-configuration:
install -m 0664 90-$(KEYBOARD)-$(KEYMAP).conf \
/etc/X11/xorg.conf.d/90-$(KEYBOARD)-$(KEYMAP).conf
install -m 0644 $(KEYBOARD)_$(KEYMAP) \
/usr/share/X11/xkb/symbols/$(KEYBOARD)_$(KEYMAP)
uninstall-xorg-configuration:
-rm -f /etc/X11/xorg.conf.d/90-$(KEYBOARD)-$(KEYMAP).conf
-rm -f /usr/share/X11/xkb/symbols/$(KEYBOARD)_$(KEYMAP)

View File

@ -0,0 +1,102 @@
Snarfangel's YORUIAN for the ErgoDox EZ
‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
DEFAULT
┏━━━┯━━━┯━━━┯━━━┯━━━┯━━━┯━━━┓ ┏━━━┯━━━┯━━━┯━━━┯━━━┯━━━┯━━━┓
┃ ` │ ; │ : │ - │ / │ ( │ < ┃ ┃ > │ ) │ ^ │ * │ ~ │ Γ │ σ
┠───┼───┼───┼───┼───┼───┼───┨ ┠───┼───┼───┼───┼───┼───┼───┨
┃ ⎋ │ . │ y │ o │ r │ ? │ ✦ ┃ ┃ ✦ │ j │ v │ d │ f │ w │ q ┃
┠───┼───┼───┼───┼───┼───┤ ┃ ┃ ├───┼───┼───┼───┼───┼───┨
┃ ⎈ │ u │ i │ a │ n │ ! ├───┨ ┠───┤ m │ h │ t │ s │ c │ ⎈ ┃
┠───┼───┼───┼───┼───┼───┤ ❖ ┃ ┃ ❖ ├───┼───┼───┼───┼───┼───┨
┃ λ │ ' │ " │ , │ _ │ = │ ┃ ┃ │ k │ l │ p │ g │ b │ x ┃
┠───┼───┼───┼───┼───╆━━━┷━━━┛ ┗━━━┷━━━╅───┼───┼───┼───┼───┨
┃ ⎀ │ E │ │ │ ◆ ┃ ┃ ◆ │ │ │ z │ ⎙ ┃
┗━━━┷━━━┷━━━┷━━━┷━━━┛ ┗━━━┷━━━┷━━━┷━━━┷━━━┛
┏━━━┯━━━┓ ┏━━━┯━━━┓
┃ ⌫ │ ⌥ ┃ ┃ ⎄ │ ↹ ┃
┏━━━╃───┼───┨ ┠───┼───╄━━━┓
┃ │ │ ┃ ┃ │ │ ┃
┃ e │ ⇧ ├───┨ ┠───┤ ⏎ │ ␣ ┃
┃ │ │ ┃ ┃ │ │ ┃
┗━━━┷━━━┷━━━┛ ┗━━━┷━━━┷━━━┛
SHIFTED
┏━━━┯━━━┯━━━┯━━━┯━━━┯━━━┯━━━┓ ┏━━━┯━━━┯━━━┯━━━┯━━━┯━━━┯━━━┓
┃ 9 │ 7 │ 5 │ 3 │ 1 │ [ │ { ┃ ┃ } │ ] │ 0 │ 2 │ 4 │ 6 │ 8 ┃
┠───┼───┼───┼───┼───┼───┼───┨ ┠───┼───┼───┼───┼───┼───┼───┨
┃ │ * │ Y │ O │ R │ \ │ ┃ ┃ │ J │ V │ D │ F │ W │ Q ┃
┠───┼───┼───┼───┼───┼───┤ ┃ ┃ ├───┼───┼───┼───┼───┼───┨
┃ │ U │ I │ A │ N │ | ├───┨ ┠───┤ M │ H │ T │ S │ C │ ┃
┠───┼───┼───┼───┼───┼───┤ ┃ ┃ ├───┼───┼───┼───┼───┼───┨
┃ │ # │ $ │ @ │ & │ + │ ┃ ┃ │ K │ L │ P │ G │ B │ X ┃
┠───┼───┼───┼───┼───╆━━━┷━━━┛ ┗━━━┷━━━╅───┼───┼───┼───┼───┨
┃ │ │ │ │ ┃ ┃ │ │ │ Z │ ┃
┗━━━┷━━━┷━━━┷━━━┷━━━┛ ┗━━━┷━━━┷━━━┷━━━┷━━━┛
┏━━━┯━━━┓ ┏━━━┯━━━┓
┃ │ ┃ ┃ │ ┃
┏━━━╃───┼───┨ ┠───┼───╄━━━┓
┃ │ │ ┃ ┃ │ │ ┃
┃ │ ├───┨ ┠───┤ │ ┃
┃ │ │ ┃ ┃ │ │ ┃
┗━━━┷━━━┷━━━┛ ┗━━━┷━━━┷━━━┛
λ LAYER
┏━━━┯━━━┯━━━┯━━━┯━━━┯━━━┯━━━┓ ┏━━━┯━━━┯━━━┯━━━┯━━━┯━━━┯━━━┓
┃ │ │ │ │ │ │ ┃ ┃ │ │ ⑤ │ ⑥ │ ⑦ │ ⑧ │ ⑨ ┃
┠───┼───┼───┼───┼───┼───┼───┨ ┠───┼───┼───┼───┼───┼───┼───┨
┃ │ │ │ │ │ │ ┃ ┃ │ │ ① │ ② │ ③ │ ④ │ ⑩ ┃
┠───┼───┼───┼───┼───┼───┤ ┃ ┃ ├───┼───┼───┼───┼───┼───┨
┃ │ │ │ │ │ ├───┨ ┠───┤ ⎉ │ ← │ ↓ │ ↑ │ → │ ⑪ ┃
┠───┼───┼───┼───┼───┼───┤ ┃ ┃ ├───┼───┼───┼───┼───┼───┨
┃ λ │ │ │ │ │ │ ┃ ┃ │ │ ⇱ │ ⎘ │ ⎗ │ ⇲ │ ⑫ ┃
┠───┼───┼───┼───┼───╆━━━┷━━━┛ ┗━━━┷━━━╅───┼───┼───┼───┼───┨
┃ │ │ │ │ ┃ ┃ │ │ │ │ ┃
┗━━━┷━━━┷━━━┷━━━┷━━━┛ ┗━━━┷━━━┷━━━┷━━━┷━━━┛
┏━━━┯━━━┓ ┏━━━┯━━━┓
┃ │ ┃ ┃ │ ┃
┏━━━╃───┼───┨ ┠───┼───╄━━━┓
┃ │ │ ┃ ┃ │ │ ┃
┃ │ ├───┨ ┠───┤ │ ┃
┃ │ │ ┃ ┃ │ │ ┃
┗━━━┷━━━┷━━━┛ ┗━━━┷━━━┷━━━┛
Installation (X only)
‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
1. Build and flash firmware as usual
2. sudo make install-xorg-configuration
3. Restart X
Features
‾‾‾‾‾‾‾‾
• E on the thumb
• Emacs-friendly
• Symmetric control keys for finger wear levelling
• Greek and subscript dead keys
• Compose key for arbitrary Unicode input via ~/.XCompose
Don't Cares
‾‾‾‾‾‾‾‾‾‾‾
• Easy migration from QWERTY
• Compatbility with non-XKB systems
• Mouse emulation
• Media keys
Acknowledgements
‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
Snarfangel, for designing the layout.
The GNU FreeFont project and Steve White, for adding new keyboard
symbols.
Xah Lee, for http://xahlee.info/comp/unicode_computing_symbols.html
Colophon
‾‾‾‾‾‾‾‾
This file is best-viewed with an SVN version of GNU FreeFont Mono.

View File

@ -0,0 +1,34 @@
partial alphanumeric_keys modifier_keys
xkb_symbols "ergodox_yoruian" {
include "us"
name[Group1]= "English (yoruian-1.0.0)";
replace key <KP2> { [ Multi_key, Multi_key ] };
replace key <KP3> { [ Hyper_L, Hyper_L ] };
replace key <AE09> { [ grave, 9 ] };
replace key <AE07> { [ semicolon, 7 ] };
replace key <AE05> { [ colon, 5 ] };
replace key <AE03> { [ minus, 3 ] };
replace key <AE01> { [ slash, 1 ] };
replace key <AE10> { [ asciicircum, 0 ] };
replace key <AE02> { [ percent, 2 ] };
replace key <AE04> { [ asciitilde, 4 ] };
replace key <AE06> { [ dead_greek, 6 ] };
replace key <AE08> { [ dead_caron, 8 ] };
replace key <KP1> { [ E, E ] };
replace key <AD12> { [ period, asterisk ] };
replace key <BKSL> { [ question, backslash ] };
replace key <AC10> { [ exclam, bar ] };
replace key <AC11> { [ apostrophe, numbersign ] };
replace key <AB08> { [ quotedbl, dollar ] };
replace key <AB09> { [ comma, at ] };
replace key <AB10> { [ underscore, ampersand ] };
replace key <KP0> { [ equal, plus ] };
replace key <TLDE> { [ parenleft, bracketleft ] };
replace key <AE11> { [ less, braceleft ] };
replace key <AE12> { [ greater, braceright ] };
replace key <AD11> { [ parenright, bracketright ] };
modifier_map none { <HYPR> };
modifier_map Mod3 { <KP3> };
};

View File

@ -0,0 +1,61 @@
/*
* Copyright 2016 Thomas Fitzsimmons <fitzsim@fitzsim.org>
*
* 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 3 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/>.
*/
#include "yoruian.h"
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[0] = KEYMAP\
(9, 7, 5, 3, 1, GRV, MINS, EQL, LBRC, 0, 2, 4, 6, 8,
ES, RBRC, Y, O, R, BSLS, P3, P3, J, V, D, F, W, Q,
LC, U, I, A, N, SCLN, M, H, T, S, C, RC,
FF, QUOT, COMM, DOT, SLSH, P0, LGUI, LGUI, K, L, P, G, B, X,
IN, P1, NO, NO, LALT, LALT, NO, NO, Z, PS,
BSPC, RALT, P2, TAB,
NO, NO,
E, LSFT, NO, NO, ENT, SPC),
[1] = KEYMAP\
(TR, TR, TR, TR, TR, TR, TR, TR, TR, F5, F6, F7, F8, F9,
TR, TR, TR, TR, TR, TR, TR, TR, TR, F1, F2, F3, F4, FT,
TR, TR, TR, TR, TR, TR, PAUS, LEFT, DOWN, UP, RGHT, FE,
TR, TR, TR, TR, TR, TR, TR, TR, TR, HOME, PGDN, PGUP, END, FW,
TR, TR, TR, TR, TR, TR, TR, TR, TR, TR,
TR, TR, TR, TR,
TR, TR,
TR, TR, TR, TR, TR, TR),
};
const uint16_t PROGMEM fn_actions[] = {
};
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) {
return MACRO_NONE;
};
void matrix_init_user(void) {
};
void matrix_scan_user(void) {
ergodox_board_led_off();
ergodox_right_led_1_off();
ergodox_right_led_2_off();
ergodox_right_led_3_off();
};
/*
* Local Variables:
* electric-indent-mode: nil
* End:
*/

View File

@ -0,0 +1,61 @@
/*
* Copyright 2016 Thomas Fitzsimmons <fitzsim@fitzsim.org>
*
* 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 3 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/>.
*/
#include "ergodox.h"
#include "debug.h"
#include "action_layer.h"
#undef KEYMAP
#define KEYMAP\
( \
/* Spacial positions. */ \
k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0A, k0B, k0C, k0D, \
k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1A, k1B, k1C, k1D, \
k20, k21, k22, k23, k24, k25, k28, k29, k2A, k2B, k2C, k2D, \
k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3A, k3B, k3C, k3D, \
k40, k41, k42, k43, k44, k49, k4A, k4B, k4C, k4D, \
k55, k56, k57, k58, \
k54, k59, \
k53, k52, k51, k5C, k5B, k5A) \
\
/* Matrix positions. */ \
{ \
{ KC_##k00, KC_##k10, KC_##k20, KC_##k30, KC_##k40, KC_NO }, \
{ KC_##k01, KC_##k11, KC_##k21, KC_##k31, KC_##k41, KC_##k51 }, \
{ KC_##k02, KC_##k12, KC_##k22, KC_##k32, KC_##k42, KC_##k52 }, \
{ KC_##k03, KC_##k13, KC_##k23, KC_##k33, KC_##k43, KC_##k53 }, \
{ KC_##k04, KC_##k14, KC_##k24, KC_##k34, KC_##k44, KC_##k54 }, \
{ KC_##k05, KC_##k15, KC_##k25, KC_##k35, KC_NO, KC_##k55 }, \
{ KC_##k06, KC_##k16, KC_NO, KC_##k36, KC_NO, KC_##k56 }, \
{ KC_##k07, KC_##k17, KC_NO, KC_##k37, KC_NO, KC_##k57 }, \
{ KC_##k08, KC_##k18, KC_##k28, KC_##k38, KC_NO, KC_##k58 }, \
{ KC_##k09, KC_##k19, KC_##k29, KC_##k39, KC_##k49, KC_##k59 }, \
{ KC_##k0A, KC_##k1A, KC_##k2A, KC_##k3A, KC_##k4A, KC_##k5A }, \
{ KC_##k0B, KC_##k1B, KC_##k2B, KC_##k3B, KC_##k4B, KC_##k5B }, \
{ KC_##k0C, KC_##k1C, KC_##k2C, KC_##k3C, KC_##k4C, KC_##k5C }, \
{ KC_##k0D, KC_##k1D, KC_##k2D, KC_##k3D, KC_##k4D, KC_NO } \
}
#define KC_ES KC_ESC
#define KC_LC KC_LCTL
#define KC_RC KC_RCTL
#define KC_FF MO(1)
#define KC_IN KC_INS
#define KC_PS KC_PSCR
#define KC_TR KC_TRNS
#define KC_FT KC_F10
#define KC_FE KC_F11
#define KC_FW KC_F12

74
keyboards/jd40/Makefile Normal file
View File

@ -0,0 +1,74 @@
# MCU name
#MCU = at90usb1287
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=4096
# Build Options
# comment out to disable the options.
#
BOOTMAGIC_ENABLE ?= yes # Virtual DIP switch configuration(+1000)
MOUSEKEY_ENABLE ?= yes # Mouse keys(+4700)
EXTRAKEY_ENABLE ?= yes # Audio control and System control(+450)
# CONSOLE_ENABLE ?= yes # Console for debug(+400)
# COMMAND_ENABLE ?= yes # Commands for debug and configuration
KEYBOARD_LOCK_ENABLE ?= yes # Allow locking of keyboard via magic key
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
# SLEEP_LED_ENABLE ?= yes # Breathing sleep LED during USB suspend
NKRO_ENABLE ?= yes # USB 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
# MIDI_ENABLE ?= YES # MIDI controls
# UNICODE_ENABLE ?= YES # Unicode
# BLUETOOTH_ENABLE ?= yes # Enable Bluetooth with the Adafruit EZ-Key HID
RGBLIGHT_ENABLE ?= yes # Enable RGB Underglow
ifndef QUANTUM_DIR
include ../../Makefile
endif

79
keyboards/jd40/config.h Normal file
View File

@ -0,0 +1,79 @@
/*
Copyright 2012 Jun Wako <wakojun@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 CONFIG_H
#define CONFIG_H
#include "config_common.h"
/* USB Device descriptor parameter */
#define VENDOR_ID 0xFEED
#define PRODUCT_ID 0x6060
#define DEVICE_VER 0x0001
#define MANUFACTURER geekhack
#define PRODUCT jd40v2
#define DESCRIPTION t.m.k. keyboard firmware for JD40 MKII
/* key matrix size */
#define MATRIX_ROWS 4
#define MATRIX_COLS 12
/*
* Keyboard Matrix Assignments
*
* Change this to how you wired your keyboard
* COLS: AVR pins used for columns, left to right
* ROWS: AVR pins used for rows, top to bottom
* DIODE_DIRECTION: COL2ROW = COL = Anode (+), ROW = Cathode (-, marked on diode)
* ROW2COL = ROW = Anode (+), COL = Cathode (-, marked on diode)
*
*/
#define MATRIX_ROW_PINS { F0, F1, F5, B4 }
#define MATRIX_COL_PINS { F4, D7, B5, B6, C6, C7, D4, D6, D5, D0, D1, D2 }
#define UNUSED_PINS
/* COL2ROW or ROW2COL */
#define DIODE_DIRECTION COL2ROW
/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
#define DEBOUNCING_DELAY 5
/* define if matrix has ghost (lacks anti-ghosting diodes) */
//#define MATRIX_HAS_GHOST
/* number of backlight levels */
#define BACKLIGHT_LEVELS 3
/* 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 magic key command */
#define IS_COMMAND() ( \
keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \
)
#define RGB_DI_PIN D3
#define RGBLIGHT_TIMER
#define RGBLED_NUM 12 // Number of LEDs
#define RGBLIGHT_HUE_STEP 8
#define RGBLIGHT_SAT_STEP 8
#define RGBLIGHT_VAL_STEP 8
#endif

26
keyboards/jd40/jd40.c Normal file
View File

@ -0,0 +1,26 @@
#include "jd40.h"
void led_set_kb(uint8_t usb_led) {
// put your keyboard LED indicator (ex: Caps Lock LED) toggling code here
// if (usb_led & (1<<USB_LED_CAPS_LOCK)) {
// gh60_caps_led_on();
// } else {
// gh60_caps_led_off();
// }
// if (usb_led & (1<<USB_LED_NUM_LOCK)) {
// gh60_esc_led_on();
// } else {
// gh60_esc_led_off();
// }
// if (usb_led & (1<<USB_LED_SCROLL_LOCK)) {
// gh60_fn_led_on();
// } else {
// gh60_fn_led_off();
// }
led_set_user(usb_led);
}

45
keyboards/jd40/jd40.h Normal file
View File

@ -0,0 +1,45 @@
#ifndef JD40_H
#define JD40_H
#include "quantum.h"
#include "led.h"
/* GH60 LEDs
* GPIO pads
* 0 F7 WASD LEDs
* 1 F6 ESC LED
* 2 F5 FN LED
* 3 F4 POKER Arrow LEDs
* B2 Capslock LED
* B0 not connected
*/
/*
inline void gh60_caps_led_on(void) { DDRB |= (1<<2); PORTB &= ~(1<<2); }
inline void gh60_poker_leds_on(void) { DDRF |= (1<<4); PORTF &= ~(1<<4); }
inline void gh60_fn_led_on(void) { DDRF |= (1<<5); PORTF &= ~(1<<5); }
inline void gh60_esc_led_on(void) { DDRF |= (1<<6); PORTF &= ~(1<<6); }
inline void gh60_wasd_leds_on(void) { DDRF |= (1<<7); PORTF &= ~(1<<7); }
inline void gh60_caps_led_off(void) { DDRB &= ~(1<<2); PORTB &= ~(1<<2); }
inline void gh60_poker_leds_off(void) { DDRF &= ~(1<<4); PORTF &= ~(1<<4); }
inline void gh60_fn_led_off(void) { DDRF &= ~(1<<5); PORTF &= ~(1<<5); }
inline void gh60_esc_led_off(void) { DDRF &= ~(1<<6); PORTF &= ~(1<<6); }
inline void gh60_wasd_leds_off(void) { DDRF &= ~(1<<7); PORTF &= ~(1<<7); }
*/
/* JD40 MKII keymap definition macro
*/
#define KEYMAP( \
K01, K02, K03, K04, K05, K06, K07, K08, K09, K10, K11, K12, \
K13, K14, K15, K16, K17, K18, K19, K20, K21, K22, K23, \
K24, K25, K26, K27, K28, K29, K30, K31, K32, K33, K34, \
K35, K36, K37, K38, K39, K40, K41, K42, K43, K44 \
) { \
{ KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07, KC_##K08, KC_##K09, KC_##K10, KC_##K11, KC_##K12 }, \
{ KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17, KC_##K18, KC_##K19, KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_NO }, \
{ KC_##K24, KC_##K25, KC_##K26, KC_##K27, KC_##K28, KC_##K29, KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_##K34, KC_NO }, \
{ KC_##K35, KC_##K36, KC_##K37, KC_##K38, KC_##K39, KC_NO, KC_##K40, KC_##K41, KC_##K42, KC_##K43, KC_##K44, KC_NO } \
}
#endif

View File

@ -0,0 +1,164 @@
#include "jd40.h"
#include "action_layer.h"
#define _BL 0
#define _AL 1
#define _FL 2
#define _UL 3
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_BL] = KEYMAP(
F12, Q, W, E, R, T, Y, U, I, O, P, BSPC,
TAB, A, S, D, F, G, H, J, K, L, ENT,
LSFT, Z, X, C, V, B, N, M, COMM, UP, DOT,
LCTL, LGUI, LALT, FN0, SPC, SPC, FN0, LEFT, DOWN, RIGHT ),
[_AL] = KEYMAP(
GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, DEL,
CAPS, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0,
TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, SCLN, PGUP, QUOT,
TRNS, TRNS, TRNS, TRNS, FN3, FN3, TRNS, HOME, PGDN, END ),
[_FL] = KEYMAP(
TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS,
TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS,
TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS,
TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS ),
[_UL] = KEYMAP(
TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS,
TRNS, FN4, FN5, FN11, FN10, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS,
TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS,
TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS ),
};
enum function_id {
RGBLED_TOGGLE,
RGBLED_STEP_MODE,
RGBLED_INCREASE_HUE,
RGBLED_DECREASE_HUE,
RGBLED_INCREASE_SAT,
RGBLED_DECREASE_SAT,
RGBLED_INCREASE_VAL,
RGBLED_DECREASE_VAL,
SHIFT_ESC,
};
const uint16_t PROGMEM fn_actions[] = {
[0] = ACTION_LAYER_MOMENTARY(1), // Momentary Fn overlay
[1] = ACTION_LAYER_TOGGLE(2), // Toggle Arrow Layer overlay
[2] = ACTION_LAYER_TAP_KEY(2, KC_CAPS), // Tap to toggle caps lock and hold to activate function layer
[3] = ACTION_LAYER_TOGGLE(3), // Toggle Underglow Layer overlay
[4] = ACTION_FUNCTION(RGBLED_TOGGLE), //Turn on/off underglow
[5] = ACTION_FUNCTION(RGBLED_STEP_MODE), // Change underglow mode
[6] = ACTION_FUNCTION(RGBLED_INCREASE_HUE),
[7] = ACTION_FUNCTION(RGBLED_DECREASE_HUE),
[8] = ACTION_FUNCTION(RGBLED_INCREASE_SAT),
[9] = ACTION_FUNCTION(RGBLED_DECREASE_SAT),
[10] = ACTION_FUNCTION(RGBLED_INCREASE_VAL),
[11] = ACTION_FUNCTION(RGBLED_DECREASE_VAL),
[12] = ACTION_FUNCTION(SHIFT_ESC),
};
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;
};
void matrix_scan_user(void) {
// Layer LED indicators
// ESC led on when in function layer, WASD cluster leds enabled when on arrow cluster
uint32_t layer = layer_state;
if (layer & (1<<1)) {
//gh60_wasd_leds_on();
} else {
//gh60_wasd_leds_off();
}
if (layer & (1<<2)) {
//gh60_esc_led_on();
} else {
//gh60_esc_led_off();
}
};
#define MODS_CTRL_MASK (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT))
void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) {
switch (id) {
case RGBLED_TOGGLE:
//led operations
if (record->event.pressed) {
rgblight_toggle();
}
break;
case RGBLED_INCREASE_HUE:
if (record->event.pressed) {
rgblight_increase_hue();
}
break;
case RGBLED_DECREASE_HUE:
if (record->event.pressed) {
rgblight_decrease_hue();
}
break;
case RGBLED_INCREASE_SAT:
if (record->event.pressed) {
rgblight_increase_sat();
}
break;
case RGBLED_DECREASE_SAT:
if (record->event.pressed) {
rgblight_decrease_sat();
}
break;
case RGBLED_INCREASE_VAL:
if (record->event.pressed) {
rgblight_increase_val();
}
break;
case RGBLED_DECREASE_VAL:
if (record->event.pressed) {
rgblight_decrease_val();
}
break;
case RGBLED_STEP_MODE:
if (record->event.pressed) {
rgblight_step();
}
break;
static uint8_t shift_esc_shift_mask;
// Shift + ESC = ~
case SHIFT_ESC:
shift_esc_shift_mask = get_mods()&MODS_CTRL_MASK;
if (record->event.pressed) {
if (shift_esc_shift_mask) {
add_key(KC_GRV);
send_keyboard_report();
} else {
add_key(KC_ESC);
send_keyboard_report();
}
} else {
if (shift_esc_shift_mask) {
del_key(KC_GRV);
send_keyboard_report();
} else {
del_key(KC_ESC);
send_keyboard_report();
}
}
break;
}
};

17
keyboards/jd40/readme.md Normal file
View File

@ -0,0 +1,17 @@
## jd40 mkii keyboard firmware
Pins:
MATRIX_ROW_PINS { F0, F1, F5, B4 }
MATRIX_COL_PINS { F4, D7, B5, B6, C6, C7, D4, D6, D5, D0, D1, D2 }
RGB_DI_PIN D3
======================
## Quantum MK Firmware
For the full Quantum feature list, see [the parent readme.md](/readme.md).
## Building
Download or clone the whole firmware and navigate to the keyboards/jd40 folder.
Once your dev env is setup, you'll be able to type `make` to generate your .hex - you can then use the Amtel Flip to program your .hex file.

69
keyboards/jd40/rules.mk Normal file
View File

@ -0,0 +1,69 @@
# MCU name
#MCU = at90usb1287
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=4096
# Build Options
# comment out to disable the options.
#
BOOTMAGIC_ENABLE ?= yes # Virtual DIP switch configuration(+1000)
MOUSEKEY_ENABLE ?= yes # Mouse keys(+4700)
EXTRAKEY_ENABLE ?= yes # Audio control and System control(+450)
# CONSOLE_ENABLE ?= yes # Console for debug(+400)
# COMMAND_ENABLE ?= yes # Commands for debug and configuration
KEYBOARD_LOCK_ENABLE ?= yes # Allow locking of keyboard via magic key
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
# SLEEP_LED_ENABLE ?= yes # Breathing sleep LED during USB suspend
NKRO_ENABLE ?= yes # USB 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
# MIDI_ENABLE ?= YES # MIDI controls
# UNICODE_ENABLE ?= YES # Unicode
# BLUETOOTH_ENABLE ?= yes # Enable Bluetooth with the Adafruit EZ-Key HID
RGBLIGHT_ENABLE ?= yes # Enable RGB Underglow

View File

@ -0,0 +1,7 @@
#ifndef CONFIG_USER_H
#define CONFIG_USER_H
#endif
#include "../../config.h"
#define PREVENT_STUCK_MODIFIERS

View File

@ -4,6 +4,13 @@
#endif #endif
#include "keymap_german.h" #include "keymap_german.h"
// for intellisense, has to be commented for building
/*
#include "..\..\..\..\quantum\keymap_extras\keymap_german.h"
#include "..\..\..\..\quantum\keymap_common.h"
#include "..\..\..\..\tmk_core\common\keycode.h"
*/
#define _______ KC_TRNS #define _______ KC_TRNS
/* This Layout tries to emulate the Bone2 Variant of Neo2, and is intended to be used with a German QWERTZ Softwarelayout. /* This Layout tries to emulate the Bone2 Variant of Neo2, and is intended to be used with a German QWERTZ Softwarelayout.
@ -24,14 +31,14 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* |------+------+------+------+------+------|------+------+------+------+------+------| * |------+------+------+------+------+------|------+------+------+------+------+------|
* | Shift| F | V | Ü | Ä | Ö | Y | Z | , | . | K |Shift | * | Shift| F | V | Ü | Ä | Ö | Y | Z | , | . | K |Shift |
* |------+------+------+------+------+------+------+------+------+------+------+------| * |------+------+------+------+------+------+------+------+------+------+------+------|
* | GUI | Ctrl | Alt | M4 | M2 | Space | M2 | M4 | | Ctrl | Esc | * | Ctrl | GUI | Alt | M4 | M2 | Space | M2 | M4 | Alt | Esc | Ctrl |
* `-----------------------------------------------------------------------------------' * `-----------------------------------------------------------------------------------'
*/ */
[0] = { [0] = {
{ DE_Q, DE_J, DE_D, DE_U, DE_A, DE_X, DE_P, DE_H, DE_L, DE_M, DE_W, DE_SS }, { DE_Q, DE_J, DE_D, DE_U, DE_A, DE_X, DE_P, DE_H, DE_L, DE_M, DE_W, DE_SS },
{ LT(1,KC_TAB), DE_C, DE_T, DE_I, DE_E, DE_O, DE_B, DE_N, DE_R, DE_S, DE_G, LT(1,KC_ENT) }, { LT(1,KC_TAB), DE_C, DE_T, DE_I, DE_E, DE_O, DE_B, DE_N, DE_R, DE_S, DE_G, LT(1,KC_ENT) },
{ KC_LSFT, DE_F, DE_V, DE_UE, DE_AE, DE_OE, DE_Y, DE_Z, DE_COMM, DE_DOT, DE_K, KC_LSFT }, { KC_LSFT, DE_F, DE_V, DE_UE, DE_AE, DE_OE, DE_Y, DE_Z, DE_COMM, DE_DOT, DE_K, KC_LSFT },
{ KC_LGUI, KC_LCTL, KC_LALT, MO(4), MO(2), KC_SPC, KC_SPC, MO(2), MO(4), KC_NO, KC_RCTL, KC_ESC } { KC_LCTL, KC_RGUI, KC_LALT, MO(4), MO(2), KC_SPC, KC_SPC, MO(2), MO(4), KC_RALT, KC_ESC, KC_RCTL }
}, },
/* M1 Special Characters /* M1 Special Characters
@ -43,7 +50,7 @@ very ergonomic placement for coding
* |------+------+------+------+------+------|------+------+------+------+------+------| * |------+------+------+------+------+------|------+------+------+------+------+------|
* | Shift| # | $ | | | ~ | | + | % | " | ' | ; |Shift | * | Shift| # | $ | | | ~ | | + | % | " | ' | ; |Shift |
* |------+------+------+------+------+------+------+------+------+------+------+------| * |------+------+------+------+------+------+------+------+------+------+------+------|
* | GUI | Ctrl | Alt | M4 | M2 | Space | M2 | M4 | | Ctrl | Esc | * | Ctrl | GUI | Alt | M4 | M2 | Space | M2 | M4 | Alt | Esc | Ctrl |
* `-----------------------------------------------------------------------------------' * `-----------------------------------------------------------------------------------'
*/ */
[1] = { [1] = {
@ -56,37 +63,37 @@ very ergonomic placement for coding
/* Navigation & Number Blocks /* Navigation & Number Blocks
very easy to get used to & intuituve placement very easy to get used to & intuituve placement
* ,-----------------------------------------------------------------------------------. * ,-----------------------------------------------------------------------------------.
* | | PgUp | Bksp | Up | DEL | PgDn | | 7 | 8 | 9 | | | * | | PgUp | Bksp | Up | DEL | PgDn | | 7 | 8 | 9 | | Ins |
* |------+------+------+------+------+-------------+------+------+------+------+------| * |------+------+------+------+------+-------------+------+------+------+------+------|
* | Tab | Home | Lft | Down | Right| End | . | 4 | 5 | 6 | , | Enter| * | Tab | Home | Lft | Down | Right| End | . | 4 | 5 | 6 | , | Enter|
* |------+------+------+------+------+------|------+------+------+------+------+------| * |------+------+------+------+------+------|------+------+------+------+------+------|
* | Shift| | Tab | Ins | Enter| | 0 | 1 | 2 | 3 | ; |Shift | * | Shift| | Tab | | Enter| | 0 | 1 | 2 | 3 | ; |Shift |
* |------+------+------+------+------+------+------+------+------+------+------+------| * |------+------+------+------+------+------+------+------+------+------+------+------|
* | GUI | Ctrl | Alt | M3 | M2 | Space | M2 | M3 | | Ctrl | Esc | * | Ctrl | GUI | Alt | M3 | M2 | Space | M2 | M3 | Alt | Esc | Ctrl |
* `-----------------------------------------------------------------------------------' * `-----------------------------------------------------------------------------------'
*/ */
[2] = { [2] = {
{ KC_NO, KC_PGUP, KC_BSPC, KC_UP, KC_DEL, KC_PGDN, KC_NO, DE_7, DE_8, DE_9, KC_NO, KC_NO }, { KC_NO, KC_PGUP, KC_BSPC, KC_UP, KC_DEL, KC_PGDN, KC_NO, DE_7, DE_8, DE_9, KC_NO, KC_INS },
{ KC_TAB, KC_HOME, KC_LEFT, KC_DOWN, KC_RGHT, KC_END, DE_DOT, DE_4, DE_5, DE_6, DE_COMM, KC_ENT }, { KC_TAB, KC_HOME, KC_LEFT, KC_DOWN, KC_RGHT, KC_END, DE_DOT, DE_4, DE_5, DE_6, DE_COMM, KC_ENT },
{ _______, KC_NO, KC_TAB, KC_INS, KC_ENT, KC_NO, DE_0, DE_1, DE_2, DE_3, DE_SCLN, _______ }, { _______, KC_NO, KC_TAB, KC_NO, KC_ENT, KC_NO, DE_0, DE_1, DE_2, DE_3, DE_SCLN, _______ },
{ _______, _______, _______, MO(3), _______, _______, _______, _______, MO(3), _______, _______, _______ } { _______, _______, _______, MO(3), _______, _______, _______, _______, MO(3), _______, _______, _______ }
}, },
/* Flipped Navigation & Number Blocks for one handed use /* Flipped Navigation & Number Blocks for one handed use
accessed by sliding from M2 to M3 with thumb accessed by sliding from M2 to M3 with thumb
* ,-----------------------------------------------------------------------------------. * ,-----------------------------------------------------------------------------------.
* | | | 7 | 8 | 9 | | PgUp | Bksp | Up | DEL | PgDn | | * | Ins | | 7 | 8 | 9 | | PgUp | Bksp | Up | DEL | PgDn | |
* |------+------+------+------+------+-------------+------+------+------+------+------| * |------+------+------+------+------+-------------+------+------+------+------+------|
* | Tab | . | 4 | 5 | 6 | , | Home | Left | Down | Right| End | Enter| * | Tab | . | 4 | 5 | 6 | , | Home | Left | Down | Right| End | Enter|
* |------+------+------+------+------+------|------+------+------+------+------+------| * |------+------+------+------+------+------|------+------+------+------+------+------|
* | Shift| 0 | 1 | 2 | 3 | ; | | Tab | Ins | Enter| |Shift | * | Shift| 0 | 1 | 2 | 3 | ; | | Tab | Ins | Enter| |Shift |
* |------+------+------+------+------+------+------+------+------+------+------+------| * |------+------+------+------+------+------+------+------+------+------+------+------|
* | GUI | Ctrl | Alt | M3 | | Space | | M3 | | Ctrl | Esc | * | Ctrl | GUI | Alt | M3 | | Space | | M3 | Alt | Esc | Ctrl |
* `-----------------------------------------------------------------------------------' * `-----------------------------------------------------------------------------------'
*/ */
[3] = { [3] = {
{ KC_NO, KC_NO, DE_7, DE_8, DE_9, KC_NO, KC_PGUP, KC_BSPC, KC_UP, KC_DEL, KC_PGDN, KC_NO }, { KC_INS, KC_NO, DE_7, DE_8, DE_9, KC_NO, KC_PGUP, KC_BSPC, KC_UP, KC_DEL, KC_PGDN, KC_NO },
{ _______, DE_DOT, DE_4, DE_5, DE_6, DE_COMM, KC_HOME, KC_LEFT, KC_DOWN, KC_RGHT, KC_END, _______ }, { _______, DE_DOT, DE_4, DE_5, DE_6, DE_COMM, KC_HOME, KC_LEFT, KC_DOWN, KC_RGHT, KC_END, _______ },
{ _______, DE_0, DE_1, DE_2, DE_3, DE_SCLN, KC_NO, KC_TAB, KC_INS, KC_ENT, KC_NO, _______ }, { _______, DE_0, DE_1, DE_2, DE_3, DE_SCLN, KC_NO, KC_TAB, KC_INS, KC_ENT, KC_NO, _______ },
{ _______, _______, _______, _______, KC_NO, _______, _______, KC_NO, _______, _______, _______, _______ } { _______, _______, _______, _______, KC_NO, _______, _______, KC_NO, _______, _______, _______, _______ }
@ -102,7 +109,7 @@ slide from m4 to m5 to access flipped version
* |------+------+------+------+------+------|------+------+------+------+------+------| * |------+------+------+------+------+------|------+------+------+------+------+------|
* | Shift| | Prev | Play | Next | | ² | F1 | F2 | F3 | F10 |Shift | * | Shift| | Prev | Play | Next | | ² | F1 | F2 | F3 | F10 |Shift |
* |------+------+------+------+------+------+------+------+------+------+------+------| * |------+------+------+------+------+------+------+------+------+------+------+------|
* | GUI | Ctrl | Alt | M4 | M5 | Space | M5 | M4 | | Ctrl | Esc | * | Ctrl | GUI | Alt | M4 | M5 | Space | M5 | M4 | Alt | Esc | Ctrl |
* `-----------------------------------------------------------------------------------' * `-----------------------------------------------------------------------------------'
*/ */
[4] = { [4] = {
@ -115,19 +122,19 @@ slide from m4 to m5 to access flipped version
/* flipped Function & Media Keys /* flipped Function & Media Keys
* ,-----------------------------------------------------------------------------------. * ,-----------------------------------------------------------------------------------.
* | | | F7 | F8 | F9 | | | Print|Scroll| Pause| | | * | | | F7 | F8 | F9 | F12 | | Print|Scroll| Pause| | |
* |------+------+------+------+------+-------------+------+------+------+------+------| * |------+------+------+------+------+-------------+------+------+------+------+------|
* | | ³ | F4 | F5 | F6 | | | Mute | Vol- | Vol+ | | | * | | ³ | F4 | F5 | F6 | F11 | | Mute | Vol- | Vol+ | | |
* |------+------+------+------+------+------|------+------+------+------+------+------| * |------+------+------+------+------+------|------+------+------+------+------+------|
* | Shift| ² | F1 | F2 | F3 | | | Prev | Play | Next | |Shift | * | Shift| ² | F1 | F2 | F3 | F10 | | Prev | Play | Next | |Shift |
* |------+------+------+------+------+------+------+------+------+------+------+------| * |------+------+------+------+------+------+------+------+------+------+------+------|
* | GUI | Ctrl | Alt | | M5 | Space | M5 | | | Ctrl | Esc | * | Ctrl | GUI | Alt | | M5 | Space | M5 | | Alt | Esc | Ctrl |
* `-----------------------------------------------------------------------------------' * `-----------------------------------------------------------------------------------'
*/ */
[5] = { [5] = {
{ KC_NO, KC_NO, KC_F7, KC_F8, KC_F9, KC_NO, KC_NO, KC_PSCR, KC_SLCK, KC_PAUS, KC_NO, KC_NO }, { KC_NO, KC_NO, KC_F7, KC_F8, KC_F9, KC_F12, KC_NO, KC_PSCR, KC_SLCK, KC_PAUS, KC_NO, KC_NO },
{ KC_NO, DE_SQ3, KC_F4, KC_F5, KC_F6, KC_NO, KC_NO, KC_MUTE, KC_VOLD, KC_VOLU, KC_NO, KC_NO }, { KC_NO, DE_SQ3, KC_F4, KC_F5, KC_F6, KC_F11, KC_NO, KC_MUTE, KC_VOLD, KC_VOLU, KC_NO, KC_NO },
{ _______, DE_SQ2, KC_F1, KC_F2, KC_F3, KC_NO, KC_NO, KC_MPRV, KC_MPLY, KC_MNXT, KC_NO, _______ }, { _______, DE_SQ2, KC_F1, KC_F2, KC_F3, KC_F10, KC_NO, KC_MPRV, KC_MPLY, KC_MNXT, KC_NO, _______ },
{ _______, _______, _______, KC_NO, _______, _______, _______, _______, KC_NO, _______, _______, _______ } { _______, _______, _______, KC_NO, _______, _______, _______, _______, KC_NO, _______, _______, _______ }
} }
}; };

View File

@ -0,0 +1,8 @@
check keymap.c to the layers
This Layout tries to emulate the Bone2 Variant of Neo2, and is intended to be used with a German QWERTZ Softwarelayout.
It has "üäöß" as it is optimized for a mix of German & English.
My favourite features are the placement of the special characters often used for programming right on the home row
and the number & navigation block combo, so you never have to move your hands from their home position.
Bone2 wiki page: http://wiki.neo-layout.org/wiki/Bone

View File

@ -20,7 +20,8 @@ enum planck_keycodes {
BASE = SAFE_RANGE, BASE = SAFE_RANGE,
MOVE, MOVE,
SYMB, SYMB,
FUNC FUNC,
LOCK
}; };
// Fillers to make layering more clear // Fillers to make layering more clear
@ -37,14 +38,14 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* |------+------+------+------+------+------|------+------+------+------+------+------| * |------+------+------+------+------+------|------+------+------+------+------+------|
* | Shift| Z | X | C | V | B | K | M | , | . | / |Shift | * | Shift| Z | X | C | V | B | K | M | , | . | / |Shift |
* |------+------+------+------+------+------+------+------+------+------+------+------| * |------+------+------+------+------+------+------+------+------+------+------+------|
* | Func | GUI | Alt | Ctrl | Symb |Enter |Space | Move | GUI | Alt | Ctrl |Caps | * | Func | Ctrl | Alt | GUI | Symb |Enter |Space | Move | GUI | Alt | Ctrl |Caps |
* `-----------------------------------------------------------------------------------' * `-----------------------------------------------------------------------------------'
*/ */
[_BASE] = { [_BASE] = {
{KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_MINS}, {KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_MINS},
{KC_BSPC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT}, {KC_BSPC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT},
{KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT}, {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT},
{FUNC, KC_LGUI, KC_LALT, KC_LCTL, SYMB, KC_ENT, KC_SPC, MOVE, KC_RGUI, KC_RALT, KC_RCTL, KC_CAPS} {FUNC, KC_LCTL, KC_LALT, KC_LGUI, SYMB, KC_ENT, KC_SPC, MOVE, KC_RGUI, KC_RALT, KC_RCTL, KC_CAPS}
}, },
/* MOVE /* MOVE
@ -87,7 +88,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* ,-----------------------------------------------------------------------------------. * ,-----------------------------------------------------------------------------------.
* | F12 | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | * | F12 | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 |
* |-----------------------------------------------------------------------------------. * |-----------------------------------------------------------------------------------.
* | | Play | Prev | Next | BL+ | | | | | | | | * | | Play | Prev | Next | BL+ | | | Lock | | | | |
* |------+------+------+------+------+------|------+------+------+------+------+------| * |------+------+------+------+------+------|------+------+------+------+------+------|
* | | Mute | Vol- | Vol+ | BL- | | | | | | | | * | | Mute | Vol- | Vol+ | BL- | | | | | | | |
* |------+------+------+------+------+------+------+------+------+------+------+------| * |------+------+------+------+------+------+------+------+------+------+------+------|
@ -96,7 +97,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
*/ */
[_FUNC] = { [_FUNC] = {
{KC_F12, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11 }, {KC_F12, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11 },
{_______, KC_MPLY, KC_MPRV, KC_MNXT, KC_PAUS, _______, _______, _______, _______, _______, _______, _______}, {_______, KC_MPLY, KC_MPRV, KC_MNXT, KC_PAUS, _______, _______, LOCK, _______, _______, _______, _______},
{_______, KC_MUTE, KC_VOLD, KC_VOLU, KC_SLCK, _______, _______, _______, _______, _______, _______, _______}, {_______, KC_MUTE, KC_VOLD, KC_VOLU, KC_SLCK, _______, _______, _______, _______, _______, _______, _______},
{_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RESET } {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RESET }
} }
@ -133,6 +134,18 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
} }
return false; return false;
break; break;
case LOCK:
if (record->event.pressed) {
register_code(KC_RSFT);
register_code(KC_RCTL);
register_code(KC_POWER);
} else {
unregister_code(KC_POWER);
unregister_code(KC_RCTL);
unregister_code(KC_RSFT);
}
return false;
break;
} }
return true; return true;
} }

View File

@ -1,25 +1,20 @@
# callums planck layout # callums planck layout
This is a layout for the grid planck, built with a few ideals in mind. These ideals are just my opinion mind! The great thing about *qmk* is that we can all afford to have different opinions about what makes a good layout: This is a layout for the grid planck, built with a few ideals in mind:
- Minimal response times should be maintained. i.e. keys that react differently depending on whether they are tapped or held, keys that react differently if they are double tapped, etc. should be avoided --- since they inevitably send their keycode later than a normal key, interrupting the immediate feedback from the screen. Therefore we restrict ourselves to chording. - Minimal response times should be maintained. i.e. keys that react differently depending on whether they are tapped or held, keys that react differently if they are double tapped, etc. should be avoided they inevitably send their keycode later than a normal key, interrupting the immediate feedback from the screen. Therefore we restrict ourselves to chording.
- The hands should never need to leave the home position. The usual culprit for this is the arrow cluster, so the arrow cluster should be as close to home as possible. - The hands should never need to leave the home position. The usual culprit for this is the arrow cluster, so the arrow cluster should be as close to home as possible.
- There should be two of every modifier (one on each side), since otherwise certain long key combinations become hard to make. - There should be two of every modifier (one on each side), otherwise certain long key combinations become hard to make.
- Backspace should be in the “capslock position” as God intended. - Backspace should be in the “capslock position” in the colemak tradition.
- The keyboard should be usable without any firmware changes on any operating system. In my case that means it should work on *Windows* and *Linux* without any software modifications, while I can change the behaviour slightly on *macOS* in software since thats my home OS. The images reflect the intended use on *macOS* **after** minor software tweaks; which will be noted.
We have four layers. A `BASE` layer, in colemak; a `MOVE` layer, with an arrow cluster etc, a `SYMB` layer, with numbers and symbols; and a `FUNC` layer, with function keys and media keys. We have four layers. A `BASE` layer, in colemak; a `MOVE` layer, with an arrow cluster etc, a `SYMB` layer, with numbers and symbols; and a `FUNC` layer, with function keys and media keys.
## The `BASE` layer ## The `BASE` layer
![](http://i.imgur.com/aEXOlWl.png) ![](http://i.imgur.com/tVNI3SE.png)
This is the default layer; in [colemak](https://colemak.com). `esc` and `del` are conspicuously absent but are especially easy to reach from either of the other main layers (see below). The `backspace` location is standard colemak. The `caps` key is still on the `BASE` layer but only because I dont really use the bottom corners so theres nothing else I would rather put there. Having `enter` on a thumb means I can still have `quote` immediately to the right of `O`, something that would have annoyed me endlessly otherwise. `minus` is in the upper right because I had an extra space and its probably my next most used key that didnt yet have a home. This is the default layer; in [colemak](https://colemak.com). `esc` and `del` are conspicuously absent but are especially easy to reach from either of the other main layers (see below). The `backspace` location is standard colemak. The `caps` key is still on the `BASE` layer but only because I dont really use the bottom corners so theres nothing else I would rather put there. Having `enter` on a thumb means I can still have `quote` immediately to the right of `O`, something that would have annoyed me endlessly otherwise. `minus` is in the upper right because I had an extra space and its probably my next most used key that didnt yet have a home.
The `MOVE` and `SYMB` layers are reached by holding down the `move` and `symb` keys respectively. The `FUNC` layer is reached by holding down both the `move` and `symb` keys simultaneosly, *or* by holding down the `fn` key. The intended use is that whenever both hands are on the keyboard, the former method is used, and the latter is only used when, for example, reaching over to the keyboard with one hand to access the media controls. The `MOVE` and `SYMB` layers are reached by holding down the `move` and `symb` keys respectively. The `FUNC` layer is reached by holding down both the `move` and `symb` keys simultaneously, *or* by holding down the `fn` key. The intended use is that whenever both hands are on the keyboard, the former method is used, and the latter is only used when, for example, reaching over to the keyboard with one hand to access the media controls.
The `ctrl`, `alt`, `cmd` cluster is asymmetric around the centre so that at least one of each of the modifiers can be reached with the thumbs. The intended use is to always hit the left `cmd` and the right `ctrl`, unless an awkward key combination dictates otherwise.
In firmware `ctrl` and `cmd`/`GUI` are swapped with respect to the image above --- I swap them to the illustrated location when using *macOS* and leave them be for *Windows* and *Linux*. (so that `cmd-z,x,c,v,...` becomes `ctrl-z,x,c,v,...` saving me some confusion)
## The `MOVE` layer ## The `MOVE` layer
![](http://i.imgur.com/KXRSuHT.png) ![](http://i.imgur.com/KXRSuHT.png)
@ -40,9 +35,9 @@ The symbol layer has all the numbers and their usual corresponding symbols in th
Again none of the modifiers are overwritten so that shortcuts involving numbers or symbols work as expected. Again none of the modifiers are overwritten so that shortcuts involving numbers or symbols work as expected.
## The `FUNC` layer ## The `FUNC` layer
![](http://i.imgur.com/skxRZiH.png) ![](http://i.imgur.com/1VKFBBU.png)
The only thing of note here is that `bl+` and `bl-` are short for *backlight up* and *backlight down* respectively, and in firmware are actually `KC_PAUS` and `KC_SLCK` respectively, since *macOS* interprets these as the backlight keys. The only things of note here are that `bl+` and `bl-` are short for *backlight up* and *backlight down*, and in firmware are actually `KC_PAUS` and `KC_SLCK` respectively, since *macOS* interprets these as the backlight keys. And that `lock` is currently a macro hard coded to turn off the screen on *macOS*. (By activating the shortcut `shift-ctrl-power`.)
## Other changes from the default ## Other changes from the default
I have LEDs and sound disabled, simply because I have no need of them. I have LEDs and sound disabled, simply because I have no need of them.

View File

@ -0,0 +1,25 @@
# Build Options
# change to "no" to disable the options, or define them in the Makefile in
# the appropriate keymap folder that will get included automatically
#
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
NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
MIDI_ENABLE = no # MIDI controls
AUDIO_ENABLE = yes # Audio output on port C6
UNICODE_ENABLE = no # Unicode
BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time.
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
ifndef QUANTUM_DIR
include ../../../../Makefile
endif

View File

@ -0,0 +1,9 @@
#ifndef CONFIG_USER_H
#define CONFIG_USER_H
#include "../../config.h"
#define FORCE_NKRO
#define WORKMAN_SOUND COLEMAK_SOUND
#endif

View File

@ -0,0 +1,314 @@
// This is the canonical layout file for the Quantum project. If you want to add another keyboard,
// this is the style you want to emulate.
#include "planck.h"
#include "action_layer.h"
#ifdef AUDIO_ENABLE
#include "audio.h"
#endif
#include "eeconfig.h"
extern keymap_config_t keymap_config;
// Each layer gets a name for readability, which is then used in the keymap matrix below.
// The underscores don't mean anything - you can have a layer called STUFF or any other name.
// Layer names don't all need to be of the same length, obviously, and you can also skip them
// entirely and just use numbers.
#define _WORKMAN 0
#define _DEAD 1
#define _QWERTY 2
#define _LOWER 3
#define _RAISE 4
#define _PLOVER 5
#define _ADJUST 16
enum planck_keycodes {
WORKMAN = SAFE_RANGE,
DEAD,
QWERTY,
LOWER,
RAISE,
PLOVER,
EXT_PLV,
TOG_PLV
};
// Fillers to make layering more clear
#define _______ KC_TRNS
#define XXXXXXX KC_NO
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Workman
* ,-----------------------------------------------------------------------------------.
* | Tab | Q | D | R | W | B | J | F | U | P | ; | Bksp |
* |------+------+------+------+------+-------------+------+------+------+------+------|
* | Esc | A | S | H | T | G | Y | N | E | O | I | " |
* |------+------+------+------+------+------|------+------+------+------+------+------|
* | Shift| Z | X | M | C | V | K | L | Dead | . | / |Enter |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | Ctrl | RAlt | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right |
* `-----------------------------------------------------------------------------------'
*/
[_WORKMAN] = {
{KC_TAB, KC_Q, KC_D, KC_R, KC_W, KC_B, KC_J, KC_F, KC_U, KC_P, KC_SCLN, KC_BSPC},
{MT(MOD_LCTL,KC_ESC), KC_A, KC_S, KC_H, KC_T, KC_G, KC_Y, KC_N, KC_E, KC_O, KC_I, KC_QUOT},
{KC_LSFT, KC_Z, KC_X, KC_M, KC_C, KC_V, KC_K, KC_L, DEAD, KC_DOT, KC_SLSH, KC_ENT},
{KC_LCTL, KC_RALT, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT}
},
/* Workman Dead Layer
* ,-----------------------------------------------------------------------------------.
* | | % | & | ? | + | @ | $ | _ | [ | ] | ! | |
* |------+------+------+------+------+-------------+------+------+------+------+------|
* | | / | ( | = | 0 | { | } | 1 | * | ) | - | " |
* |------+------+------+------+------+------|------+------+------+------+------+------|
* | | 6 | 7 | 8 | 9 | | | \ | 2 | 3 | 4 | 5 | |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | | | < | ~ | ` | , | # | ^ | > | | |
* `-----------------------------------------------------------------------------------'
*/
[_DEAD] = {
{XXXXXXX, KC_PERC, KC_AMPR, KC_QUES, KC_PLUS, KC_AT, KC_DLR, KC_UNDS, KC_LBRC, KC_RBRC, KC_EXLM, XXXXXXX},
{XXXXXXX, KC_SLSH, KC_LPRN, KC_EQL, KC_0, KC_LCBR, KC_RCBR, KC_1, KC_ASTR, KC_RPRN, KC_MINS, XXXXXXX},
{XXXXXXX, KC_6, KC_7, KC_8, KC_9, KC_PIPE, KC_BSLS, KC_2, KC_3, KC_4, KC_5, XXXXXXX},
{XXXXXXX, XXXXXXX, KC_LT, KC_TILD, KC_GRV, KC_COMM, KC_COMM, KC_HASH, KC_CIRC, KC_GT, XXXXXXX, XXXXXXX}
},
/* Qwerty
* ,-----------------------------------------------------------------------------------.
* | Tab | Q | W | E | R | T | Y | U | I | O | P | Bksp |
* |------+------+------+------+------+-------------+------+------+------+------+------|
* | Esc | A | S | D | F | G | H | J | K | L | ; | " |
* |------+------+------+------+------+------|------+------+------+------+------+------|
* | Shift| Z | X | C | V | B | N | M | , | . | / |Enter |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | Ctrl | RAlt | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right |
* `-----------------------------------------------------------------------------------'
*/
[_QWERTY] = {
{KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC},
{KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT},
{KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT },
{KC_LCTL, KC_RALT, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT}
},
/* Lower
* ,-----------------------------------------------------------------------------------.
* | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | Bksp |
* |------+------+------+------+------+-------------+------+------+------+------+------|
* | Del | F1 | F2 | F3 | F4 | F5 | F6 | _ | + | { | } | | |
* |------+------+------+------+------+------|------+------+------+------+------+------|
* | | F7 | F8 | F9 | F10 | F11 | F12 |ISO ~ |ISO | | | Vol+ |Enter |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | | | | | | | | Prev | Next | Vol- | Play |
* `-----------------------------------------------------------------------------------'
*/
[_LOWER] = {
{KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC},
{KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE},
{_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12,S(KC_NUHS),S(KC_NUBS), _______, KC_VOLU, _______},
{_______, _______, _______, _______, _______, _______, _______, _______, KC_MPRV, KC_MNXT, KC_VOLD, KC_MPLY}
},
/* Raise - KWM Interaction
* ,-----------------------------------------------------------------------------------.
* |Restrt| |TgSplt|Flotng|Parent|FlScrn|InsMrk| InsW | InsS | InsN | InsE | |
* |------+------+------+------+------+-------------+------+------+------+------+------|
* | | Mark |Rotate|Prefix| Term | BSP |SwpMrk|SwapW |SwapS |SwapN |SwapE | |
* |------+------+------+------+------+------|------+------+------+------+------+------|
* | |MarkW |MarkS |MarkN |MarkE |Monocl|Float |FocusW|FocusS|FocusN|FocusE| |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | | | | | | | | | | | |
* `-----------------------------------------------------------------------------------'
*/
[_RAISE] = {
{LCAG(KC_Q), XXXXXXX, LCAG(KC_S), LCAG(KC_W), LCAG(KC_D), LCAG(KC_F), LCTL(S(KC_X)), LCTL(S(KC_H)), LCTL(S(KC_J)), LCTL(S(KC_K)), LCTL(S(KC_L)), XXXXXXX},
{XXXXXXX, LCAG(KC_M), LGUI(LCTL(KC_R)), LCAG(KC_DOT), LCAG(KC_T), LGUI(LCTL(KC_A)), LCTL(LALT(KC_M)), LCTL(LALT(KC_H)), LCTL(LALT(KC_J)), LCTL(LALT(KC_K)), LCTL(LALT(KC_L)), XXXXXXX},
{_______, LCAG(KC_H), LCAG(KC_J), LCAG(KC_K), LCAG(KC_L), LGUI(LCTL(KC_S)), LGUI(LCTL(KC_D)), LGUI(LALT(KC_H)), LGUI(LALT(KC_J)), LGUI(LALT(KC_K)), LGUI(LALT(KC_L)), _______},
{_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______}
},
/* Plover layer (http://opensteno.org)
* ,-----------------------------------------------------------------------------------.
* | # | # | # | # | # | # | # | # | # | # | # | # |
* |------+------+------+------+------+-------------+------+------+------+------+------|
* | | S | T | P | H | * | * | F | P | L | T | D |
* |------+------+------+------+------+------|------+------+------+------+------+------|
* |TogOut| S | K | W | R | * | * | R | B | G | S | Z |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | Exit | | | A | O | | E | U | | | |
* `-----------------------------------------------------------------------------------'
*/
[_PLOVER] = {
{KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1 },
{XXXXXXX, KC_Q, KC_D, KC_R, KC_W, KC_B, KC_J, KC_F, KC_U, KC_P, KC_SCLN, KC_BSPC},
{TOG_PLV, KC_A, KC_S, KC_H, KC_T, KC_G, KC_Y, KC_N, KC_E, KC_O, KC_I, KC_QUOT},
{EXT_PLV, XXXXXXX, XXXXXXX, KC_M, KC_C, XXXXXXX, XXXXXXX, KC_L, KC_COMM, XXXXXXX, XXXXXXX, XXXXXXX}
},
/* Adjust (Lower + Raise)
* ,-----------------------------------------------------------------------------------.
* | | Reset| | | | | | | | | | Del |
* |------+------+------+------+------+-------------+------+------+------+------+------|
* | | | |Aud on|Audoff|AGnorm|AGswap|Qwerty|Workmn|Plover| | |
* |------+------+------+------+------+------|------+------+------+------+------+------|
* | |Voice-|Voice+|Mus on|Musoff|MIDIon|MIDIof| | | | | |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | | | | | | | | | | | |
* `-----------------------------------------------------------------------------------'
*/
[_ADJUST] = {
{_______, RESET, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_DEL},
{_______, _______, _______, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, WORKMAN, PLOVER, _______, _______},
{_______, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, _______, _______, _______, _______, _______},
{_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______}
}
};
#ifdef AUDIO_ENABLE
float tone_startup[][2] = SONG(STARTUP_SOUND);
float tone_qwerty[][2] = SONG(QWERTY_SOUND);
float tone_workman[][2] = SONG(WORKMAN_SOUND);
float tone_plover[][2] = SONG(PLOVER_SOUND);
float tone_plover_gb[][2] = SONG(PLOVER_GOODBYE_SOUND);
float music_scale[][2] = SONG(MUSIC_SCALE_SOUND);
float tone_goodbye[][2] = SONG(GOODBYE_SOUND);
#endif
void persistant_default_layer_set(uint16_t default_layer) {
eeconfig_update_default_layer(default_layer);
default_layer_set(default_layer);
}
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case WORKMAN:
if (record->event.pressed) {
#ifdef AUDIO_ENABLE
PLAY_NOTE_ARRAY(tone_workman, false, 0);
#endif
persistant_default_layer_set(1UL<<_WORKMAN);
}
return false;
break;
case DEAD:
if (record->event.pressed) {
layer_on(_DEAD);
set_oneshot_layer(_DEAD, ONESHOT_START);
clear_oneshot_layer_state(ONESHOT_PRESSED);
}
return false;
break;
case QWERTY:
if (record->event.pressed) {
#ifdef AUDIO_ENABLE
PLAY_NOTE_ARRAY(tone_qwerty, false, 0);
#endif
persistant_default_layer_set(1UL<<_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;
case PLOVER:
if (record->event.pressed) {
#ifdef AUDIO_ENABLE
stop_all_notes();
PLAY_NOTE_ARRAY(tone_plover, false, 0);
#endif
layer_off(_RAISE);
layer_off(_LOWER);
layer_off(_ADJUST);
layer_on(_PLOVER);
if (!eeconfig_is_enabled()) {
eeconfig_init();
}
keymap_config.raw = eeconfig_read_keymap();
keymap_config.nkro = 1;
eeconfig_update_keymap(keymap_config.raw);
}
return false;
break;
case EXT_PLV:
if (record->event.pressed) {
#ifdef AUDIO_ENABLE
PLAY_NOTE_ARRAY(tone_plover_gb, false, 0);
#endif
layer_off(_PLOVER);
}
return false;
break;
case TOG_PLV:
if (record->event.pressed) {
register_code(KC_R);
register_code(KC_W);
register_code(KC_T);
register_code(KC_C);
register_code(KC_P);
register_code(KC_O);
clear_keyboard();
}
return false;
break;
}
return true;
}
void matrix_init_user(void) {
#ifdef AUDIO_ENABLE
startup_user();
#endif
}
#ifdef AUDIO_ENABLE
void startup_user()
{
_delay_ms(20); // gets rid of tick
PLAY_NOTE_ARRAY(tone_startup, false, 0);
}
void shutdown_user()
{
PLAY_NOTE_ARRAY(tone_goodbye, false, 0);
_delay_ms(150);
stop_all_notes();
}
void music_on_user(void)
{
music_scale_user();
}
void music_scale_user(void)
{
PLAY_NOTE_ARRAY(music_scale, false, 0);
}
#endif

View File

@ -0,0 +1,41 @@
# jhenahan's layout
## Layout
The base layer is based on the
[Workman Dead](https://github.com/ojbucao/Workman/tree/master/mac) layout. The
primary interaction layer is a slightly modified Workman layout with a 'dead'
key on the third row under the middle finger. The dead key activates a layer of
special characters.
## [Layers](http://www.keyboard-layout-editor.com/#/gists/2b875f7d5d76fe4408c0a5b3bd76ddae)
### Function Layer
This is very slightly modified from the default, mainly just to rearrange the media keys.
### [KWM](https://github.com/koekeishiya/kwm) Interaction Layer
`kwm` is a tiling window manager for OS X. The keys defined in my keymap
correspond to the settings I use in
[my `kwmrc` file](https://github.com/jhenahan/dotfiles/blob/master/kwm/kwmrc).
### QWERTY
Just in case.
### [Plover](http://www.openstenoproject.org/plover/)
This layout functions exactly as a Workman layout unless you're running the Plover
application. Includes a key for toggling Plover while it's running.
Add this in the appropriate section of your `plover.cfg` to allow this altered layout:
``` ini
[System: English Stenotype]
keymap[keyboard] = [["#", ["1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "-", "="]], ["S-", ["q", "a"]], ["T-", ["d"]], ["K-", ["s"]], ["P-", ["r"]], ["W-", ["h"]], ["H-", ["w"]], ["R-", ["t"]], ["A-", ["m"]], ["O-", ["c"]], ["*", ["y", "g", "j", "b"]], ["-E", ["l"]], ["-U", [","]], ["-F", ["f"]], ["-R", ["n"]], ["-P", ["u"]], ["-B", ["e"]], ["-L", ["p"]], ["-G", ["o"]], ["-T", [";"]], ["-S", ["i"]], ["-D", ["BackSpace"]], ["-Z", ["'"]], ["no-op", ["\\", "]", "x", ".", "/"]], ["arpeggiate", ["space"]]]
```
### Adjust Layer
This layer is only slightly modified from the default to remove Dvorak and
Colemak and replace them with Workman.

View File

@ -59,13 +59,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \ keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \
) )
/* ws2812 RGB LED */ #define BACKLIGHT_PIN B7
#define RGB_DI_PIN D1 #define BACKLIGHT_BREATHING
#define RGBLIGHT_TIMER
#define RGBLED_NUM 28 // Number of LEDs
#define RGBLIGHT_HUE_STEP 10
#define RGBLIGHT_SAT_STEP 17
#define RGBLIGHT_VAL_STEP 17
/* /*
* Feature disable options * Feature disable options

View File

@ -2,48 +2,50 @@
#include "action_layer.h" #include "action_layer.h"
#include "eeconfig.h" #include "eeconfig.h"
#include "led.h" #include "led.h"
#include "mousekey.h"
#ifdef AUDIO_ENABLE #ifdef AUDIO_ENABLE
#include "audio.h" #include "audio.h"
#include "song_list.h" #include "song_list.h"
#endif #endif
#define LAYER_QWERTY 0 enum keyboard_layers {
#define LAYER_COLEMAK 1 LAYER_QWERTY = 0,
#define LAYER_DVORAK 2 LAYER_UPPER,
#define LAYER_UPPER 3 LAYER_LOWER,
#define LAYER_LOWER 4 LAYER_FUNCTION,
#define LAYER_FUNCTION 5 LAYER_MOUSE,
#define LAYER_MOUSE 6 LAYER_ADJUST,
#define LAYER_ADJUST 7 };
enum keyboard_macros {
#define MACRO_QWERTY 0 MACRO_QWERTY = 0,
#define MACRO_COLEMAK 1 MACRO_UPPER,
#define MACRO_DVORAK 2 MACRO_LOWER,
#define MACRO_UPPER 3 MACRO_FUNCTION,
#define MACRO_LOWER 4 MACRO_MOUSE,
#define MACRO_FUNCTION 5 MACRO_TIMBRE_1,
#define MACRO_MOUSE 6 MACRO_TIMBRE_2,
#define MACRO_TIMBRE_1 7 MACRO_TIMBRE_3,
#define MACRO_TIMBRE_2 8 MACRO_TIMBRE_4,
#define MACRO_TIMBRE_3 9 MACRO_TEMPO_U,
#define MACRO_TIMBRE_4 10 MACRO_TEMPO_D,
#define MACRO_TEMPO_U 11 MACRO_TONE_DEFAULT,
#define MACRO_TEMPO_D 12 MACRO_MUSIC_TOGGLE,
#define MACRO_TONE_DEFAULT 13 MACRO_AUDIO_TOGGLE,
#define MACRO_MUSIC_TOGGLE 14 MACRO_INC_VOICE,
#define MACRO_AUDIO_TOGGLE 16 MACRO_DEC_VOICE,
#define MACRO_INC_VOICE 18 MACRO_BACKLIGHT,
#define MACRO_DEC_VOICE 19 MACRO_BREATH_TOGGLE,
#define MACRO_BACKLIGHT 20 MACRO_BREATH_SPEED_INC,
#define MACRO_BREATH_TOGGLE 21 MACRO_BREATH_SPEED_DEC,
#define MACRO_BREATH_SPEED_INC 23 MACRO_BREATH_DEFAULT,
#define MACRO_BREATH_SPEED_DEC 24 MACRO_MOUSE_MOVE_UL,
#define MACRO_BREATH_DEFAULT 25 MACRO_MOUSE_MOVE_UR,
MACRO_MOUSE_MOVE_DL,
MACRO_MOUSE_MOVE_DR,
};
#define M_QWRTY M(MACRO_QWERTY) #define M_QWRTY M(MACRO_QWERTY)
#define M_COLMK M(MACRO_COLEMAK)
#define M_DVORK M(MACRO_DVORAK)
#define M_UPPER M(MACRO_UPPER) #define M_UPPER M(MACRO_UPPER)
#define M_LOWER M(MACRO_LOWER) #define M_LOWER M(MACRO_LOWER)
#define M_FUNCT M(MACRO_FUNCTION) #define M_FUNCT M(MACRO_FUNCTION)
@ -60,6 +62,10 @@
#define M_BSPDU M(MACRO_BREATH_SPEED_INC) #define M_BSPDU M(MACRO_BREATH_SPEED_INC)
#define M_BSPDD M(MACRO_BREATH_SPEED_DEC) #define M_BSPDD M(MACRO_BREATH_SPEED_DEC)
#define M_BDFLT M(MACRO_BREATH_DEFAULT) #define M_BDFLT M(MACRO_BREATH_DEFAULT)
#define M_MS_UL M(MACRO_MOUSE_MOVE_UL)
#define M_MS_UR M(MACRO_MOUSE_MOVE_UR)
#define M_MS_DL M(MACRO_MOUSE_MOVE_DL)
#define M_MS_DR M(MACRO_MOUSE_MOVE_DR)
#define VC_UP M(MACRO_INC_VOICE) #define VC_UP M(MACRO_INC_VOICE)
@ -86,147 +92,124 @@
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* QWERTY /* LAYER = LAYER_QWERTY
* .-----------------------------------------------------------------------------------------------------------. .-----------------------------------------------------------------------------------------------------------.
* | TAB | Q | W | E | R | T | Y | U | I | O | P | BACKSP | | TAB | Q | W | E | R | T | Y | U | I | O | P | BACKSP |
* |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
* | ESC | A | S | D | F | G | H | J | K | L | ; | ' | | ESC | A | S | D | F | G | H | J | K | L | ; | ' |
* |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
* | LSHIFT | Z | X | C | V | B | N | M | , | . | UP | ENTER | | LSHIFT | Z | X | C | V | B | N | M | , | . | UP | ENTER |
* |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
* | LCTRL | LWIN | FN | LALT | UPPER | SPACE | SPACE | LOWER | SHIFT | LEFT | DOWN | RIGHT | | LCTRL | LWIN | FN | LALT | UPPER | SPACE | SPACE | LOWER | OSHIFT | LEFT | DOWN | RIGHT |
* '-----------------------------------------------------------------------------------------------------------' '-----------------------------------------------------------------------------------------------------------'
*/ */
[LAYER_QWERTY] = { // QWERTY [LAYER_QWERTY] = {
{ KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC }, { KC_TAB , KC_Q , KC_W , KC_E , KC_R , KC_T , KC_Y , KC_U , KC_I , KC_O , KC_P , KC_BSPC },
{ KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT }, { KC_ESC , KC_A , KC_S , KC_D , KC_F , KC_G , KC_H , KC_J , KC_K , KC_L , KC_SCLN, KC_QUOT },
{ KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_UP, KC_ENT }, { KC_LSFT, KC_Z , KC_X , KC_C , KC_V , KC_B , KC_N , KC_M , KC_COMM, KC_DOT , KC_UP , KC_ENT },
{ KC_LCTL, KC_LGUI, M_FUNCT, KC_LALT, M_UPPER, KC_SPC, KC_SPC, M_LOWER, OS_SHFT, KC_LEFT, KC_DOWN, KC_RGHT }, { KC_LCTL, KC_LGUI, M_FUNCT, KC_LALT, M_UPPER, KC_SPC , KC_SPC , M_LOWER, OS_SHFT, KC_LEFT, KC_DOWN, KC_RGHT }
}, },
/* COLEMAK /* LAYER = LAYER_UPPER
* .-----------------------------------------------------------------------------------------------------------. .-----------------------------------------------------------------------------------------------------------.
* | TAB | Q | W | F | P | G | J | L | U | Y | ; | ESC | | PRINT | F1 | F2 | F3 | F4 | NUM LK | KP / | KP 7 | KP 8 | KP 9 | KP - | DEL |
* |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
* | BACKSP | A | R | S | T | D | H | N | E | I | O | ' | | PAUSE | F5 | F6 | F7 | F8 | SCR LK | KP * | KP 4 | KP 5 | KP 6 | KP + | INS |
* |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
* | LSHIFT | Z | X | C | V | B | K | M | , | . | UP | ENTER | | ______ | F9 | F10 | F11 | F12 | PAUSE | KP 0 | KP 1 | KP 2 | KP 3 | KP ENT | HOME |
* |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
* | LCTRL | LWIN | FN | LALT | UPPER | SPACE | SPACE | LOWER | SHIFT | LEFT | DOWN | RIGHT | | ______ | ______ | ______ | ______ | UPPER | KP 0 | KP 0 | ______ | RALT | KP . | KP ENT | END |
* '-----------------------------------------------------------------------------------------------------------' '-----------------------------------------------------------------------------------------------------------'
*/ */
[LAYER_COLEMAK] = { // COLEMAK [LAYER_UPPER] = {
{ KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_ESC }, { KC_PSCR, KC_F1 , KC_F2 , KC_F3 , KC_F4 , KC_NLCK, KC_PSLS, KC_KP_7, KC_KP_8, KC_KP_9, KC_PMNS, KC_DEL },
{ KC_BSPC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT }, { KC_PAUS, KC_F5 , KC_F6 , KC_F7 , KC_F8 , KC_SLCK, KC_PAST, KC_KP_4, KC_KP_5, KC_KP_6, KC_PPLS, KC_INS },
{ KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_UP, KC_ENT }, { _______, KC_F9 , KC_F10 , KC_F11 , KC_F12 , KC_PAUS, KC_KP_0, KC_KP_1, KC_KP_2, KC_KP_3, KC_PENT, KC_HOME },
{ KC_LCTL, KC_LGUI, M_FUNCT, KC_LALT, M_UPPER, KC_SPC, KC_SPC, M_LOWER, OS_SHFT, KC_LEFT, KC_DOWN, KC_RGHT }, { _______, _______, _______, _______, M_UPPER, KC_KP_0, KC_KP_0, _______, KC_RALT, KC_PDOT, KC_PENT, KC_END }
}, },
/* DVORAK /* LAYER = LAYER_LOWER
* .-----------------------------------------------------------------------------------------------------------. .-----------------------------------------------------------------------------------------------------------.
* | TAB | ' | , | . | P | Y | F | G | C | R | L | BACKSP | | ______ | $ | { | [ | ( | % | # | ) | ] | } | @ | PG UP |
* |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
* | ESC | A | O | E | U | I | D | H | T | N | S | / | | ______ | ^ | * | + | - | / | \ | _ | ' | " | ` | PG DN |
* |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
* | LSHIFT | ; | Q | J | K | X | B | M | W | V | Z | ENTER | | ______ | | | & | ! | ~ | ; | : | = | < | > | ? | HOME |
* |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
* | LCTRL | LWIN | FN | LALT | UPPER | SPACE | SPACE | LOWER | UP | DOWN | LEFT | RIGHT | | ______ | ______ | ______ | ______ | ______ | ______ | ______ | LOWER | ______ | ______ | ______ | END |
* '-----------------------------------------------------------------------------------------------------------' '-----------------------------------------------------------------------------------------------------------'
*/ */
[LAYER_DVORAK] = { // DVORAK [LAYER_LOWER] = {
{ KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_BSPC }, { _______, KC_DLR , KC_LCBR, KC_LBRC, KC_LPRN, KC_PERC, KC_HASH, KC_RPRN, KC_RBRC, KC_RCBR, KC_AT , KC_PGUP },
{ KC_ESC, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_SLSH }, { _______, KC_CIRC, KC_ASTR, KC_PLUS, KC_MINS, KC_SLSH, KC_BSLS, KC_UNDS, KC_QUOT, KC_DQT , KC_GRV , KC_PGDN },
{ KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_ENT }, { _______, KC_PIPE, KC_AMPR, KC_EXLM, KC_TILD, KC_SCLN, KC_COLN, KC_EQL , KC_LT , KC_GT , KC_QUES, KC_HOME },
{ KC_LCTL, KC_LGUI, M_FUNCT, KC_LALT, M_UPPER, KC_SPC, KC_SPC, M_LOWER, KC_UP, KC_DOWN, KC_LEFT, KC_RGHT }, { _______, _______, _______, _______, _______, _______, _______, M_LOWER, _______, _______, _______, KC_END }
}, },
/* UPPER /* LAYER = LAYER_FUNCTION
* .-----------------------------------------------------------------------------------------------------------. .-----------------------------------------------------------------------------------------------------------.
* | PRINT | F1 | F2 | F3 | F4 | NUM LK | / | 7 | 8 | 9 | - | DEL | | XXXXXX | F13 | F14 | F15 | F16 | NUM LK | XXXXXX | XXXXXX | XXXXXX | XXXXXX | XXXXXX | XXXXXX |
* |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
* | CAP LK | F5 | F6 | F7 | F8 | SCR LK | * | 4 | 5 | 6 | + | INS | | XXXXXX | F17 | F18 | F19 | F20 | SCR LK | XXXXXX | XXXXXX | XXXXXX | XXXXXX | XXXXXX | XXXXXX |
* |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
* | | F9 | F10 | F11 | F12 | PAUSE | | 1 | 2 | 3 | ENTER | HOME | | ______ | F21 | F22 | F23 | F24 | CAP LK | XXXXXX | XXXXXX | XXXXXX | XXXXXX | VOL UP | MUTE |
* |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+-----------------| |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
* | | | | | | 0 | 0 | | RALT | . | ENTER | END | | ______ | ______ | FN | ______ | ______ | PLAY | PLAY | ______ | ______ | PREV | VOL DN | NEXT |
* '-----------------------------------------------------------------------------------------------------------' '-----------------------------------------------------------------------------------------------------------'
*/ */
[LAYER_UPPER] = { // UPPER [LAYER_FUNCTION] = {
{ KC_PSCR, KC_F1, KC_F2, KC_F3, KC_F4, KC_NLCK, KC_PSLS, KC_KP_7, KC_KP_8, KC_KP_9, KC_PMNS, KC_DEL }, { XXXXXXX, KC_F13 , KC_F14 , KC_F15 , KC_F16 , KC_NLCK, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX },
{ KC_CAPS, KC_F5, KC_F6, KC_F7, KC_F8, KC_SLCK, KC_PAST, KC_KP_4, KC_KP_5, KC_KP_6, KC_PPLS, KC_INS }, { XXXXXXX, KC_F17 , KC_F18 , KC_F19 , KC_F20 , KC_SLCK, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX },
{ _______, KC_F9, KC_F10, KC_F11, KC_F12, KC_PAUS, XXXXXXX, KC_KP_1, KC_KP_2, KC_KP_3, KC_PENT, KC_HOME }, { _______, KC_F21 , KC_F22 , KC_F23 , KC_F24 , KC_CAPS, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_VOLU, KC_MUTE },
{ _______, _______, _______, _______, _______, KC_KP_0, KC_KP_0, _______, KC_RALT, KC_PDOT, KC_PENT, KC_END }, { _______, _______, M_FUNCT, _______, _______, KC_MPLY, KC_MPLY, _______, _______, KC_MPRV, KC_VOLD, KC_MNXT }
}, },
/* LOWER
* .-----------------------------------------------------------------------------------------------------------.
* | | $ | { | [ | ( | % | # | ) | ] | } | @ | PG UP |
* |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
* | | ^ | * | + | - | / | \ | _ | ' | " | ` | PG DN |
* |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
* | | | | & | ! | ~ | ; | : | = | < | > | ? | HOME |
* |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+-----------------|
* | | | | | | | | | | | | END |
* '-----------------------------------------------------------------------------------------------------------'
*/
[LAYER_LOWER] = { // LOWER
{ _______, KC_DLR, KC_LCBR, KC_LBRC, KC_LPRN, KC_PERC, KC_HASH, KC_RPRN, KC_RBRC, KC_RCBR, KC_AT, KC_PGUP },
{ _______, KC_CIRC, KC_ASTR, KC_PPLS, KC_PMNS, KC_SLSH, KC_BSLS, KC_UNDS, KC_QUOT, KC_DQT, KC_GRV, KC_PGDN },
{ _______, KC_PIPE, KC_AMPR, KC_EXLM, KC_TILD, KC_SCLN, KC_COLN, KC_EQL, KC_LT, KC_GT, KC_QUES, KC_HOME },
{ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_END },
},
/* FUNCTION
* .-----------------------------------------------------------------------------------------------------------.
* | NUM LK | F13 | F14 | F15 | F16 | XXXXXX | XXXXXX | XXXXXX | XXXXXX | XXXXXX | XXXXXX | PAUSE |
* |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
* | CAP LK | F17 | F18 | F19 | F20 | XXXXXX | XXXXXX | XXXXXX | XXXXXX | XXXXXX | XXXXXX | PRINT |
* |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
* | SCR LK | F21 | F22 | F23 | F24 | XXXXXX | XXXXXX | XXXXXX | XXXXXX | XXXXXX | XXXXXX | MUTE |
* |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
* | LCTRL | LWIN | FN | LALT | UPPER | PLAY | PLAY | LOWER | VOL UP | VOL DN | NEXT | PREV |
* '-----------------------------------------------------------------------------------------------------------'
*/
[LAYER_FUNCTION] = { // FUNCTION
{ KC_NLCK, KC_F13, KC_F14, KC_F15, KC_F16, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_PAUS },
{ KC_CAPS, KC_F17, KC_F18, KC_F19, KC_F20, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_PSCR },
{ KC_SLCK, KC_F21, KC_F22, KC_F23, KC_F24, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_MUTE },
{ _______, _______, _______, _______, _______, KC_MPLY, KC_MPLY, _______, KC_VOLU, KC_VOLD, KC_MPRV, KC_MNXT },
},
#ifdef MOUSEKEY_ENABLE #ifdef MOUSEKEY_ENABLE
[LAYER_MOUSE] = { // MOUSE /* LAYER = LAYER_MOUSE
{ KC_ESC, KC_ACL0, KC_ACL1, KC_ACL2, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_ESC }, .-----------------------------------------------------------------------------------------------------------.
{ XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX }, | ESC | XXXXXX | XXXXXX | XXXXXX | XXXXXX | XXXXXX | XXXXXX | MS UL | MS U | MS UR | MS WHL | MS WHR |
{ _______, KC_BTN5, KC_BTN4, KC_BTN3, KC_BTN2, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_WH_U, KC_WH_D }, |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
{ _______, _______, _______, _______, _______, KC_BTN1, KC_BTN1, _______, KC_MS_U, KC_MS_D, KC_MS_L, KC_MS_R }, | XXXXXX | MS BT5 | MS BT4 | MS BT3 | MS BT2 | XXXXXX | XXXXXX | MS L | XXXXXX | MS R | XXXXXX | MS WHU |
}, |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
| ______ | XXXXXX | XXXXXX | XXXXXX | XXXXXX | XXXXXX | XXXXXX | MS DL | MS D | MS DR | MS U | MS WHD |
|--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
| ______ | ______ | ______ | ______ | ______ | MS BT1 | MS BT1 | ______ | ______ | MS L | MS D | MS R |
'-----------------------------------------------------------------------------------------------------------'
*/
[LAYER_MOUSE] = {
{ KC_ESC , XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, M_MS_UL, KC_MS_U, M_MS_UR, KC_WH_L, KC_WH_R },
{ XXXXXXX, KC_BTN5, KC_BTN4, KC_BTN3, KC_BTN2, XXXXXXX, XXXXXXX, KC_MS_L, XXXXXXX, KC_MS_R, XXXXXXX, KC_WH_U },
{ _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, M_MS_DL, KC_MS_D, M_MS_DR, KC_MS_U, KC_WH_D },
{ _______, _______, _______, _______, _______, KC_BTN1, KC_BTN1, _______, _______, KC_MS_L, KC_MS_D, KC_MS_R }
},
#endif #endif
[LAYER_ADJUST] = { // ADJUST /* LAYER = LAYER_ADJUST
{ _______, TIMBR_1, TIMBR_2, TIMBR_3, TIMBR_4, TMPO_UP, TMPO_DN, TMPO_DF, _______, _______, MU_TOG, AU_TOG }, .-----------------------------------------------------------------------------------------------------------.
{ _______, M_QWRTY, M_COLMK, M_DVORK, _______, _______, _______, _______, _______, _______, _______, _______ }, | XXXXXX | BRTOG | BRSPD+ | BRSPD- | BRDFLT | XXXXXX | XXXXXX | XXXXXX | XXXXXX | XXXXXX | MUSIC | AUDIO |
{ _______, _______, _______, _______, M_BACKL, RESET, _______, M_MOUSE, _______, _______, MUV_IN, _______ }, |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
{ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, MUV_DE, _______ }, | XXXXXX | XXXXXX | XXXXXX | XXXXXX | XXXXXX | XXXXXX | XXXXXX | XXXXXX | XXXXXX | XXXXXX | XXXXXX | XXXXXX |
}, |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
| XXXXXX | QWERTY | XXXXXX | XXXXXX | BACKLT | RESET | XXXXXX | MOUSE | XXXXXX | XXXXXX | VOICE+ | XXXXXX |
/* |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
[LAYER_EMPTY] = { | XXXXXX | XXXXXX | XXXXXX | XXXXXX | UPPER | XXXXXX | XXXXXX | LOWER | XXXXXX | TEMPO- | VOICE- | TEMPO+ |
{ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, }, '-----------------------------------------------------------------------------------------------------------'
{ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, },
{ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, },
{ _______, _______, _______, _______, _______, ________________, _______, _______, _______, _______, _______, },
},
*/ */
[LAYER_ADJUST] = {
{ XXXXXXX, M_BRTOG, M_BSPDU, M_BSPDD, M_BDFLT, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, MU_TOG , AU_TOG },
{ XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX },
{ XXXXXXX, M_QWRTY, XXXXXXX, XXXXXXX, M_BACKL, RESET , XXXXXXX, M_MOUSE, XXXXXXX, XXXXXXX, MUV_IN , XXXXXXX },
{ XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, M_UPPER, XXXXXXX, XXXXXXX, M_LOWER, XXXXXXX, TMPO_DN, MUV_DE , TMPO_UP }
},
}; };
#ifdef AUDIO_ENABLE #ifdef AUDIO_ENABLE
@ -234,10 +217,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
float tone_my_startup[][2] = SONG(ODE_TO_JOY); float tone_my_startup[][2] = SONG(ODE_TO_JOY);
float tone_my_goodbye[][2] = SONG(ROCK_A_BYE_BABY); float tone_my_goodbye[][2] = SONG(ROCK_A_BYE_BABY);
float tone_qwerty[][2] = SONG(QWERTY_SOUND);
float tone_dvorak[][2] = SONG(DVORAK_SOUND);
float tone_colemak[][2] = SONG(COLEMAK_SOUND);
float tone_audio_on[][2] = SONG(CLOSE_ENCOUNTERS_5_NOTE); float tone_audio_on[][2] = SONG(CLOSE_ENCOUNTERS_5_NOTE);
float tone_music_on[][2] = SONG(DOE_A_DEER); float tone_music_on[][2] = SONG(DOE_A_DEER);
float tone_caps_on[][2] = SONG(CAPS_LOCK_ON_SOUND); float tone_caps_on[][2] = SONG(CAPS_LOCK_ON_SOUND);
@ -267,46 +246,38 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
switch(id) switch(id)
{ {
case MACRO_BREATH_TOGGLE:
if (record->event.pressed)
{
breathing_toggle();
}
break;
case MACRO_BREATH_SPEED_INC:
if (record->event.pressed)
{
breathing_speed_inc(1);
}
break;
case MACRO_BREATH_SPEED_DEC:
if (record->event.pressed)
{
breathing_speed_dec(1);
}
break;
case MACRO_BREATH_DEFAULT:
if (record->event.pressed)
{
breathing_defaults();
}
break;
case MACRO_QWERTY: case MACRO_QWERTY:
if (record->event.pressed) if (record->event.pressed)
{ {
persistant_default_layer_set(1UL<<LAYER_QWERTY); persistant_default_layer_set(1UL<<LAYER_QWERTY);
#ifdef AUDIO_ENABLE
PLAY_NOTE_ARRAY(tone_qwerty, false, STACCATO);
#endif /* AUDIO_ENABLE */
}
break;
case MACRO_COLEMAK:
if (record->event.pressed)
{
persistant_default_layer_set(1UL<<LAYER_COLEMAK);
#ifdef AUDIO_ENABLE
PLAY_NOTE_ARRAY(tone_colemak, false, STACCATO);
#endif /* AUDIO_ENABLE */
}
break;
case MACRO_DVORAK:
if (record->event.pressed)
{
persistant_default_layer_set(1UL<<LAYER_DVORAK);
#ifdef AUDIO_ENABLE
PLAY_NOTE_ARRAY(tone_dvorak, false, STACCATO);
#endif /* AUDIO_ENABLE */
}
break;
case MACRO_LOWER:
if (record->event.pressed)
{
layer_on(LAYER_LOWER);
update_tri_layer(LAYER_LOWER, LAYER_UPPER, LAYER_ADJUST);
}
else
{
layer_off(LAYER_LOWER);
update_tri_layer(LAYER_LOWER, LAYER_UPPER, LAYER_ADJUST);
} }
break; break;
@ -314,6 +285,8 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
if (record->event.pressed) if (record->event.pressed)
{ {
layer_on(LAYER_UPPER); layer_on(LAYER_UPPER);
breathing_speed_set(2);
breathing_pulse();
update_tri_layer(LAYER_LOWER, LAYER_UPPER, LAYER_ADJUST); update_tri_layer(LAYER_LOWER, LAYER_UPPER, LAYER_ADJUST);
} }
else else
@ -323,13 +296,32 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
} }
break; break;
case MACRO_LOWER:
if (record->event.pressed)
{
layer_on(LAYER_LOWER);
breathing_speed_set(2);
breathing_pulse();
update_tri_layer(LAYER_LOWER, LAYER_UPPER, LAYER_ADJUST);
}
else
{
layer_off(LAYER_LOWER);
update_tri_layer(LAYER_LOWER, LAYER_UPPER, LAYER_ADJUST);
}
break;
case MACRO_FUNCTION: case MACRO_FUNCTION:
if (record->event.pressed) if (record->event.pressed)
{ {
breathing_speed_set(3);
breathing_enable();
layer_on(LAYER_FUNCTION); layer_on(LAYER_FUNCTION);
} }
else else
{ {
breathing_speed_set(1);
breathing_self_disable();
layer_off(LAYER_FUNCTION); layer_off(LAYER_FUNCTION);
} }
break; break;
@ -352,6 +344,58 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
} }
break; break;
case MACRO_MOUSE_MOVE_UL:
if (record->event.pressed)
{
mousekey_on(KC_MS_UP);
mousekey_on(KC_MS_LEFT);
}
else
{
mousekey_off(KC_MS_UP);
mousekey_off(KC_MS_LEFT);
}
break;
case MACRO_MOUSE_MOVE_UR:
if (record->event.pressed)
{
mousekey_on(KC_MS_UP);
mousekey_on(KC_MS_RIGHT);
}
else
{
mousekey_off(KC_MS_UP);
mousekey_off(KC_MS_RIGHT);
}
break;
case MACRO_MOUSE_MOVE_DL:
if (record->event.pressed)
{
mousekey_on(KC_MS_DOWN);
mousekey_on(KC_MS_LEFT);
}
else
{
mousekey_off(KC_MS_DOWN);
mousekey_off(KC_MS_LEFT);
}
break;
case MACRO_MOUSE_MOVE_DR:
if (record->event.pressed)
{
mousekey_on(KC_MS_DOWN);
mousekey_on(KC_MS_RIGHT);
}
else
{
mousekey_off(KC_MS_DOWN);
mousekey_off(KC_MS_RIGHT);
}
break;
#endif /* MOUSEKEY_ENABLE */ #endif /* MOUSEKEY_ENABLE */
#ifdef AUDIO_ENABLE #ifdef AUDIO_ENABLE

View File

@ -0,0 +1,25 @@
# Build Options
# change to "no" to disable the options, or define them in the Makefile in
# the appropriate keymap folder that will get included automatically
#
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
NKRO_ENABLE = yes # 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
MIDI_ENABLE = no # MIDI controls
AUDIO_ENABLE = yes # Audio output on port C6
UNICODE_ENABLE = no # Unicode
BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time.
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
ifndef QUANTUM_DIR
include ../../../../Makefile
endif

View File

@ -0,0 +1,233 @@
// This is sgoodwin's layout file for the Quantum project.
// It doesn't have Plover or Dvorak layers because he doesn't use that.
// It Also doesn't allow for swapping alt with CMD because that only happens in error.
#include "planck.h"
#include "action_layer.h"
#ifdef AUDIO_ENABLE
#include "audio.h"
#endif
#include "eeconfig.h"
extern keymap_config_t keymap_config;
// Each layer gets a name for readability, which is then used in the keymap matrix below.
// The underscores don't mean anything - you can have a layer called STUFF or any other name.
// Layer names don't all need to be of the same length, obviously, and you can also skip them
// entirely and just use numbers.
#define _QWERTY 1
#define _COLEMAK 0
#define _LOWER 3
#define _RAISE 4
#define _ADJUST 16
enum planck_keycodes {
COLEMAK = SAFE_RANGE,
QWERTY,
LOWER,
RAISE,
BACKLIT,
};
// Fillers to make layering more clear
#define _______ KC_TRNS
#define XXXXXXX KC_NO
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Colemak
* ,-----------------------------------------------------------------------------------.
* | Tab | Q | W | F | P | G | J | L | U | Y | ; | Bksp |
* |------+------+------+------+------+-------------+------+------+------+------+------|
* | Esc | A | R | S | T | D | H | N | E | I | O | " |
* |------+------+------+------+------+------|------+------+------+------+------+------|
* | Shift| Z | X | C | V | B | K | M | , | . | / |SHEnt |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | Hyper| Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right |
* `-----------------------------------------------------------------------------------'
*/
[_COLEMAK] = {
{KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC},
{KC_ESC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT},
{KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, MT(MOD_RSFT, KC_ENT) },
{ALL_T(KC_NO), KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT}
},
/* Qwerty
* ,-----------------------------------------------------------------------------------.
* | Tab | Q | W | E | R | T | Y | U | I | O | P | Bksp |
* |------+------+------+------+------+-------------+------+------+------+------+------|
* | Esc | A | S | D | F | G | H | J | K | L | ; | " |
* |------+------+------+------+------+------|------+------+------+------+------+------|
* | Shift| Z | X | C | V | B | N | M | , | . | / |SHEnt |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | Hyper| Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right |
* `-----------------------------------------------------------------------------------'
*/
[_QWERTY] = {
{KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC},
{KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT},
{KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, MT(MOD_RSFT, KC_ENT) },
{ALL_T(KC_NO), KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT}
},
/* Lower
* ,-----------------------------------------------------------------------------------.
* | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | Bksp |
* |------+------+------+------+------+-------------+------+------+------+------+------|
* | Del | F1 | F2 | F3 | F4 | F5 | F6 | _ | + | { | } | | |
* |------+------+------+------+------+------|------+------+------+------+------+------|
* | | F7 | F8 | F9 | F10 | F11 | F12 |ISO ~ |ISO | | | |Enter |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | | | | | | | | Next | Vol- | Vol+ | Play |
* `-----------------------------------------------------------------------------------'
*/
[_LOWER] = {
{KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC},
{KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE},
{_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12,S(KC_NUHS),S(KC_NUBS),_______, _______, _______},
{BACKLIT, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY}
},
/* Raise
* ,-----------------------------------------------------------------------------------.
* | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp |
* |------+------+------+------+------+-------------+------+------+------+------+------|
* | Del | F1 | F2 | F3 | F4 | F5 | F6 | - | = | [ | ] | \ |
* |------+------+------+------+------+------|------+------+------+------+------+------|
* | | F7 | F8 | F9 | F10 | F11 | F12 |ISO # |ISO / | | |Enter |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | | | | | | | | Next | Vol- | Vol+ | Play |
* `-----------------------------------------------------------------------------------'
*/
[_RAISE] = {
{KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC},
{KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS},
{_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_NUHS, KC_NUBS, _______, _______, _______},
{BACKLIT, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY}
},
/* Adjust (Lower + Raise)
* ,-----------------------------------------------------------------------------------.
* | | Reset| | | | | | | | | | Del |
* |------+------+------+------+------+-------------+------+------+------+------+------|
* | | | |Aud on|Audoff| | |Qwerty|Colemk| | | |
* |------+------+------+------+------+------|------+------+------+------+------+------|
* | |Voice-|Voice+|Mus on|Musoff|MIDIon|MIDIof| | | | | |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | | | | | | | | | | | |
* `-----------------------------------------------------------------------------------'
*/
[_ADJUST] = {
{_______, RESET, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_DEL},
{_______, _______, _______, AU_ON, AU_OFF, _______, _______, QWERTY, COLEMAK, _______, _______, _______},
{_______, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, _______, _______, _______, _______, _______},
{_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______}
}
};
#ifdef AUDIO_ENABLE
float tone_startup[][2] = SONG(STARTUP_SOUND);
float tone_qwerty[][2] = SONG(QWERTY_SOUND);
float tone_colemak[][2] = SONG(COLEMAK_SOUND);
float music_scale[][2] = SONG(MUSIC_SCALE_SOUND);
float tone_goodbye[][2] = SONG(GOODBYE_SOUND);
#endif
void persistant_default_layer_set(uint16_t default_layer) {
eeconfig_update_default_layer(default_layer);
default_layer_set(default_layer);
}
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case QWERTY:
if (record->event.pressed) {
#ifdef AUDIO_ENABLE
PLAY_NOTE_ARRAY(tone_qwerty, false, 0);
#endif
persistant_default_layer_set(1UL<<_QWERTY);
}
return false;
break;
case COLEMAK:
if (record->event.pressed) {
#ifdef AUDIO_ENABLE
PLAY_NOTE_ARRAY(tone_colemak, false, 0);
#endif
persistant_default_layer_set(1UL<<_COLEMAK);
}
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;
case BACKLIT:
if (record->event.pressed) {
register_code(KC_RSFT);
#ifdef BACKLIGHT_ENABLE
backlight_step();
#endif
} else {
unregister_code(KC_RSFT);
}
return false;
break;
}
return true;
}
void matrix_init_user(void) {
#ifdef AUDIO_ENABLE
startup_user();
#endif
}
#ifdef AUDIO_ENABLE
void startup_user()
{
_delay_ms(20); // gets rid of tick
PLAY_NOTE_ARRAY(tone_startup, false, 0);
}
void shutdown_user()
{
PLAY_NOTE_ARRAY(tone_goodbye, false, 0);
_delay_ms(150);
stop_all_notes();
}
void music_on_user(void)
{
music_scale_user();
}
void music_scale_user(void)
{
PLAY_NOTE_ARRAY(music_scale, false, 0);
}
#endif

View File

@ -0,0 +1,10 @@
# sgoodwin's Planck Layout
Includes:
1. No Dvorak or Plover
2. No alt-swapping
3. Right enter is shift when held down, enter when tapped.
4. Bottom left corner in normal layers is Hyper and not brightness control.
5. Brightness is instead in the bottom corner on raise/lower.

View File

@ -65,9 +65,9 @@ bool process_tap_dance(uint16_t keycode, keyrecord_t *record) {
highest_td = idx; highest_td = idx;
action = &tap_dance_actions[idx]; action = &tap_dance_actions[idx];
action->state.keycode = keycode;
action->state.pressed = record->event.pressed; action->state.pressed = record->event.pressed;
if (record->event.pressed) { if (record->event.pressed) {
action->state.keycode = keycode;
action->state.count++; action->state.count++;
action->state.timer = timer_read(); action->state.timer = timer_read();
@ -77,8 +77,9 @@ bool process_tap_dance(uint16_t keycode, keyrecord_t *record) {
process_tap_dance_action_on_dance_finished (paction); process_tap_dance_action_on_dance_finished (paction);
reset_tap_dance (&paction->state); reset_tap_dance (&paction->state);
} }
last_td = keycode;
} }
last_td = keycode;
break; break;

View File

@ -18,6 +18,10 @@ void set_unicode_input_mode(uint8_t os_target)
input_mode = os_target; input_mode = os_target;
} }
uint8_t get_unicode_input_mode(void) {
return input_mode;
}
__attribute__((weak)) __attribute__((weak))
void unicode_input_start (void) { void unicode_input_start (void) {
switch(input_mode) { switch(input_mode) {

View File

@ -13,6 +13,7 @@
#endif #endif
void set_unicode_input_mode(uint8_t os_target); void set_unicode_input_mode(uint8_t os_target);
uint8_t get_unicode_input_mode(void);
void unicode_input_start(void); void unicode_input_start(void);
void unicode_input_finish(void); void unicode_input_finish(void);
void register_hex(uint16_t hex); void register_hex(uint16_t hex);

103
readme.md
View File

@ -58,7 +58,7 @@ Here are the steps
3. Followed by `git reset --hard` 3. Followed by `git reset --hard`
3. Start the "Bash On Ubuntu On Windows" from the start menu 3. Start the "Bash On Ubuntu On Windows" from the start menu
4. With the bash open, navigate to your Git checkout. The harddisk can be accessed from `/mnt` for example `/mnt/c` for the `c:\` drive. 4. With the bash open, navigate to your Git checkout. The harddisk can be accessed from `/mnt` for example `/mnt/c` for the `c:\` drive.
5. Run `sudo util/install_dependencies.sh`. 5. Run `sudo util/install_dependencies.sh`.
6. After a while the installation will finish, and you are good to go 6. After a while the installation will finish, and you are good to go
**Note** From time to time, the dependencies might change, so just run `install_dependencies.sh` again if things are not working. **Note** From time to time, the dependencies might change, so just run `install_dependencies.sh` again if things are not working.
@ -92,12 +92,12 @@ You can also try these instructions:
3. Install [DFU-Programmer][dfu-prog]. 3. Install [DFU-Programmer][dfu-prog].
If you are going to flash Infinity based keyboards you will also need dfu-util If you are going to flash Infinity based keyboards you will also need dfu-util
brew install dfu-util brew install dfu-util
### Linux ### Linux
To ensure you are always up to date, you can just run `sudo utils/install_dependencies.sh`. That should always install all the dependencies needed. To ensure you are always up to date, you can just run `sudo utils/install_dependencies.sh`. That should always install all the dependencies needed.
You can also install things manually, but this documentation might not be always up to date with all requirements. You can also install things manually, but this documentation might not be always up to date with all requirements.
@ -158,7 +158,7 @@ In every keymap folder, the following files are recommended:
* `config.h` - the options to configure your keymap * `config.h` - the options to configure your keymap
* `keymap.c` - all of your keymap code, required * `keymap.c` - all of your keymap code, required
* `Makefile` - the features of QMK that are enabled, required to run `make` in your keymap folder * `Makefile` - the features of QMK that are enabled, required to run `make` in your keymap folder
* `readme.md` - a description of your keymap, how others might use it, and explanations of features * `readme.md` - a description of your keymap, how others might use it, and explanations of features
## The `make` command ## The `make` command
@ -179,7 +179,7 @@ The following instruction refers to these folders.
If the `keymap` folder contains a file name `Makefile` If the `keymap` folder contains a file name `Makefile`
1. Change the directory to the `keymap` folder 1. Change the directory to the `keymap` folder
2. Run `make <subproject>-<programmer>` 2. Run `make <subproject>-<programmer>`
Otherwise, if there's no `Makefile` in the `keymap` folder Otherwise, if there's no `Makefile` in the `keymap` folder
@ -433,7 +433,7 @@ We've added shortcuts to make common modifier/tap (mod-tap) mappings more compac
Steve Losh [described](http://stevelosh.com/blog/2012/10/a-modern-space-cadet/) the Space Cadet Shift quite well. Essentially, you hit the left Shift on its own, and you get an opening parenthesis; hit the right Shift on its own, and you get the closing one. When hit with other keys, the Shift key keeps working as it always does. Yes, it's as cool as it sounds. Steve Losh [described](http://stevelosh.com/blog/2012/10/a-modern-space-cadet/) the Space Cadet Shift quite well. Essentially, you hit the left Shift on its own, and you get an opening parenthesis; hit the right Shift on its own, and you get the closing one. When hit with other keys, the Shift key keeps working as it always does. Yes, it's as cool as it sounds.
To use it, use `KC_LSPO` (Left Shift, Parens Open) for your left Shift on your keymap, and `KC_RSPC` (Right Shift, Parens Close) for your right Shift. To use it, use `KC_LSPO` (Left Shift, Parens Open) for your left Shift on your keymap, and `KC_RSPC` (Right Shift, Parens Close) for your right Shift.
It's defaulted to work on US keyboards, but if your layout uses different keys for parenthesis, you can define those in your `config.h` like this: It's defaulted to work on US keyboards, but if your layout uses different keys for parenthesis, you can define those in your `config.h` like this:
@ -530,11 +530,11 @@ For the sake of flexibility, tap-dance actions can be either a pair of keycodes,
### Examples ### Examples
Here's a simple example for a single definition: Here's a simple example for a single definition:
1. In your `makefile`, add `TAP_DANCE_ENABLE = yes` 1. In your `makefile`, add `TAP_DANCE_ENABLE = yes`
2. In your `config.h` (which you can copy from `qmk_firmware/keyboards/planck/config.h` to your keymap directory), add `#define TAPPING_TERM 200` 2. In your `config.h` (which you can copy from `qmk_firmware/keyboards/planck/config.h` to your keymap directory), add `#define TAPPING_TERM 200`
3. In your `keymap.c` file, define the variables and definitions, then add to your keymap: 3. In your `keymap.c` file, define the variables and definitions, then add to your keymap:
```c ```c
//Tap Dance Declarations //Tap Dance Declarations
@ -550,10 +550,10 @@ qk_tap_dance_action_t tap_dance_actions[] = {
}; };
//In Layer declaration, add tap dance item in place of a key code //In Layer declaration, add tap dance item in place of a key code
TD(TD_ESC_CAPS) TD(TD_ESC_CAPS)
``` ```
Here's a more complex example involving custom actions: Here's a more complex example involving custom actions:
```c ```c
enum { enum {
@ -828,11 +828,11 @@ To enable them, first add a new element to the `planck_keycodes` enum -- `DYNAMI
Afterwards create a new layer called `_DYN`: Afterwards create a new layer called `_DYN`:
#define _DYN 6 /* almost any other free number should be ok */ #define _DYN 6 /* almost any other free number should be ok */
Below these two modifications include the `dynamic_macro.h` header: Below these two modifications include the `dynamic_macro.h` header:
#include "dynamic_macro.h"` #include "dynamic_macro.h"`
Then define the `_DYN` layer with the following keys: `DYN_REC_START1`, `DYN_MACRO_PLAY1`,`DYN_REC_START2` and `DYN_MACRO_PLAY2`. It may also contain other keys, it doesn't matter apart from the fact that you won't be able to record these keys in the dynamic macros. Then define the `_DYN` layer with the following keys: `DYN_REC_START1`, `DYN_MACRO_PLAY1`,`DYN_REC_START2` and `DYN_MACRO_PLAY2`. It may also contain other keys, it doesn't matter apart from the fact that you won't be able to record these keys in the dynamic macros.
[_DYN]= { [_DYN]= {
@ -841,7 +841,7 @@ Then define the `_DYN` layer with the following keys: `DYN_REC_START1`, `DYN_MAC
{_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______}, {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______},
{_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______} {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______}
}, },
Add the following code to the very beginning of your `process_record_user()` function: Add the following code to the very beginning of your `process_record_user()` function:
if (!process_record_dynamic_macro(keycode, record)) { if (!process_record_dynamic_macro(keycode, record)) {
@ -877,6 +877,66 @@ In `quantum/keymap_extras/`, you'll see various language files - these work the
You can currently send 4 hex digits with your OS-specific modifier key (RALT for OSX with the "Unicode Hex Input" layout) - this is currently limited to supporting one OS at a time, and requires a recompile for switching. 8 digit hex codes are being worked on. The keycode function is `UC(n)`, where *n* is a 4 digit hexidecimal. Enable from the Makefile. You can currently send 4 hex digits with your OS-specific modifier key (RALT for OSX with the "Unicode Hex Input" layout) - this is currently limited to supporting one OS at a time, and requires a recompile for switching. 8 digit hex codes are being worked on. The keycode function is `UC(n)`, where *n* is a 4 digit hexidecimal. Enable from the Makefile.
## Backlight Breathing
In order to enable backlight breathing, the following line must be added to your config.h file.
#define BACKLIGHT_BREATHING
The following function calls are used to control the breathing effect.
* ```breathing_enable()``` - Enable the free-running breathing effect.
* ```breathing_disable()``` - Disable the free-running breathing effect immediately.
* ```breathing_self_disable()``` - Disable the free-running breathing effect after the current effect ends.
* ```breathing_toggle()``` - Toggle the free-running breathing effect.
* ```breathing_defaults()``` - Reset the speed and brightness settings of the breathing effect.
The following function calls are used to control the maximum brightness of the breathing effect.
* ```breathing_intensity_set(value)``` - Set the brightness of the breathing effect when it is at its max value.
* ```breathing_intensity_default()``` - Reset the brightness of the breathing effect to the default value based on the current backlight intensity.
The following function calls are used to control the cycling speed of the breathing effect.
* ```breathing_speed_set(value)``` - Set the speed of the breathing effect - how fast it cycles.
* ```breathing_speed_inc(value)``` - Increase the speed of the breathing effect by a fixed value.
* ```breathing_speed_dec(value)``` - Decrease the speed of the breathing effect by a fixed value.
* ```breathing_speed_default()``` - Reset the speed of the breathing effect to the default value.
The following example shows how to enable the backlight breathing effect when the FUNCTION layer macro button is pressed:
case MACRO_FUNCTION:
if (record->event.pressed)
{
breathing_speed_set(3);
breathing_enable();
layer_on(LAYER_FUNCTION);
}
else
{
breathing_speed_set(1);
breathing_self_disable();
layer_off(LAYER_FUNCTION);
}
break;
The following example shows how to pulse the backlight on-off-on when the RAISED layer macro button is pressed:
case MACRO_RAISED:
if (record->event.pressed)
{
layer_on(LAYER_RAISED);
breathing_speed_set(2);
breathing_pulse();
update_tri_layer(LAYER_LOWER, LAYER_RAISED, LAYER_ADJUST);
}
else
{
layer_off(LAYER_RAISED);
update_tri_layer(LAYER_LOWER, LAYER_RAISED, LAYER_ADJUST);
}
break;
## Other firmware shortcut keycodes ## Other firmware shortcut keycodes
* `RESET` - puts the MCU in DFU mode for flashing new firmware (with `make dfu`) * `RESET` - puts the MCU in DFU mode for flashing new firmware (with `make dfu`)
@ -1043,7 +1103,7 @@ For this mod, you need an unused pin wiring to DI of WS2812 strip. After wiring
In order to use the underglow timer functions, you need to have `#define RGBLIGHT_TIMER` in your `config.h`, and have audio disabled (`AUDIO_ENABLE = no` in your Makefile). In order to use the underglow timer functions, you need to have `#define RGBLIGHT_TIMER` in your `config.h`, and have audio disabled (`AUDIO_ENABLE = no` in your Makefile).
Please add the following options into your config.h, and set them up according your hardware configuration. These settings are for the `F4` pin by default: Please add the following options into your config.h, and set them up according your hardware configuration. These settings are for the `F4` pin by default:
#define RGB_DI_PIN F4 // The pin your RGB strip is wired to #define RGB_DI_PIN F4 // The pin your RGB strip is wired to
#define RGBLIGHT_TIMER // Require for fancier stuff (not compatible with audio) #define RGBLIGHT_TIMER // Require for fancier stuff (not compatible with audio)
#define RGBLED_NUM 14 // Number of LEDs #define RGBLED_NUM 14 // Number of LEDs
@ -1090,15 +1150,15 @@ If your keyboard is running an Atmega chip (atmega32u4 and others), it's pretty
The `USB Device descriptor parameter` block contains parameters are used to uniquely identify your keyboard, but they don't really matter to the machine. The `USB Device descriptor parameter` block contains parameters are used to uniquely identify your keyboard, but they don't really matter to the machine.
Your `MATRIX_ROWS` and `MATRIX_COLS` are the numbers of rows and cols in your keyboard matrix - this may be different than the number of actual rows and columns on your keyboard. There are some tricks you can pull to increase the number of keys in a given matrix, but most keyboards are pretty straight-forward. Your `MATRIX_ROWS` and `MATRIX_COLS` are the numbers of rows and cols in your keyboard matrix - this may be different than the number of actual rows and columns on your keyboard. There are some tricks you can pull to increase the number of keys in a given matrix, but most keyboards are pretty straight-forward.
The `MATRIX_ROW_PINS` and `MATRIX_COL_PINS` are the pins your MCU uses on each row/column. Your schematic (if you have one) will have this information on it, and the values will vary depending on your setup. This is one of the most important things to double-check in getting your keyboard setup correctly. The `MATRIX_ROW_PINS` and `MATRIX_COL_PINS` are the pins your MCU uses on each row/column. Your schematic (if you have one) will have this information on it, and the values will vary depending on your setup. This is one of the most important things to double-check in getting your keyboard setup correctly.
For the `DIODE_DIRECTION`, most hand-wiring guides will instruct you to wire the diodes in the `COL2ROW` position, but it's possible that they are in the other - people coming from EasyAVR often use `ROW2COL`. Nothing will function if this is incorrect. For the `DIODE_DIRECTION`, most hand-wiring guides will instruct you to wire the diodes in the `COL2ROW` position, but it's possible that they are in the other - people coming from EasyAVR often use `ROW2COL`. Nothing will function if this is incorrect.
`BACKLIGHT_PIN` is the pin that your PWM-controlled backlight (if one exists) is hooked-up to. Currently only B5, B6, and B7 are supported. `BACKLIGHT_PIN` is the pin that your PWM-controlled backlight (if one exists) is hooked-up to. Currently only B5, B6, and B7 are supported.
`BACKLIGHT_BREATHING` is a fancier backlight feature, and uses one of the timers. `BACKLIGHT_BREATHING` is a fancier backlight feature that adds breathing/pulsing/fading effects to the backlight. It uses the same timer as the normal backlight. These breathing effects must be called by code in your keymap.
`BACKLIGHT_LEVELS` is how many levels exist for your backlight - max is 15, and they are computed automatically from this number. `BACKLIGHT_LEVELS` is how many levels exist for your backlight - max is 15, and they are computed automatically from this number.
@ -1145,14 +1205,14 @@ Each of the `kxx` variables needs to be unique, and usually follows the format `
# Unit Testing # Unit Testing
If you are new to unit testing, then you can find many good resources on internet. However most of it is scattered around in small pieces here and there, and there's also many different opinions, so I won't give any recommendations. If you are new to unit testing, then you can find many good resources on internet. However most of it is scattered around in small pieces here and there, and there's also many different opinions, so I won't give any recommendations.
Instead I recommend these two books, explaining two different styles of Unit Testing in detail. Instead I recommend these two books, explaining two different styles of Unit Testing in detail.
* "Test Driven Development: By Example: Kent Beck" * "Test Driven Development: By Example: Kent Beck"
* "Growing Object-Oriented Software, Guided By Tests: Steve Freeman, Nat Pryce" * "Growing Object-Oriented Software, Guided By Tests: Steve Freeman, Nat Pryce"
If you prefer videos there are Uncle Bob's [Clean Coders Videos](https://cleancoders.com/), which unfortunately cost quite a bit, especially if you want to watch many of them. But James Shore has a free [Let's Play](http://www.jamesshore.com/Blog/Lets-Play) video series. If you prefer videos there are Uncle Bob's [Clean Coders Videos](https://cleancoders.com/), which unfortunately cost quite a bit, especially if you want to watch many of them. But James Shore has a free [Let's Play](http://www.jamesshore.com/Blog/Lets-Play) video series.
## Google Test and Google Mock ## Google Test and Google Mock
It's possible to Unit Test your code using [Google Test](https://github.com/google/googletest). The Google Test framework also includes another component for writing testing mocks and stubs, called "Google Mock". For information how to write the actual tests, please refer to the documentation on that site. It's possible to Unit Test your code using [Google Test](https://github.com/google/googletest). The Google Test framework also includes another component for writing testing mocks and stubs, called "Google Mock". For information how to write the actual tests, please refer to the documentation on that site.
@ -1161,7 +1221,7 @@ It's possible to Unit Test your code using [Google Test](https://github.com/goog
Note that Google Test and therefore any test has to be written in C++, even if the rest of the QMK codebases is written in C. This should hopefully not be a problem even if you don't know any C++, since there's quite clear documentation and examples of the required C++ features, and you can write the rest of the test code almost as you would write normal C. Note that some compiler errors which you might get can look quite scary, but just read carefully what it says, and you should be ok. Note that Google Test and therefore any test has to be written in C++, even if the rest of the QMK codebases is written in C. This should hopefully not be a problem even if you don't know any C++, since there's quite clear documentation and examples of the required C++ features, and you can write the rest of the test code almost as you would write normal C. Note that some compiler errors which you might get can look quite scary, but just read carefully what it says, and you should be ok.
One thing to remember, is that you have to append `extern "C"` around all of your C file includes. One thing to remember, is that you have to append `extern "C"` around all of your C file includes.
## Adding tests for new or existing features ## Adding tests for new or existing features
@ -1189,7 +1249,6 @@ If there are problems with the tests, you can find the executable in the `./buil
## Full Integration tests ## Full Integration tests
It's not yet possible to do a full integration test, where you would compile the whole firmware and define a keymap that you are going to test. However there are plans for doing that, because writing tests that way would probably be easier, at least for people that are not used to unit testing. It's not yet possible to do a full integration test, where you would compile the whole firmware and define a keymap that you are going to test. However there are plans for doing that, because writing tests that way would probably be easier, at least for people that are not used to unit testing.
In that model you would emulate the input, and expect a certain output from the emulated keyboard. In that model you would emulate the input, and expect a certain output from the emulated keyboard.

View File

@ -332,11 +332,13 @@ $1/compiler.txt: $1/force
$$(CC) --version | cmp -s - $$@ || $$(CC) --version > $$@ $$(CC) --version | cmp -s - $$@ || $$(CC) --version > $$@
endef endef
.PRECIOUS: $(MASTER_OUTPUT)/obj.txt
$(MASTER_OUTPUT)/obj.txt: $(MASTER_OUTPUT)/force $(MASTER_OUTPUT)/obj.txt: $(MASTER_OUTPUT)/force
echo '$(OBJ)' | cmp -s - $$@ || echo '$(OBJ)' > $$@ echo '$(OBJ)' | cmp -s - $@ || echo '$(OBJ)' > $@
.PRECIOUS: $(MASTER_OUTPUT)/ldflags.txt
$(MASTER_OUTPUT)/ldflags.txt: $(MASTER_OUTPUT)/force $(MASTER_OUTPUT)/ldflags.txt: $(MASTER_OUTPUT)/force
echo '$(LDFLAGS)' | cmp -s - $$@ || echo '$(LDFLAGS)' > $$@ echo '$(LDFLAGS)' | cmp -s - $@ || echo '$(LDFLAGS)' > $@
# We have to use static rules for the .d files for some reason # We have to use static rules for the .d files for some reason