Merge remote-tracking branch 'refs/remotes/jackhumbert/master'

This commit is contained in:
IBNobody 2016-09-25 16:36:30 -05:00
commit 24a953ae64
43 changed files with 2017 additions and 503 deletions

View File

@ -71,6 +71,8 @@ OPT_DEFS += -DBOOTLOADER_SIZE=512
# comment out to disable the options. # comment out to disable the options.
# #
SLEEP_LED_ENABLE = no
ifndef QUANTUM_DIR ifndef QUANTUM_DIR
include ../../../Makefile include ../../../Makefile
endif endif

View File

@ -7,7 +7,7 @@ CONSOLE_ENABLE = no
TAP_DANCE_ENABLE = yes TAP_DANCE_ENABLE = yes
KEYLOGGER_ENABLE ?= yes KEYLOGGER_ENABLE ?= yes
UCIS_ENABLE = yes UCIS_ENABLE = yes
MOUSEKEY_ENABLE ?= yes MOUSEKEY_ENABLE = no
AUTOLOG_ENABLE ?= no AUTOLOG_ENABLE ?= no
@ -25,6 +25,8 @@ OPT_DEFS += -DKEYLOGGER_ENABLE
CONSOLE_ENABLE = yes CONSOLE_ENABLE = yes
endif endif
OPT_DEFS += -DUSER_PRINT
KEYMAP_VERSION = $(shell \ KEYMAP_VERSION = $(shell \
if [ -d "${KEYMAP_PATH}/.git" ]; then \ if [ -d "${KEYMAP_PATH}/.git" ]; then \
cd "${KEYMAP_PATH}" && git describe --abbrev=6 --dirty --always --tags --match 'v*' 2>/dev/null; \ cd "${KEYMAP_PATH}" && git describe --abbrev=6 --dirty --always --tags --match 'v*' 2>/dev/null; \

Binary file not shown.

Before

Width:  |  Height:  |  Size: 92 KiB

After

Width:  |  Height:  |  Size: 95 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 93 KiB

After

Width:  |  Height:  |  Size: 100 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 135 KiB

After

Width:  |  Height:  |  Size: 136 KiB

View File

@ -8,7 +8,6 @@
#include "debug.h" #include "debug.h"
#include "action_layer.h" #include "action_layer.h"
#include "action_util.h" #include "action_util.h"
#include "mousekey.h"
#include "timer.h" #include "timer.h"
#include "keymap_plover.h" #include "keymap_plover.h"
#include "eeconfig.h" #include "eeconfig.h"
@ -36,18 +35,6 @@ enum {
A_PLVR, A_PLVR,
A_MPN, A_MPN,
// Function / number keys
KF_1, // 1, F1
KF_2, // 2, F2
KF_3, // ...
KF_4,
KF_5,
KF_6,
KF_7,
KF_8,
KF_9,
KF_10,
// Application select keys // Application select keys
APP_SLK, // Slack APP_SLK, // Slack
APP_EMCS, // Emacs APP_EMCS, // Emacs
@ -55,17 +42,6 @@ enum {
APP_CHRM, // Chrome APP_CHRM, // Chrome
APP_MSIC, // Music APP_MSIC, // Music
// Diagonal mouse movement
A_MUL,
A_MUR,
A_MDL,
A_MDR,
// Mouse acceleration
A_ACL0,
A_ACL1,
A_ACL2,
// Hungarian layer keys // Hungarian layer keys
HU_AA, // Á HU_AA, // Á
HU_OO, // Ó HU_OO, // Ó
@ -76,6 +52,18 @@ enum {
HU_UE, // Ü HU_UE, // Ü
HU_OEE, // Ő HU_OEE, // Ő
HU_UEE, // Ű HU_UEE, // Ű
// number/symbol keys
A_1, // 1
A_2, // 2
A_3, // ...
A_4,
A_5,
A_6,
A_7,
A_8,
A_9,
A_0,
}; };
/* Fn keys */ /* Fn keys */
@ -95,7 +83,9 @@ enum {
CT_CLN = 0, CT_CLN = 0,
CT_TA, CT_TA,
CT_LBP, CT_LBP,
CT_RBP CT_RBP,
CT_TMUX,
CT_TPS,
}; };
/* States & timers */ /* States & timers */
@ -114,6 +104,8 @@ bool log_enable = false;
bool time_travel = false; bool time_travel = false;
static uint8_t is_adore = 0;
/* The Keymap */ /* The Keymap */
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
@ -121,13 +113,13 @@ 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 | | F12 | 6 F6 | 7 F7 | 8 F8 | 9 F9 | 0 F10| F11 | * | Next/Prev | 9 | 7 @ | 5 * | 3 ^ | 1 $ | F11 | | F12 | 0 % | 2 ! | 4 # | 6 & | 8 | Plover |
* |-----------+------+------+------+------+-------------| |------+------+------+------+------+------+-----------| * |-----------+------+------+------+------+-------------| |------+------+------+------+------+------+-----------|
* | ~ | ' | , | . | 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 |
* |-----------+------+------+------+------+------| : | | - |------+------+------+------+------+-----------| * |-----------+------+------+------+------+------| tmux | | tmux |------+------+------+------+------+-----------|
* | Play/Pause| / | Q | J | K | X | | | | B | M | W | V | Z | Stop | * | Play/Pause| / | Q | J | K | X | | | Pane | B | M | W | V | Z | Stop |
* `-----------+------+------+------+------+-------------' `-------------+------+------+------+------+-----------' * `-----------+------+------+------+------+-------------' `-------------+------+------+------+------+-----------'
* | | | | | : | | - | | | | | * | | | | | : | | - | | | | |
* `-----------------------------------' `-----------------------------------' * `-----------------------------------' `-----------------------------------'
@ -141,22 +133,22 @@ 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(A_9) ,M(A_7) ,M(A_5) ,M(A_3) ,M(A_1) ,KC_F11
,KC_GRV ,KC_QUOT ,KC_COMM ,KC_DOT ,KC_P ,KC_Y ,TD(CT_LBP) ,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 ,TD(CT_CLN) ,KC_MPLY ,KC_SLSH ,KC_Q ,KC_J ,KC_K ,KC_X ,TD(CT_TMUX)
,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),KC_ESC ,KC_BSPC,F(F_SFT),KC_ESC
// right hand // right hand
,KC_F12 ,M(KF_6),M(KF_7) ,M(KF_8),M(KF_9) ,M(KF_10) ,KC_F11 ,KC_F12 ,M(A_0) ,M(A_2) ,M(A_4) ,M(A_6) ,M(A_8) ,M(A_PLVR)
,TD(CT_RBP),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_MINS ,KC_B ,KC_M ,KC_W ,KC_V ,KC_Z ,KC_MSTP ,TD(CT_TPS),KC_B ,KC_M ,KC_W ,KC_V ,KC_Z ,KC_MSTP
,KC_MINS ,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
@ -166,15 +158,15 @@ 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 | | F12 | 6 F6 | 7 F7 | 8 F8 | 9 F9 | 0 F10| F11 | * | Play/Pause| 9 | 7 @ | 5 * | 3 ^ | 1 $ | F11 | | F12 | 0 % | 2 ! | 4 # | 6 & | 8 | Plover |
* |-----------+------+------+------+------+-------------| |------+------+------+------+------+------+-----------| * |-----------+------+------+------+------+-------------| |------+------+------+------+------+------+-----------|
* | `~ | Y | W | G | L | M | ( | | ) | F | H | C | P | X | \ | * | `~ | X | W | G | L | M | ( | | ) | F | H | C | P | Y | \ |
* |-----------+------+------+------+------+------| [ | | ] |------+------+------+------+------+-----------| * |-----------+------+------+------+------+------| [ | | ] |------+------+------+------+------+-----------|
* | Tab/Arrow | A | O | E | I | U |------| |------| D | R | T | N | S | = | * | Tab/Arrow | A | O | E | I | U |------| |------| D | R | T | N | S | = |
* |-----------+------+------+------+------+------| | | |------+------+------+------+------+-----------| * |-----------+------+------+------+------+------| tmux | | tmux |------+------+------+------+------+-----------|
* | | Z | Q | ' | , | . | : | | - | B | K | V | J | / | | * | | Z | Q | ' | , | . | | | pane | B | K | V | J | / | |
* `-----------+------+------+------+------+-------------' `-------------+------+------+------+------+-----------' * `-----------+------+------+------+------+-------------' `-------------+------+------+------+------+-----------'
* | | | | | | | | | | | | * | | | | | : | | - | | | | |
* `-----------------------------------' `-----------------------------------' * `-----------------------------------' `-----------------------------------'
* ,-------------. ,-------------. * ,-------------. ,-------------.
* | LAlt | GUI | | MDIA | Del | * | LAlt | GUI | | MDIA | Del |
@ -186,22 +178,22 @@ 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(A_9) ,M(A_7) ,M(A_5) ,M(A_3) ,M(A_1) ,KC_F11
,KC_GRV ,KC_Y ,KC_W ,KC_G ,KC_L ,KC_M ,TD(CT_LBP) ,KC_GRV ,KC_X ,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_TMUX)
,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,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),KC_ESC ,KC_BSPC,F(F_SFT),KC_ESC
// right hand // right hand
,KC_F12 ,M(KF_6),M(KF_7),M(KF_8),M(KF_9) ,M(KF_10) ,KC_F11 ,KC_F12 ,M(A_0) ,M(A_2) ,M(A_4) ,M(A_6) ,M(A_8) ,M(A_PLVR)
,TD(CT_RBP),KC_F ,KC_H ,KC_C ,KC_P ,KC_X ,KC_BSLS ,TD(CT_RBP),KC_F ,KC_H ,KC_C ,KC_P ,KC_Y ,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
,KC_MINS ,KC_B ,KC_K ,KC_V ,KC_J ,KC_SLSH ,KC_NO ,TD(CT_TPS),KC_B ,KC_K ,KC_V ,KC_J ,KC_SLSH ,KC_NO
,KC_NO ,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
,F(F_HUN) ,F(F_HUN)
@ -350,45 +342,45 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Keymap 5: Navigation & Media layer /* Keymap 5: Navigation & Media layer
* *
* ,-----------------------------------------------------. ,-----------------------------------------------------. * ,-----------------------------------------------------. ,-----------------------------------------------------.
* | MS Slow | | | | | |ScrLCK| |ScrLCK| | | | | | | * | | F9 | F7 | F5 | F3 | F1 | | |ScrLCK| F10 | F2 | F4 | F6 | F8 | |
* |-----------+------+------+------+------+-------------| |------+------+------+------+------+------+-----------| * |-----------+------+------+------+------+-------------| |------+------+------+------+------+------+-----------|
* | MS Normal | | Home | Up | PgUp | | | |Scroll| |MsUpL | MsUp |MsUpR | |PrintScreen| * | | | | | | | | | | | | | | | |
* |-----------+------+------+------+------+------| | | Up |------+------+------+------+------+-----------| * |-----------+------+------+------+------+------| | | |------+------+------+------+------+-----------|
* | MS Fast | | Left | Down | Right| |------| |------| |MsLeft| MsDn |MsRght| | | * | | | | | | |------| |------| | | | | | |
* |-----------+------+------+------+------+------| | |Scroll|------+------+------+------+------+-----------| * |-----------+------+------+------+------+------| | | |------+------+------+------+------+-----------|
* | Play/Pause| | End | Down | PgDn | | | | Down | |MsDnL | MsDn |MsDnR | | Stop | * | | | | | | | | | | | | | | | |
* `-----------+------+------+------+------+-------------' `-------------+------+------+------+------+-----------' * `-----------+------+------+------+------+-------------' `-------------+------+------+------+------+-----------'
* | | | | | | | | | | | | * | | | | | | | | | | | |
* `----------------------------------' `----------------------------------' * `----------------------------------' `----------------------------------'
* ,-------------. ,-------------. * ,-------------. ,-------------.
* | Mute | VlUp | | BASE | MClk | * | Mute | VlUp | | BASE | |
* ,------|------|------| |------+------+------. * ,------|------|------| |------+------+------.
* | | | VlDn | | Prev |Left |Right | * | | | VlDn | | | | |
* | SPC | Enter|------| |------| Click| Click| * | | |------| |------| | |
* | | | ESC | | Next | | | * | | | | | | | |
* `--------------------' `--------------------' * `--------------------' `--------------------'
*/ */
[NMDIA] = KEYMAP( [NMDIA] = KEYMAP(
// left hand // left hand
M(A_ACL0) ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,LGUI(KC_L) KC_NO ,KC_F9 ,KC_F7 ,KC_F5 ,KC_F3 ,KC_F1 ,KC_NO
,M(A_ACL1) ,KC_NO ,KC_HOME ,KC_UP ,KC_PGUP ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO
,M(A_ACL2) ,KC_NO ,KC_LEFT ,KC_DOWN ,KC_RIGHT,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,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_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,KC_ESC ,KC_NO ,KC_NO ,KC_TRNS
// right hand // right hand
,LGUI(KC_L),KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,LGUI(KC_L),KC_F10 ,KC_F2 ,KC_F4 ,KC_F6 ,KC_F8 ,KC_NO
,KC_WH_U ,KC_NO ,M(A_MUL),KC_MS_U ,M(A_MUR),KC_NO ,KC_PSCR ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO
,KC_NO ,KC_MS_L ,KC_MS_D ,KC_MS_R ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO
,KC_WH_D ,KC_NO ,M(A_MDL),KC_MS_D ,M(A_MDR),KC_NO ,KC_MSTP ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO
,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO
,KC_TRNS ,KC_MS_BTN3 ,KC_TRNS ,KC_NO
,KC_MPRV ,KC_NO
,KC_MNXT ,KC_BTN1 ,KC_BTN2 ,KC_NO ,KC_NO ,KC_NO
), ),
/* Keymap 6: Steno for Plover /* Keymap 6: Steno for Plover
@ -514,40 +506,62 @@ static macro_t *ang_do_hun (keyrecord_t *record, uint16_t accent, uint16_t hun_c
return MACRO_NONE; return MACRO_NONE;
} }
static bool from_appsel; static void ang_handle_num_row(uint8_t id, keyrecord_t *record) {
uint8_t idx = id - A_1;
uint8_t kc;
static bool shifted[10];
static void ang_handle_kf (keyrecord_t *record, uint8_t id) if (keyboard_report->mods & MOD_BIT(KC_LSFT) ||
{ ((get_oneshot_mods() & MOD_BIT(KC_LSFT)) && !has_oneshot_mods_timed_out())) {
uint8_t code = id - KF_1; if (record->event.pressed)
shifted[idx] = true;
}
if (!shifted[idx]) {
kc = idx + KC_1;
} else {
switch (id) {
case A_8:
case A_9:
shifted[idx] = false;
return;
case A_7:
kc = KC_2;
break;
case A_5:
kc = KC_8;
break;
case A_3:
kc = KC_6;
break;
case A_1:
kc = KC_4;
break;
case A_0:
kc = KC_5;
break;
case A_2:
kc = KC_1;
break;
case A_4:
kc = KC_3;
break;
case A_6:
kc = KC_7;
break;
}
}
if (record->event.pressed) { if (record->event.pressed) {
kf_timers[code] = timer_read (); register_code (kc);
} else { } else {
uint8_t kc_base; unregister_code (kc);
shifted[idx] = false;
if (from_appsel) {
from_appsel = false;
return;
}
if (kf_timers[code] && timer_elapsed (kf_timers[code]) > TAPPING_TERM) {
// 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) {
@ -592,70 +606,6 @@ 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 */
case A_MUL:
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);
}
mousekey_send();
break;
case A_MUR:
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);
}
mousekey_send();
break;
case A_MDL:
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);
}
mousekey_send();
break;
case A_MDR:
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);
}
mousekey_send();
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);
@ -667,7 +617,6 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
register_code (KC_LGUI); register_code (KC_LGUI);
if (record->tap.count && !record->tap.interrupted) { if (record->tap.count && !record->tap.interrupted) {
if (record->tap.count >= 2) { if (record->tap.count >= 2) {
register_code (KC_W);
layer_on (APPSEL); layer_on (APPSEL);
set_oneshot_layer (APPSEL, ONESHOT_START); set_oneshot_layer (APPSEL, ONESHOT_START);
} }
@ -678,7 +627,6 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
} else { } else {
if (record->tap.count >= 2) if (record->tap.count >= 2)
{ {
unregister_code (KC_W);
clear_oneshot_layer_state (ONESHOT_PRESSED); clear_oneshot_layer_state (ONESHOT_PRESSED);
} }
gui_timer = timer_read (); gui_timer = timer_read ();
@ -686,43 +634,39 @@ 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; if (record->event.pressed)
return MACRODOWN(T(S), T(L), T(A), T(C), T(K), T(ENT), END); uprintf("CMD:appsel_slack\n");
break;
case APP_EMCS: case APP_EMCS:
from_appsel = true; if (record->event.pressed)
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); uprintf("CMD:appsel_emacs\n");
break;
case APP_TERM: case APP_TERM:
from_appsel = true; if (record->event.pressed)
if (!record->event.pressed) { uprintf("CMD:appsel_term\n");
register_code(KC_ESC);
unregister_code(KC_ESC);
wait_ms(TAPPING_TERM + 25);
register_code(KC_DEL);
unregister_code(KC_DEL);
}
break; break;
case APP_CHRM: case APP_CHRM:
from_appsel = true; if (record->event.pressed)
return MACRODOWN(T(C), T(H), T(R), T(O), T(M), T(ENT), END); uprintf("CMD:appsel_chrome\n");
break;
case APP_MSIC: case APP_MSIC:
from_appsel = true; if (record->event.pressed)
return MACRODOWN(T(R), T(H), T(Y), T(T), T(H), T(M), T(B), T(O), T(X), T(ENT), END); uprintf("CMD:appsel_music\n");
break;
/* Function keys */ // number row and symbols
case KF_1 ... KF_10: case A_1 ... A_0:
ang_handle_kf (record, id); ang_handle_num_row(id, record);
break; break;
} }
return MACRO_NONE; return MACRO_NONE;
}; };
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;
@ -805,6 +749,36 @@ static void ang_tap_dance_ta_reset (qk_tap_dance_state_t *state, void *user_data
layer_off (ARRW); layer_off (ARRW);
} }
static void ang_tap_dance_tmux_finished (qk_tap_dance_state_t *state, void *user_data) {
if (state->count == 1) {
register_code(KC_LALT);
register_code(KC_SPC);
unregister_code(KC_SPC);
unregister_code(KC_LALT);
} else {
register_code(KC_LCTL);
register_code(KC_A);
unregister_code(KC_A);
unregister_code(KC_LCTL);
}
}
static void ang_tap_dance_tmux_pane_select (qk_tap_dance_state_t *state, void *user_data) {
uint8_t kc = KC_P;
if (state->count >= 2) {
kc = KC_Z;
}
register_code(KC_LALT);
register_code(KC_SPC);
unregister_code(KC_SPC);
unregister_code(KC_LALT);
register_code(kc);
unregister_code(kc);
}
qk_tap_dance_action_t tap_dance_actions[] = { qk_tap_dance_action_t tap_dance_actions[] = {
[CT_CLN] = ACTION_TAP_DANCE_DOUBLE (KC_COLN, KC_SCLN) [CT_CLN] = ACTION_TAP_DANCE_DOUBLE (KC_COLN, KC_SCLN)
,[CT_TA] = { ,[CT_TA] = {
@ -813,12 +787,23 @@ qk_tap_dance_action_t tap_dance_actions[] = {
} }
,[CT_LBP] = ACTION_TAP_DANCE_DOUBLE (KC_LBRC, KC_LPRN) ,[CT_LBP] = ACTION_TAP_DANCE_DOUBLE (KC_LBRC, KC_LPRN)
,[CT_RBP] = ACTION_TAP_DANCE_DOUBLE (KC_RBRC, KC_RPRN) ,[CT_RBP] = ACTION_TAP_DANCE_DOUBLE (KC_RBRC, KC_RPRN)
,[CT_TMUX]= ACTION_TAP_DANCE_FN (ang_tap_dance_tmux_finished)
,[CT_TPS] = ACTION_TAP_DANCE_FN (ang_tap_dance_tmux_pane_select)
}; };
// 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) {
static uint32_t prev_layer_state;
uint8_t layer = biton32(layer_state); uint8_t layer = biton32(layer_state);
bool is_arrow = false; bool is_arrow = false;
static char *layer_lookup[] = {"Dvorak", "ADORE", "Arrows", "AppSel", "Hungarian", "Nav/Media", "Plover"};
if (layer_state != prev_layer_state) {
prev_layer_state = layer_state;
if (layer_lookup[layer])
uprintf("LAYER: %s\n", layer_lookup[layer]);
}
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);
@ -929,18 +914,7 @@ void matrix_scan_user(void) {
} }
SEQ_TWO_KEYS (KC_W, KC_M) { SEQ_TWO_KEYS (KC_W, KC_M) {
register_code (KC_LALT); uprintf("CMD:wm\n");
register_code (KC_F2);
unregister_code (KC_F2);
unregister_code (KC_LALT);
wait_ms (1000);
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);
register_code (KC_LGUI);
register_code (KC_UP);
unregister_code (KC_UP);
unregister_code (KC_LGUI);
} }
SEQ_ONE_KEY (KC_A) { SEQ_ONE_KEY (KC_A) {
@ -999,8 +973,11 @@ const qk_ucis_symbol_t ucis_symbol_table[] = UCIS_TABLE
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=%02d, row=%02d, pressed=%d, layer=%s\n", record->event.key.col, uint8_t layer = biton32(layer_state);
record->event.key.row, record->event.pressed, (is_adore) ? "ADORE" : "Dvorak");
if ((layer == ADORE) || (layer == BASE))
uprintf ("KL: col=%02d, row=%02d, pressed=%d, layer=%s\n", record->event.key.col,
record->event.key.row, record->event.pressed, (is_adore) ? "ADORE" : "Dvorak");
} }
#endif #endif
@ -1047,8 +1024,8 @@ void qk_ucis_symbol_fallback (void) {
for (uint8_t i = 0; i < qk_ucis_state.count - 1; i++) { for (uint8_t i = 0; i < qk_ucis_state.count - 1; i++) {
uint8_t code; uint8_t code;
if (qk_ucis_state.codes[i] > KF_1) if ((qk_ucis_state.codes[i] >= M(A_1)) && (qk_ucis_state.codes[i] <= M(A_0)))
code = qk_ucis_state.codes[i] - KF_1 + KC_1; code = qk_ucis_state.codes[i] - M(A_1) + KC_1;
else else
code = qk_ucis_state.codes[i]; code = qk_ucis_state.codes[i];
register_code(code); register_code(code);

View File

@ -18,12 +18,11 @@ Some of the things in the layout only work when one uses [Spacemacs][spacemacs]
* [Layouts](#layouts) * [Layouts](#layouts)
- [Base layer](#base-layer) - [Base layer](#base-layer)
- [ADORE layer](#adore-layer) - [ADORE layer](#adore-layer)
- [Hungarian layer](#hungarian-layer)
- [Navigation and media layer](#navigation-and-media-layer)
- [Steno layer](#steno-layer) - [Steno layer](#steno-layer)
- [LED states](#led-states) - [LED states](#led-states)
* [Tools](#tools) * [Tools](#tools)
- [Heatmap](#heatmap) - [Heatmap](#heatmap)
- [Layer notification](#layer-notification)
* [Special features](#special-features) * [Special features](#special-features)
- [Unicode Symbol Input](#unicode-symbol-input) - [Unicode Symbol Input](#unicode-symbol-input)
* [Building](#building) * [Building](#building)
@ -39,7 +38,7 @@ Some of the things in the layout only work when one uses [Spacemacs][spacemacs]
At its core, this is a Dvorak layout, with some minor changes. The more interesting parts are how certain keys behave: At its core, this is a Dvorak layout, with some minor changes. The more interesting parts are how certain keys behave:
* The keys on the number row double as function keys, when held for a bit longer than an usual tap. This allows me to use the function keys without having to switch layers. * The number row is the same as in the [ADORE](#adore-layer) layer. The function keys are on the **Media** layer.
* The `Shift`, `Alt`, and `Control` modifiers are one-shot. When tapped, they are considered active for the next key press only. When double tapped, they toggle on, until a third, single tap sometime later. When held, they act as expected. My usual pattern is that I use these for the next keypress only, so this behaviour is perfect. If I need them held, I'll just double-tap. * The `Shift`, `Alt`, and `Control` modifiers are one-shot. When tapped, they are considered active for the next key press only. When double tapped, they toggle on, until a third, single tap sometime later. When held, they act as expected. My usual pattern is that I use these for the next keypress only, so this behaviour is perfect. If I need them held, I'll just double-tap.
* 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.
@ -57,28 +56,16 @@ At its core, this is a Dvorak layout, with some minor changes. The more interest
- `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 u` enters the [Unicode symbol input](#unicode-symbol-input) mode. - `LEAD u` enters the [Unicode symbol input](#unicode-symbol-input) mode.
The symbols on the front in the image above have the same color as the key that activates them, with the exception of the **Arrow** layer, which is just black on the front.
## ADORE layer ## ADORE layer
[![ADORE layer](images/adore-layer.png)](http://www.keyboard-layout-editor.com/#/gists/45681a17453d235925b6028dd83bf12a) [![ADORE layer](images/adore-layer.png)](http://www.keyboard-layout-editor.com/#/gists/45681a17453d235925b6028dd83bf12a)
While using the standard Dvorak layout, I encountered a number of inconveniences, and on this layer, I am playing with ideas to make the layout feel better. Initially, it was based on [Capewell-Dvorak][cpd], but that too, had shortcomings I was not happy with. So now this is something inbetween, with own observations thrown in. How it works out in the long run remains to be seen. My experimental layout, that I keep tweaking. No full description here, because things are very much in flux.
[cpd]: http://www.michaelcapewell.com/projects/keyboard/layout_capewell-dvorak.htm Note that the **HUN** layer does not work well with ADORE: it still has the same layout as on the [Base](#base-layer) layer. This will remain until ADORE becomes the default.
Based on a week and a half of typing, the keys were rearranged, and the home row neatly spelled out **ADORE**, that gave the layout its name.
## Hungarian layer
[![Hungarian layer](images/hun-layer.png)](http://www.keyboard-layout-editor.com/#/gists/b160f6ec90d58c127c114c89f66e9dc9)
On this layer, the accented characters are at the same position as their base variant. For some, which can have other diatribes, the long one is on top, short's on bottom. Tapping any of the accented characters takes us back to the base layer.
## Navigation and media layer
[![Navigation and media layer](images/nav-n-media-layer.png)](http://www.keyboard-layout-editor.com/#/gists/c59c453f9fe1a3238ba1494e7e5c6892)
This layer is primarily for navigating with the cursor or the mouse, and some media things.
## Steno layer ## Steno layer
@ -93,8 +80,8 @@ The primary purpose of the LEDs is to show the modifier status, a secondary, to
For the layers, the following rules apply: 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 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 **Media** layer is active, the *red* and *green* ones are on.
* When the **ARROW** layer is active, the *red* and *blue* 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.
@ -129,6 +116,10 @@ The generated heatmap looks somewhat like this:
![Heatmap](images/heatmap.png) ![Heatmap](images/heatmap.png)
## Layer notification
There is a very small tool in `tools/layer-notify`, that listens to the HID console, looking for layer change events, and pops up a notification for every detected change. It is a very simple tool, mainly serving as an example.
# Building # Building
To make my workflow easier, this layout is maintained in [its own repository][algernon:ez-layout]. To build it, you will need the [QMK][qmk] firmware checked out, and this repo either checked out to something like `keyboards/ergodox_ez/algernon-master`. One way to achieve that is this: To make my workflow easier, this layout is maintained in [its own repository][algernon:ez-layout]. To build it, you will need the [QMK][qmk] firmware checked out, and this repo either checked out to something like `keyboards/ergodox_ez/algernon-master`. One way to achieve that is this:
@ -156,6 +147,43 @@ The keymap default to forcing NKRO, which seems to upset Windows, and except the
# Changelog # Changelog
## v1.7
*2016-09-18*
### Overall changes
* The number row has been completely rearranged on both the [Base](#base-layer) and the [ADORE](#adore-layer) layers.
* The number/function key behavior was changed: function keys are now on the **Media**.
* The `:`/`;` and `-`/`_` keys were put back to their thumb position on the bottom row, on both the [Base](#base-layer) and [ADORE](#adore-layer) layers.
* The bottom large keys on the inner side of each half now function as [tmux](http://tmux.github.io/) keys: the left to send the prefix, the right to send the `display-panes` key. The left also doubles as a GNU screen prefix key, and sends `C-a` when double tapped.
* A number of functions, such as the **AppSel** layer, now require the `hid-commands` tool to be running, with the output of `hid_listen` being piped to it.
### ADORE
* `Y` and `X` have been swapped again.
### Media/Navigation layer
* The function keys are now on this layer.
* Mouse keys have been removed.
* Media start/stop/prev/next have been removed.
* `Print screen` has been removed.
* There is only one screen lock key now.
### Heatmap
* Fixed a few issues in the finger-stats calculation.
* The tool now also timestamps and saves all input lines to a logfile, which it loads on start, allowing one to continue the collection after upgrading the tool.
* The heatmap tool will now colorize the stats by default.
* The periodic stats are now printed in a more compact format.
### Tools
* Added a new tool, `tools/layer-notify` that listens to layer change events on the HID console, and pops up a notification on layer changes.
* Another new tool, `tools/text-to-log.py` has been added that converts arbitrary text to a keylogger output, which can be fed to the heatmap generator.
* A number of features have been moved to the `tools/hid-commands` utility. These generally are OS dependent, and are easier to implement on the software side.
## v1.6 ## v1.6
*2016-08-24* *2016-08-24*
@ -174,7 +202,7 @@ The keymap default to forcing NKRO, which seems to upset Windows, and except the
### Miscellaneous changes ### Miscellaneous changes
* `LEAD u` now starts the symbolic unicode input system, instead of the OS-one. * `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. * The mouse acceleration keys on the **Navigation/Media** 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. * When the **ARROW** layer is on, the *red* and *blue* LEDs light up now.
### Heatmap ### Heatmap
@ -221,7 +249,7 @@ The keymap default to forcing NKRO, which seems to upset Windows, and except the
* 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.
* The `=` and `\` keys were swapped, `=` moved to the home row, on both the [base](#base-layer) and the **experimental** layers. * The `=` and `\` keys were swapped, `=` moved to the home row, on both the [base](#base-layer) and the **experimental** layers.
* The arrow and navigation keys were redone, they are now more accessible, but the navigation keys require an extra tap to access. * The arrow and navigation keys were redone, they are now more accessible, but the navigation keys require an extra tap to access.
* The **Emacs** layer is gone, replaced by a simplified [navigation and media](#navigation-and-media-layer) layer. * The **Emacs** layer is gone, replaced by a simplified **navigation and media** layer.
* `LEAD v` types the firmware version, and the keymap version. * `LEAD v` types the firmware version, and the keymap version.
* 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.
@ -240,7 +268,7 @@ The keymap default to forcing NKRO, which seems to upset Windows, and except the
- `-` on the left half was replaced by `Tab`. - `-` on the left half was replaced by `Tab`.
- `Tab`'s original position is taken by a `Media Next`/`Media Prev` key. - `Tab`'s original position is taken by a `Media Next`/`Media Prev` key.
- `:` now inputs `;` when shifted. - `:` now inputs `;` when shifted.
* `ESC` cancels the [Hungarian](#hungarian-layer) layer too, not just modifiers. * `ESC` cancels the **Hungarian** layer too, not just modifiers.
## v1.0 ## v1.0

View File

@ -13,18 +13,15 @@
[ [
{ {
"x": 3.5, "x": 3.5,
"c": "#a7d0db",
"fa": [ "fa": [
0, 0,
0, 0,
2 2
] ]
}, },
"#\n3\nF3", "*\n5\nF5",
{ {
"x": 10.5, "x": 10.5,
"c": "#a7d0db",
"t": "#000000",
"a": 4, "a": 4,
"fa": [ "fa": [
0, 0,
@ -32,54 +29,44 @@
2 2
] ]
}, },
"*\n8\nF8" "#\n4\nF4"
], ],
[ [
{ {
"y": -0.875, "y": -0.875,
"x": 2.5, "x": 2.5
"c": "#bfbad1",
"t": "#0d0d0b"
}, },
"@\n2\nF2", "@\n7\nF7",
{ {
"x": 1, "x": 1
"c": "#7adabd",
"t": "#000000"
}, },
"$\n4\nF4", "^\n3\nF3",
{ {
"x": 8.5 "x": 8.5
}, },
"&\n7\nF7", "!\n2\nF2",
{ {
"x": 1, "x": 1
"c": "#bfbad1",
"t": "#0d0d0b"
}, },
"(\n9\nF9" "&\n6\nF6"
], ],
[ [
{ {
"y": -0.875, "y": -0.875,
"x": 5.5, "x": 5.5
"c": "#7adabd",
"t": "#000000"
}, },
"%\n5\nF5", "$\n1\nF1",
{ {
"c": "#f9cd31",
"a": 7, "a": 7,
"f": 2 "f": 3
}, },
"STENO", "F11",
{ {
"x": 4.5, "x": 4.5,
"f": 3 "f": 3
}, },
"F12", "F12",
{ {
"c": "#7adabd",
"a": 4, "a": 4,
"f": 3, "f": 3,
"fa": [ "fa": [
@ -88,19 +75,17 @@
2 2
] ]
}, },
"^\n6\nF6" "%\n0\nF10"
], ],
[ [
{ {
"y": -0.875, "y": -0.875,
"c": "#ffb2d2",
"f": 9, "f": 9,
"a": 6, "a": 6,
"w": 1.5 "w": 1.5
}, },
"\n\n<i class='kb kb-Multimedia-Play-Pause'></i>", "\n\n<i class='kb kb-Multimedia-Play-Pause'></i>",
{ {
"t": "#0d0d0b",
"f": 3, "f": 3,
"a": 4, "a": 4,
"fa": [ "fa": [
@ -109,23 +94,21 @@
2 2
] ]
}, },
"!\n1\nF1", " \n9\nF9",
{ {
"x": 14.5 "x": 14.5
}, },
")\n0\nF10", " \n8\nF8",
{ {
"a": 7, "a": 7,
"w": 1.5 "w": 1.5
}, },
"F11" "STENO"
], ],
[ [
{ {
"y": -0.375, "y": -0.375,
"x": 3.5, "x": 3.5,
"c": "#a7d0db",
"t": "#000000",
"a": 6 "a": 6
}, },
"G", "G",
@ -138,15 +121,11 @@
{ {
"y": -0.875, "y": -0.875,
"x": 2.5, "x": 2.5,
"c": "#bfbad1",
"t": "#0d0d0b",
"a": 6 "a": 6
}, },
"W", "W",
{ {
"x": 1, "x": 1,
"c": "#7adabd",
"t": "#000000",
"a": 6 "a": 6
}, },
"L", "L",
@ -155,22 +134,17 @@
}, },
"H", "H",
{ {
"x": 1, "x": 1
"c": "#bfbad1",
"t": "#0d0d0b"
}, },
"P" "P"
], ],
[ [
{ {
"y": -0.875, "y": -0.875,
"x": 5.5, "x": 5.5
"c": "#7adabd",
"t": "#000000"
}, },
"M", "M",
{ {
"c": "#93c9b7",
"a": 4, "a": 4,
"fa": [0, 0, 0], "fa": [0, 0, 0],
"h": 1.5 "h": 1.5
@ -182,7 +156,6 @@
}, },
"}\n)\n]", "}\n)\n]",
{ {
"c": "#7adabd",
"a": 6 "a": 6
}, },
"F" "F"
@ -190,24 +163,21 @@
[ [
{ {
"y": -0.875, "y": -0.875,
"c": "#ffb07b",
"t": "#0d0d0b",
"f": 3, "f": 3,
"a": 4, "a": 4,
"w": 1.5 "w": 1.5
}, },
"\n\n~\n`", "\n\n~\n`",
{ {
"c": "#ffb2d2",
"a": 6, "a": 6,
"f": 3 "f": 3
}, },
"Y", "X",
{ {
"x": 14.5, "x": 14.5,
"a": 6 "a": 6
}, },
"X", "Y",
{ {
"a": 4, "a": 4,
"w": 1.5 "w": 1.5
@ -218,8 +188,6 @@
{ {
"y": -0.375, "y": -0.375,
"x": 3.5, "x": 3.5,
"c": "#a7d0db",
"t": "#000000",
"a": 6 "a": 6
}, },
"E", "E",
@ -231,15 +199,11 @@
[ [
{ {
"y": -0.875, "y": -0.875,
"x": 2.5, "x": 2.5
"c": "#bfbad1",
"t": "#0d0d0b"
}, },
"O", "O",
{ {
"x": 1, "x": 1,
"c": "#7adabd",
"t": "#000000",
"n": true "n": true
}, },
"I", "I",
@ -249,18 +213,14 @@
}, },
"R", "R",
{ {
"x": 1, "x": 1
"c": "#bfbad1",
"t": "#0d0d0b"
}, },
"N" "N"
], ],
[ [
{ {
"y": -0.875, "y": -0.875,
"x": 5.5, "x": 5.5
"c": "#7adabd",
"t": "#000000"
}, },
"U", "U",
{ {
@ -271,8 +231,6 @@
[ [
{ {
"y": -0.875, "y": -0.875,
"c": "#ffb2d2",
"t": "#0d0d0b",
"fa": [ "fa": [
6 6
], ],
@ -308,22 +266,21 @@
{ {
"y": -0.625, "y": -0.625,
"x": 6.5, "x": 6.5,
"c": "#93c9b7", "a": 7,
"t": "#000000", "f": 9,
"h": 1.5 "h": 1.5
}, },
";\n:", "<i class='fa fa-columns'></i>",
{ {
"x": 4.5, "x": 4.5,
"h": 1.5 "h": 1.5
}, },
"_\n-" "<i class='fa fa-table'></i>"
], ],
[ [
{ {
"y": -0.75, "y": -0.75,
"x": 3.5, "x": 3.5,
"c": "#a7d0db",
"a": 4, "a": 4,
"f": 3 "f": 3
}, },
@ -339,15 +296,11 @@
{ {
"y": -0.875, "y": -0.875,
"x": 2.5, "x": 2.5,
"c": "#bfbad1",
"t": "#0d0d0b",
"a": 6 "a": 6
}, },
"Q", "Q",
{ {
"x": 1, "x": 1,
"c": "#7adabd",
"t": "#000000",
"a": 4 "a": 4
}, },
"<\n,", "<\n,",
@ -357,9 +310,7 @@
}, },
"K", "K",
{ {
"x": 1, "x": 1
"c": "#bfbad1",
"t": "#0d0d0b"
}, },
"J" "J"
], ],
@ -367,8 +318,6 @@
{ {
"y": -0.875, "y": -0.875,
"x": 5.5, "x": 5.5,
"c": "#7adabd",
"t": "#000000",
"a": 4 "a": 4
}, },
">\n.", ">\n.",
@ -381,15 +330,12 @@
[ [
{ {
"y": -0.875, "y": -0.875,
"c": "#ffb07b",
"f": 9, "f": 9,
"w": 1.5, "w": 1.5,
"g": true "g": true
}, },
"", "",
{ {
"c": "#ffb2d2",
"t": "#0d0d0b",
"a": 6, "a": 6,
"f": 3, "f": 3,
"g": false "g": false
@ -401,8 +347,6 @@
}, },
"?\n/", "?\n/",
{ {
"c": "#ffb07b",
"t": "#000000",
"f": 9, "f": 9,
"g": true, "g": true,
"w": 1.5, "w": 1.5,
@ -414,7 +358,6 @@
{ {
"y": -0.375, "y": -0.375,
"x": 3.5, "x": 3.5,
"c": "#d9dae0",
"g": true, "g": true,
"a": 7, "a": 7,
"f": 3 "f": 3
@ -433,18 +376,16 @@
"", "",
{ {
"x": 1, "x": 1,
"c": "#d4872a", "g": false,
"g": true,
"a": 5 "a": 5
}, },
"", ";\n:",
{ {
"x": 8.5 "x": 8.5
}, },
"", "_\n-",
{ {
"x": 1, "x": 1,
"c": "#d9dae0",
"g": true, "g": true,
"a": 7 "a": 7
}, },
@ -472,7 +413,6 @@
"ry": 4.25, "ry": 4.25,
"y": -1, "y": -1,
"x": 1, "x": 1,
"c": "#f9cd31",
"g": false "g": false
}, },
"Alt", "Alt",
@ -489,7 +429,6 @@
], ],
[ [
{ {
"c": "#d4872a",
"a": 7, "a": 7,
"f": 9, "f": 9,
"h": 2 "h": 2
@ -500,15 +439,13 @@
}, },
"<i class='fa fa-angle-double-up'></i>", "<i class='fa fa-angle-double-up'></i>",
{ {
"c": "#f9cd31",
"f": 3 "f": 3
}, },
"Ctrl" "Ctrl"
], ],
[ [
{ {
"x": 2, "x": 2
"c": "#e26757"
}, },
"ESC" "ESC"
], ],
@ -518,7 +455,6 @@
"rx": 13, "rx": 13,
"y": -1, "y": -1,
"x": -3, "x": -3,
"c": "#f9cd31",
"f": 2 "f": 2
}, },
"MEDIA", "MEDIA",
@ -531,7 +467,6 @@
}, },
"HUN", "HUN",
{ {
"c": "#d4872a",
"f": 9, "f": 9,
"h": 2 "h": 2
}, },
@ -545,7 +480,6 @@
[ [
{ {
"x": -3, "x": -3,
"c": "#f9cd31",
"f": 2 "f": 2
}, },
"LEAD" "LEAD"

View File

@ -13,18 +13,15 @@
[ [
{ {
"x": 3.5, "x": 3.5,
"c": "#a7d0db",
"fa": [ "fa": [
0, 0,
0, 0,
2 2
] ]
}, },
"#\n3\nF3", "*\n5\nF5",
{ {
"x": 10.5, "x": 10.5,
"c": "#a7d0db",
"t": "#000000",
"a": 4, "a": 4,
"fa": [ "fa": [
0, 0,
@ -32,54 +29,44 @@
2 2
] ]
}, },
"*\n8\nF8" "#\n4\nF4"
], ],
[ [
{ {
"y": -0.875, "y": -0.875,
"x": 2.5, "x": 2.5
"c": "#bfbad1",
"t": "#0d0d0b"
}, },
"@\n2\nF2", "@\n7\nF7",
{ {
"x": 1, "x": 1
"c": "#7adabd",
"t": "#000000"
}, },
"$\n4\nF4", "^\n3\nF3",
{ {
"x": 8.5 "x": 8.5
}, },
"&\n7\nF7", "!\n2\nF2",
{ {
"x": 1, "x": 1
"c": "#bfbad1",
"t": "#0d0d0b"
}, },
"(\n9\nF9" "&\n6\nF6"
], ],
[ [
{ {
"y": -0.875, "y": -0.875,
"x": 5.5, "x": 5.5
"c": "#7adabd",
"t": "#000000"
}, },
"%\n5\nF5", "$\n1\nF1",
{ {
"c": "#f9cd31",
"a": 7, "a": 7,
"f": 2 "f": 3
}, },
"STENO", "F11",
{ {
"x": 4.5, "x": 4.5,
"f": 3 "f": 3
}, },
"F12", "F12",
{ {
"c": "#7adabd",
"a": 4, "a": 4,
"f": 3, "f": 3,
"fa": [ "fa": [
@ -88,12 +75,11 @@
2 2
] ]
}, },
"^\n6\nF6" "%\n0\nF10"
], ],
[ [
{ {
"y": -0.875, "y": -0.875,
"c": "#ffb2d2",
"f": 6, "f": 6,
"a": 6, "a": 6,
"w": 1.5 "w": 1.5
@ -101,7 +87,6 @@
"<i class='fa fa-fast-backward'></i>\n\n<i class='fa fa-fast-forward'></i>", "<i class='fa fa-fast-backward'></i>\n\n<i class='fa fa-fast-forward'></i>",
{ {
"f": 3, "f": 3,
"t": "#0d0d0b",
"a": 4, "a": 4,
"fa": [ "fa": [
0, 0,
@ -110,23 +95,21 @@
] ]
}, },
"!\n1\nF1", " \n9\nF9",
{ {
"x": 14.5 "x": 14.5
}, },
")\n0\nF10", " \n8\nF8",
{ {
"a": 7, "a": 7,
"w": 1.5 "w": 1.5
}, },
"F11" "STENO"
], ],
[ [
{ {
"y": -0.375, "y": -0.375,
"x": 3.5, "x": 3.5,
"c": "#a7d0db",
"t": "#000000",
"a": 4 "a": 4
}, },
">\n.", ">\n.",
@ -140,15 +123,11 @@
{ {
"y": -0.875, "y": -0.875,
"x": 2.5, "x": 2.5,
"c": "#bfbad1",
"t": "#0d0d0b",
"a": 4 "a": 4
}, },
"<\n,", "<\n,",
{ {
"x": 1, "x": 1,
"c": "#7adabd",
"t": "#000000",
"a": 6 "a": 6
}, },
"P", "P",
@ -157,22 +136,17 @@
}, },
"G", "G",
{ {
"x": 1, "x": 1
"c": "#bfbad1",
"t": "#0d0d0b"
}, },
"R" "R"
], ],
[ [
{ {
"y": -0.875, "y": -0.875,
"x": 5.5, "x": 5.5
"c": "#7adabd",
"t": "#000000"
}, },
"Y", "Y",
{ {
"c": "#93c9b7",
"a": 4, "a": 4,
"h": 1.5 "h": 1.5
}, },
@ -183,7 +157,6 @@
}, },
"}\n)\n]", "}\n)\n]",
{ {
"c": "#7adabd",
"a": 6 "a": 6
}, },
"F" "F"
@ -191,14 +164,12 @@
[ [
{ {
"y": -0.875, "y": -0.875,
"c": "#ffb07b",
"t": "#0d0d0b",
"f": 3, "f": 3,
"a": 4,
"w": 1.5 "w": 1.5
}, },
"\n\n~\n`", "\n\n~\n`",
{ {
"c": "#ffb2d2",
"a": 4, "a": 4,
"f": 3 "f": 3
}, },
@ -218,8 +189,6 @@
{ {
"y": -0.375, "y": -0.375,
"x": 3.5, "x": 3.5,
"c": "#a7d0db",
"t": "#000000",
"a": 6 "a": 6
}, },
"E", "E",
@ -231,15 +200,11 @@
[ [
{ {
"y": -0.875, "y": -0.875,
"x": 2.5, "x": 2.5
"c": "#bfbad1",
"t": "#0d0d0b"
}, },
"O", "O",
{ {
"x": 1, "x": 1,
"c": "#7adabd",
"t": "#000000",
"n": true "n": true
}, },
"U", "U",
@ -249,18 +214,14 @@
}, },
"H", "H",
{ {
"x": 1, "x": 1
"c": "#bfbad1",
"t": "#0d0d0b"
}, },
"N" "N"
], ],
[ [
{ {
"y": -0.875, "y": -0.875,
"x": 5.5, "x": 5.5
"c": "#7adabd",
"t": "#000000"
}, },
"I", "I",
{ {
@ -271,8 +232,6 @@
[ [
{ {
"y": -0.875, "y": -0.875,
"c": "#ffb2d2",
"t": "#0d0d0b",
"fa": [ "fa": [
6 6
], ],
@ -308,23 +267,22 @@
{ {
"y": -0.625, "y": -0.625,
"x": 6.5, "x": 6.5,
"c": "#93c9b7",
"t": "#000000",
"a": 7, "a": 7,
"f": 9,
"h": 1.5 "h": 1.5
}, },
"(", "<i class='fa fa-columns'></i>",
{ {
"x": 4.5, "x": 4.5,
"h": 1.5 "h": 1.5
}, },
")" "<i class='fa fa-table'></i>"
], ],
[ [
{ {
"y": -0.75, "y": -0.75,
"x": 3.5, "x": 3.5,
"c": "#a7d0db", "f": 3,
"a": 6 "a": 6
}, },
"J", "J",
@ -336,15 +294,11 @@
[ [
{ {
"y": -0.875, "y": -0.875,
"x": 2.5, "x": 2.5
"c": "#bfbad1",
"t": "#0d0d0b"
}, },
"Q", "Q",
{ {
"x": 1, "x": 1
"c": "#7adabd",
"t": "#000000"
}, },
"K", "K",
{ {
@ -352,18 +306,14 @@
}, },
"M", "M",
{ {
"x": 1, "x": 1
"c": "#bfbad1",
"t": "#0d0d0b"
}, },
"V" "V"
], ],
[ [
{ {
"y": -0.875, "y": -0.875,
"x": 5.5, "x": 5.5
"c": "#7adabd",
"t": "#000000"
}, },
"X", "X",
{ {
@ -374,14 +324,11 @@
[ [
{ {
"y": -0.875, "y": -0.875,
"c": "#ffb07b",
"f": 9, "f": 9,
"w": 1.5 "w": 1.5
}, },
"\n\n<i class='kb kb-Multimedia-Play-Pause'></i>", "\n\n<i class='kb kb-Multimedia-Play-Pause'></i>",
{ {
"c": "#ffb2d2",
"t": "#0d0d0b",
"a": 4, "a": 4,
"f": 3 "f": 3
}, },
@ -392,8 +339,6 @@
}, },
"Z", "Z",
{ {
"c": "#ffb07b",
"t": "#000000",
"f": 9, "f": 9,
"w": 1.5 "w": 1.5
}, },
@ -403,7 +348,6 @@
{ {
"y": -0.375, "y": -0.375,
"x": 3.5, "x": 3.5,
"c": "#d9dae0",
"g": true, "g": true,
"a": 7, "a": 7,
"f": 3 "f": 3
@ -422,7 +366,6 @@
"", "",
{ {
"x": 1, "x": 1,
"c": "#d4872a",
"g": false, "g": false,
"a": 5 "a": 5
}, },
@ -433,7 +376,6 @@
"_\n-", "_\n-",
{ {
"x": 1, "x": 1,
"c": "#d9dae0",
"g": true, "g": true,
"a": 7 "a": 7
}, },
@ -461,7 +403,6 @@
"ry": 4.25, "ry": 4.25,
"y": -1, "y": -1,
"x": 1, "x": 1,
"c": "#f9cd31",
"g": false "g": false
}, },
"Alt", "Alt",
@ -478,7 +419,6 @@
], ],
[ [
{ {
"c": "#d4872a",
"a": 7, "a": 7,
"f": 9, "f": 9,
"h": 2 "h": 2
@ -489,15 +429,13 @@
}, },
"<i class='fa fa-angle-double-up'></i>", "<i class='fa fa-angle-double-up'></i>",
{ {
"c": "#f9cd31",
"f": 3 "f": 3
}, },
"Ctrl" "Ctrl"
], ],
[ [
{ {
"x": 2, "x": 2
"c": "#e26757"
}, },
"ESC" "ESC"
], ],
@ -507,7 +445,6 @@
"rx": 13, "rx": 13,
"y": -1, "y": -1,
"x": -3, "x": -3,
"c": "#f9cd31",
"f": 2 "f": 2
}, },
"MEDIA", "MEDIA",
@ -520,7 +457,6 @@
}, },
"LEAD", "LEAD",
{ {
"c": "#d4872a",
"f": 9, "f": 9,
"h": 2 "h": 2
}, },
@ -534,7 +470,6 @@
[ [
{ {
"x": -3, "x": -3,
"c": "#f9cd31",
"f": 2 "f": 2
}, },
"HUN" "HUN"

View File

@ -0,0 +1,61 @@
#!/bin/bash
set -e
cmd_wm () {
WIN="$(xdotool getactivewindow)"
wmctrl -i -r ${WIN} -b remove,maximized_vert,maximized_horz
xdotool windowsize ${WIN} 100% 100%
wmctrl -i -r ${WIN} -b add,maximized_vert,maximized_horz
}
_cmd_appsel () {
wmctrl -x -a $1 || true
xdotool key Escape
}
cmd_appsel_music () {
wmctrl -x -a rhythmbox || wmctrl -x -a spotify || true
xdotool key Escape
}
cmd_appsel_slack () {
_cmd_appsel slack
}
cmd_appsel_emacs () {
_cmd_appsel emacs24
}
cmd_appsel_term () {
_cmd_appsel gnome-terminal
}
cmd_appsel_chrome () {
_cmd_appsel chromium
}
cmd_help () {
cat <<EOF
Use the source, Luke!
EOF
}
while read l; do
case "$l" in
"CMD:"*)
;;
*)
continue
;;
esac
cmd="$(echo $l | cut -d: -f2-)"
echo "Got command: ${cmd}"
if type cmd_${cmd} >/dev/null 2>&1; then
cmd_${cmd}
fi
done

View File

@ -0,0 +1,12 @@
#!/bin/sh
HL="${HID_LISTEN:-$HOME/src/ext/hid_listen/hid_listen}"
sudo "${HL}" | grep --line-buffered LAYER: | \
(while read line; do
case $line in
LAYER:*)
layer="$(echo $(echo $line | cut -d: -f2-))"
notify-send -i mark-location-symbolic "Switched to layer: $layer"
;;
esac
done)

View File

@ -1,12 +1,15 @@
#! /usr/bin/env python #! /usr/bin/env python3
import json import json
import os import os
import sys import sys
import re import re
import argparse import argparse
import time
from math import floor from math import floor
from os.path import dirname from os.path import dirname
from subprocess import Popen, PIPE, STDOUT
from blessings import Terminal
class Heatmap(object): class Heatmap(object):
coords = [ coords = [
@ -33,7 +36,7 @@ class Heatmap(object):
[ [
# Row 4 # Row 4
[20, 0], [20, 2], [19, 0], [18, 0], [19, 2], [], [], [], [], [20, 0], [20, 2], [19, 0], [18, 0], [19, 2], [], [], [], [],
[19, 4], [18, 2], [19, 6], [20, 4], [20, 6], [19, 4], [18, 2], [19, 6], [20, 4], [20, 6], [], [], [], []
], ],
[ [
# Row 5 # Row 5
@ -56,11 +59,13 @@ class Heatmap(object):
def set_attr(orig, new): def set_attr(orig, new):
return new return new
def set_bg(self, (block, n), color): def set_bg(self, coords, color):
(block, n) = coords
self.set_attr_at(block, n, "c", self.set_attr, color) self.set_attr_at(block, n, "c", self.set_attr, color)
#self.set_attr_at(block, n, "g", self.set_attr, False) #self.set_attr_at(block, n, "g", self.set_attr, False)
def set_tap_info(self, (block, n), count, cap): def set_tap_info(self, coords, count, cap):
(block, n) = coords
def _set_tap_info(o, _count, _cap): def _set_tap_info(o, _count, _cap):
ns = 4 - o.count ("\n") ns = 4 - o.count ("\n")
return o + "\n" * ns + "%.02f%%" % (float(_count) / float(_cap) * 100) return o + "\n" * ns + "%.02f%%" % (float(_count) / float(_cap) * 100)
@ -87,8 +92,8 @@ class Heatmap(object):
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" % (int(r), int(g), int(b))
def __init__(self, layout): def __init__(self, layout):
self.log = {} self.log = {}
@ -96,7 +101,8 @@ class Heatmap(object):
self.max_cnt = 0 self.max_cnt = 0
self.layout = layout self.layout = layout
def update_log(self, (c, r)): def update_log(self, coords):
(c, r) = coords
if not (c, r) in self.log: if not (c, r) in self.log:
self.log[(c, r)] = 0 self.log[(c, r)] = 0
self.log[(c, r)] = self.log[(c, r)] + 1 self.log[(c, r)] = self.log[(c, r)] + 1
@ -132,18 +138,17 @@ class Heatmap(object):
# right hand # right hand
[0, 0, 0, 0, 0] [0, 0, 0, 0, 0]
] ]
finger_map = [0, 0, 1, 2, 3, 4, 4] finger_map = [0, 0, 1, 2, 3, 3, 3, 1, 1, 1, 2, 3, 4, 4]
for (c, r) in self.log: for (c, r) in self.log:
if r == 5: # thumb cluster if r == 5: # thumb cluster
if c <= 6: # left side if c <= 6: # left side
usage[0][4] = usage[0][4] + self.log[(c, r)] usage[0][4] = usage[0][4] + self.log[(c, r)]
else: else:
usage[1][4] = usage[1][4] + self.log[(c, r)] usage[1][0] = usage[1][0] + self.log[(c, r)]
else: else:
fc = c fc = c
hand = 0 hand = 0
if fc >= 7: if fc >= 7:
fc = fc - 7
hand = 1 hand = 1
fm = finger_map[fc] fm = finger_map[fc]
usage[hand][fm] = usage[hand][fm] + self.log[(c, r)] usage[hand][fm] = usage[hand][fm] + self.log[(c, r)]
@ -157,79 +162,158 @@ class Heatmap(object):
if total == 0: if total == 0:
total = 1 total = 1
stats = { stats = {
"total-keys": total,
"hands": { "hands": {
"left": { "left": {
"usage": float(hand_usage[0]) / total * 100, "usage": round(float(hand_usage[0]) / total * 100, 2),
"fingers": { "fingers": {
"0 - pinky": 0, "pinky": 0,
"1 - ring": 0, "ring": 0,
"2 - middle": 0, "middle": 0,
"3 - index": 0, "index": 0,
"4 - thumb": 0, "thumb": 0,
} }
}, },
"right": { "right": {
"usage": float(hand_usage[1]) / total * 100, "usage": round(float(hand_usage[1]) / total * 100, 2),
"fingers": { "fingers": {
"0 - thumb": 0, "thumb": 0,
"1 - index": 0, "index": 0,
"2 - middle": 0, "middle": 0,
"3 - ring": 0, "ring": 0,
"4 - pinky": 0, "pinky": 0,
} }
}, },
} }
} }
hmap = ['left', 'right'] hmap = ['left', 'right']
fmap = ['0 - pinky', '1 - ring', '2 - middle', '3 - index', '4 - thumb', fmap = ['pinky', 'ring', 'middle', 'index', 'thumb',
'0 - thumb', '1 - index', '2 - middle', '3 - ring', '4 - pinky'] 'thumb', 'index', 'middle', 'ring', 'pinky']
for hand_idx in range(len(usage)): for hand_idx in range(len(usage)):
hand = usage[hand_idx] hand = usage[hand_idx]
for finger_idx in range(len(hand)): 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 stats['hands'][hmap[hand_idx]]['fingers'][fmap[finger_idx + hand_idx * 5]] = round(float(hand[finger_idx]) / total * 100, 2)
return stats return stats
def dump_all(out_dir, heatmaps): def dump_all(out_dir, heatmaps):
for layer in heatmaps.keys(): stats = {}
t = Terminal()
t.clear()
sys.stdout.write("\x1b[2J\x1b[H")
print ('{t.underline}{outdir}{t.normal}\n'.format(t=t, outdir=out_dir))
keys = list(heatmaps.keys())
keys.sort()
for layer in keys:
if len(heatmaps[layer].log) == 0: if len(heatmaps[layer].log) == 0:
continue continue
with open ("%s/%s.json" % (out_dir, layer), "w") as f: with open ("%s/%s.json" % (out_dir, layer), "w") as f:
json.dump(heatmaps[layer].get_heatmap(), f) json.dump(heatmaps[layer].get_heatmap(), f)
print >>sys.stderr, "%s stats:" % (layer) stats[layer] = heatmaps[layer].get_stats()
json.dump (heatmaps[layer].get_stats(), sys.stderr,
indent = 4, sort_keys = True) left = stats[layer]['hands']['left']
print >>sys.stderr, "" right = stats[layer]['hands']['right']
print >>sys.stderr, ""
print ('{t.bold}{layer}{t.normal} ({total:,} taps):'.format(t=t, layer=layer,
total=int(stats[layer]['total-keys'] / 2)))
print (('{t.underline} | ' + \
'left ({l[usage]:6.2f}%) | ' + \
'right ({r[usage]:6.2f}%) |{t.normal}').format(t=t, l=left, r=right))
print ((' {t.bright_magenta}pinky{t.white} | {left[pinky]:6.2f}% | {right[pinky]:6.2f}% |\n' + \
' {t.bright_cyan}ring{t.white} | {left[ring]:6.2f}% | {right[ring]:6.2f}% |\n' + \
' {t.bright_blue}middle{t.white} | {left[middle]:6.2f}% | {right[middle]:6.2f}% |\n' + \
' {t.bright_green}index{t.white} | {left[index]:6.2f}% | {right[index]:6.2f}% |\n' + \
' {t.bright_red}thumb{t.white} | {left[thumb]:6.2f}% | {right[thumb]:6.2f}% |\n' + \
'').format(left=left['fingers'], right=right['fingers'], t=t))
def process_line(line, heatmaps, opts, stamped_log = None):
m = re.search ('KL: col=(\d+), row=(\d+), pressed=(\d+), layer=(.*)', line)
if not m:
return False
if stamped_log is not None:
if line.startswith("KL:"):
print ("%10.10f %s" % (time.time(), line),
file = stamped_log, end = '')
else:
print (line,
file = stamped_log, end = '')
stamped_log.flush()
(c, r, l) = (int(m.group (2)), int(m.group (1)), m.group (4))
if (c, r) not in opts.allowed_keys:
return False
heatmaps[l].update_log ((c, r))
return True
def setup_allowed_keys(opts):
if len(opts.only_key):
incmap={}
for v in opts.only_key:
m = re.search ('(\d+),(\d+)', v)
if not m:
continue
(c, r) = (int(m.group(1)), int(m.group(2)))
incmap[(c, r)] = True
else:
incmap={}
for r in range(0, 6):
for c in range(0, 14):
incmap[(c, r)] = True
for v in opts.ignore_key:
m = re.search ('(\d+),(\d+)', v)
if not m:
continue
(c, r) = (int(m.group(1)), int(m.group(2)))
del(incmap[(c, r)])
return incmap
def main(opts): def main(opts):
heatmaps = {"Dvorak": Heatmap("Dvorak"), heatmaps = {"Dvorak": Heatmap("Dvorak"),
"ADORE": Heatmap("ADORE") "ADORE": Heatmap("ADORE")
} }
cnt = 0 cnt = 0
restrict_row = opts.restrict_row
out_dir = opts.outdir out_dir = opts.outdir
if not os.path.exists(out_dir):
os.makedirs(out_dir)
opts.allowed_keys = setup_allowed_keys(opts)
if not opts.one_shot:
try:
with open("%s/stamped-log" % out_dir, "r") as f:
while True:
line = f.readline()
if not line:
break
if not process_line(line, heatmaps, opts):
continue
except:
pass
stamped_log = open ("%s/stamped-log" % (out_dir), "a+")
else:
stamped_log = None
while True: while True:
line = sys.stdin.readline() line = sys.stdin.readline()
if not line: if not line:
break break
m = re.search ('KL: col=(\d+), row=(\d+), pressed=(\d+), layer=(.*)', line) if not process_line(line, heatmaps, opts, stamped_log):
if not m:
continue continue
cnt = cnt + 1 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
heatmaps[l].update_log ((c, r)) if opts.dump_interval != -1 and cnt >= opts.dump_interval and not opts.one_shot:
if opts.dump_interval != -1 and cnt >= opts.dump_interval:
cnt = 0 cnt = 0
dump_all(out_dir, heatmaps) dump_all(out_dir, heatmaps)
@ -239,11 +323,17 @@ if __name__ == "__main__":
parser = argparse.ArgumentParser (description = "keylog to heatmap processor") parser = argparse.ArgumentParser (description = "keylog to heatmap processor")
parser.add_argument ('outdir', action = 'store', parser.add_argument ('outdir', action = 'store',
help = 'Output directory') help = 'Output directory')
parser.add_argument ('--row', dest = 'restrict_row', action = 'store', type = int,
default = -1, help = 'Restrict processing to this row only')
parser.add_argument ('--dump-interval', dest = 'dump_interval', action = 'store', type = int, 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') 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, parser.add_argument ('--ignore-key', dest = 'ignore_key', action = 'append', type = str,
default = [], help = 'Ignore the specified columns') default = [], help = 'Ignore the key at position (x, y)')
parser.add_argument ('--only-key', dest = 'only_key', action = 'append', type = str,
default = [], help = 'Only include key at position (x, y)')
parser.add_argument ('--one-shot', dest = 'one_shot', action = 'store_true',
help = 'Do not load previous data, and do not update it, either.')
args = parser.parse_args() args = parser.parse_args()
if len(args.ignore_key) and len(args.only_key):
print ("--ignore-key and --only-key are mutually exclusive, please only use one of them!",
file = sys.stderr)
sys.exit(1)
main(args) main(args)

View File

@ -1,5 +0,0 @@
#! /bin/sh
WIN="$(xdotool getactivewindow)"
wmctrl -i -r ${WIN} -b remove,maximized_vert,maximized_horz
xdotool windowsize ${WIN} 100% 100%
wmctrl -i -r ${WIN} -b add,maximized_vert,maximized_horz

View File

@ -0,0 +1,107 @@
#!/usr/bin/env python3
import os
import sys
charmap = {
'9': [[1, 0]],
'7': [[2, 0]], '@': [[2, 5], [2, 0]],
'5': [[3, 0]], '*': [[2, 5], [3, 0]],
'3': [[4, 0]], '^': [[2, 5], [4, 0]],
'1': [[5, 0]], '$': [[2, 5], [5, 0]],
'0': [[8, 0]], '%': [[2, 5], [8, 0]],
'2': [[9, 0]], '!': [[2, 5], [9, 0]],
'4': [[10, 0]], '#': [[2, 5], [10, 0]],
'6': [[11, 0]], '&': [[2, 5], [11, 0]],
'8': [[12, 0]],
'`': [[0, 1]], '~': [[2, 5], [0, 1]],
'y': [[1, 1]], 'Y': [[2, 5], [1, 1]],
'w': [[2, 1]], 'W': [[2, 5], [2, 1]],
'g': [[3, 1]], 'G': [[2, 5], [3, 1]],
'l': [[4, 1]], 'L': [[2, 5], [4, 1]],
'm': [[5, 1]], 'M': [[2, 5], [5, 1]],
'[': [[6, 1]], '{': [[2, 5], [6, 1]], '(': [[6, 1], [6, 1]],
']': [[7, 1]], '}': [[2, 5], [7, 1]], ')': [[7, 1], [7, 1]],
'f': [[8, 1]], 'F': [[2, 5], [8, 1]],
'h': [[9, 1]], 'H': [[2, 5], [9, 1]],
'c': [[10, 1]], 'C': [[2, 5], [10, 1]],
'p': [[11, 1]], 'P': [[2, 5], [11, 1]],
'x': [[12, 1]], 'X': [[2, 5], [12, 1]],
'\\': [[13, 1]], '|': [[2, 5], [13, 1]],
'\t': [[0, 2]],
'a': [[1, 2]], 'A': [[2, 5], [1, 2]],
'o': [[2, 2]], 'O': [[2, 5], [2, 2]],
'e': [[3, 2]], 'E': [[2, 5], [3, 2]],
'i': [[4, 2]], 'I': [[2, 5], [4, 2]],
'u': [[5, 2]], 'U': [[2, 5], [5, 2]],
'd': [[8, 2]], 'D': [[2, 5], [8, 2]],
'r': [[9, 2]], 'R': [[2, 5], [9, 2]],
't': [[10, 2]], 'T': [[2, 5], [10, 2]],
'n': [[11, 2]], 'N': [[2, 5], [11, 2]],
's': [[12, 2]], 'S': [[2, 5], [12, 2]],
'=': [[13, 2]], '+': [[2, 5], [13, 2]],
'z': [[1, 3]], 'Z': [[2, 5], [1, 3]],
'q': [[2, 3]], 'Q': [[2, 5], [2, 3]],
'\'': [[3, 3]], '"': [[2, 5], [3, 3]],
',': [[4, 3]], '<': [[2, 5], [4, 3]],
'.': [[5, 3]], '>': [[2, 5], [5, 3]],
'b': [[8, 3]], 'B': [[2, 5], [8, 3]],
'k': [[9, 3]], 'K': [[2, 5], [9, 3]],
'v': [[10, 3]], 'V': [[2, 5], [10, 3]],
'j': [[11, 3]], 'J': [[2, 5], [11, 3]],
'/': [[12, 3]], '?': [[2, 5], [12, 3]],
':': [[4, 4]], ';': [[4, 4], [4, 4]],
'-': [[9, 4]], '_': [[2, 5], [9, 4]],
' ': [[10, 5]],
'\n': [[11, 5]],
## Layered things
# Hungarian
'á': [[9, 5], [1, 2]], 'Á': [[2, 5], [9, 5], [1, 2]],
'ó': [[9, 5], [2, 2]], 'Ó': [[2, 5], [9, 5], [2, 2]],
'ő': [[9, 5], [2, 1]], 'Ő': [[2, 5], [9, 5], [2, 1]],
'ö': [[9, 5], [2, 3]], 'Ö': [[2, 5], [9, 5], [2, 3]],
'é': [[9, 5], [3, 2]], 'É': [[2, 5], [9, 5], [3, 2]],
'ú': [[9, 5], [4, 2]], 'Ú': [[2, 5], [9, 5], [4, 2]],
'ű': [[9, 5], [4, 1]], 'Ű': [[2, 5], [9, 5], [4, 1]],
'ü': [[9, 5], [4, 3]], 'Ü': [[2, 5], [9, 5], [4, 3]],
'í': [[9, 5], [5, 2]], 'Í': [[2, 5], [9, 5], [5, 2]],
}
def lookup_char(layer, ch):
if ch in charmap:
return charmap[ch]
return None
def process_char(layer, ch, out=sys.stdout):
keys = lookup_char(layer, ch)
if not keys:
print ("Unknown char: %s" % ch, file=sys.stderr)
else:
for (c, r) in keys:
print ("KL: col=%d, row=%d, pressed=1, layer=%s" % (r, c, layer), file=out)
print ("KL: col=%d, row=%d, pressed=0, layer=%s" % (r, c, layer), file=out)
def process_file(fn, layer, out=sys.stdout):
with open(fn, "r") as f:
ch = f.read(1)
while ch:
process_char(layer, ch, out)
ch = f.read(1)
if sys.argv[1] == '-':
out='/dev/stdin'
else:
out=sys.argv[1]
if len(sys.argv) >= 2:
layer = 'ADORE'
else:
layer = sys.argv[2]
process_file(out, layer = layer)

View File

@ -7,6 +7,8 @@
#define SYMB 1 // symbols #define SYMB 1 // symbols
#define MDIA 2 // media keys #define MDIA 2 // media keys
#define EPRM M(1) // Macro 1: Reset EEPROM
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Keymap 0: Basic layer /* Keymap 0: Basic layer
* *
@ -62,7 +64,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
* | | % | ^ | [ | ] | ~ | | | | & | 1 | 2 | 3 | \ | | * | | % | ^ | [ | ] | ~ | | | | & | 1 | 2 | 3 | \ | |
* `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
* | | | | | | | | . | 0 | = | | * | EPRM | | | | | | | . | 0 | = | |
* `----------------------------------' `----------------------------------' * `----------------------------------' `----------------------------------'
* ,-------------. ,-------------. * ,-------------. ,-------------.
* | | | | | | * | | | | | |
@ -79,7 +81,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_TRNS,KC_EXLM,KC_AT, KC_LCBR,KC_RCBR,KC_PIPE,KC_TRNS, KC_TRNS,KC_EXLM,KC_AT, KC_LCBR,KC_RCBR,KC_PIPE,KC_TRNS,
KC_TRNS,KC_HASH,KC_DLR, KC_LPRN,KC_RPRN,KC_GRV, KC_TRNS,KC_HASH,KC_DLR, KC_LPRN,KC_RPRN,KC_GRV,
KC_TRNS,KC_PERC,KC_CIRC,KC_LBRC,KC_RBRC,KC_TILD,KC_TRNS, KC_TRNS,KC_PERC,KC_CIRC,KC_LBRC,KC_RBRC,KC_TILD,KC_TRNS,
KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, EPRM,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,
KC_TRNS,KC_TRNS, KC_TRNS,KC_TRNS,
KC_TRNS, KC_TRNS,
KC_TRNS,KC_TRNS,KC_TRNS, KC_TRNS,KC_TRNS,KC_TRNS,
@ -149,6 +151,11 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
SEND_STRING (QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION); SEND_STRING (QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION);
} }
break; break;
case 1:
if (record->event.pressed) { // For resetting EEPROM
eeconfig_init();
}
break;
} }
return MACRO_NONE; return MACRO_NONE;
}; };
@ -158,6 +165,7 @@ void matrix_init_user(void) {
}; };
// 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) {

View File

@ -2,6 +2,8 @@
## Changelog ## Changelog
* Sep 22, 2016:
* Created a new key in layer 1 (bottom-corner key) that resets the EEPROM.
* Feb 2, 2016 (V1.1): * Feb 2, 2016 (V1.1):
* Made the right-hand quote key double as Cmd/Win on hold. So you get ' when you tap it, " when you tap it with Shift, and Cmd or Win when you hold it. You can then use it as a modifier, or just press and hold it for a moment (and then let go) to send a single Cmd or Win keystroke (handy for opening the Start menu on Windows). * Made the right-hand quote key double as Cmd/Win on hold. So you get ' when you tap it, " when you tap it with Shift, and Cmd or Win when you hold it. You can then use it as a modifier, or just press and hold it for a moment (and then let go) to send a single Cmd or Win keystroke (handy for opening the Start menu on Windows).

View File

@ -62,7 +62,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
//#define MATRIX_HAS_GHOST //#define MATRIX_HAS_GHOST
/* number of backlight levels */ /* number of backlight levels */
#define BACKLIGHT_LEVELS 3 #define BACKLIGHT_LEVELS 5
/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ /* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
#define LOCKING_SUPPORT_ENABLE #define LOCKING_SUPPORT_ENABLE

View File

@ -41,6 +41,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// #define USE_I2C // #define USE_I2C
// Use serial if not using I2C
#ifndef USE_I2C
# define USE_SERIAL
#endif
// #define EE_HANDS // #define EE_HANDS
#define I2C_MASTER_LEFT #define I2C_MASTER_LEFT
@ -94,4 +99,4 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
//#define NO_ACTION_MACRO //#define NO_ACTION_MACRO
//#define NO_ACTION_FUNCTION //#define NO_ACTION_FUNCTION
#endif #endif

View File

@ -6,6 +6,8 @@
#include <stdbool.h> #include <stdbool.h>
#include "i2c.h" #include "i2c.h"
#ifdef USE_I2C
// Limits the amount of we wait for any one i2c transaction. // Limits the amount of we wait for any one i2c transaction.
// Since were running SCL line 100kHz (=> 10μs/bit), and each transactions is // Since were running SCL line 100kHz (=> 10μs/bit), and each transactions is
// 9 bits, a single transaction will take around 90μs to complete. // 9 bits, a single transaction will take around 90μs to complete.
@ -157,3 +159,4 @@ ISR(TWI_vect) {
// Reset everything, so we are ready for the next TWI interrupt // Reset everything, so we are ready for the next TWI interrupt
TWCR |= (1<<TWIE) | (1<<TWINT) | (ack<<TWEA) | (1<<TWEN); TWCR |= (1<<TWIE) | (1<<TWINT) | (ack<<TWEA) | (1<<TWEN);
} }
#endif

View File

@ -0,0 +1,102 @@
/*
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 0x3060
#define DEVICE_VER 0x0001
#define MANUFACTURER Wootpatoot
#define PRODUCT Lets Split
#define DESCRIPTION A split keyboard for the cheap makers
/* key matrix size */
// Rows are doubled-up
#define MATRIX_ROWS 8
#define MATRIX_COLS 6
// wiring of each half
#define MATRIX_ROW_PINS { B5, B4, E6, D7 }
#define MATRIX_COL_PINS { F4, F5, F6, F7, B1, B3 }
#define CATERINA_BOOTLOADER
#define USE_I2C
// Use serial if not using I2C
#ifndef USE_I2C
# define USE_SERIAL
#endif
// #define EE_HANDS
#define I2C_MASTER_LEFT
// #define I2C_MASTER_RIGHT
/* COL2ROW or ROW2COL */
#define DIODE_DIRECTION COL2ROW
/* define if matrix has ghost */
//#define MATRIX_HAS_GHOST
/* number of backlight levels */
// #define BACKLIGHT_LEVELS 3
/* Set 0 if debouncing isn't needed */
#define DEBOUNCING_DELAY 5
/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
#define LOCKING_SUPPORT_ENABLE
/* Locking resynchronize hack */
#define LOCKING_RESYNC_ENABLE
/* key combination for command */
#define IS_COMMAND() ( \
keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \
)
/* ws2812 RGB LED */
#define RGB_DI_PIN D4
#define RGBLIGHT_TIMER
#define RGBLED_NUM 8 // Number of LEDs
#define RGBLIGHT_HUE_STEP 10
#define RGBLIGHT_SAT_STEP 17
#define RGBLIGHT_VAL_STEP 17
/*
* Feature disable options
* These options are also useful to firmware size reduction.
*/
/* disable debug print */
// #define NO_DEBUG
/* disable print */
// #define NO_PRINT
/* disable action features */
//#define NO_ACTION_LAYER
//#define NO_ACTION_TAPPING
//#define NO_ACTION_ONESHOT
//#define NO_ACTION_MACRO
//#define NO_ACTION_FUNCTION
#endif

View File

@ -0,0 +1,214 @@
#include "lets_split.h"
#include "action_layer.h"
#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 0
#define _COLEMAK 1
#define _DVORAK 2
#define _LOWER 3
#define _RAISE 4
#define _ADJUST 16
enum custom_keycodes {
QWERTY = SAFE_RANGE,
COLEMAK,
DVORAK,
LOWER,
RAISE,
ADJUST,
};
// Fillers to make layering more clear
#define _______ KC_TRNS
#define XXXXXXX KC_NO
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* 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 |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* |Adjust| Ctrl | Alt | GUI |Lower |Space |Space |Raise | Left | Down | Up |Right |
* `-----------------------------------------------------------------------------------'
*/
[_QWERTY] = KEYMAP( \
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 , \
ADJUST, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \
),
/* 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 | , | . | / |Enter |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* |Adjust| Ctrl | Alt | GUI |Lower |Space |Space |Raise | Left | Down | Up |Right |
* `-----------------------------------------------------------------------------------'
*/
[_COLEMAK] = KEYMAP( \
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, KC_ENT , \
ADJUST, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \
),
/* Dvorak
* ,-----------------------------------------------------------------------------------.
* | Tab | " | , | . | P | Y | F | G | C | R | L | Bksp |
* |------+------+------+------+------+-------------+------+------+------+------+------|
* | Esc | A | O | E | U | I | D | H | T | N | S | / |
* |------+------+------+------+------+------|------+------+------+------+------+------|
* | Shift| ; | Q | J | K | X | B | M | W | V | Z |Enter |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* |Adjust| Ctrl | Alt | GUI |Lower |Space |Space |Raise | Left | Down | Up |Right |
* `-----------------------------------------------------------------------------------'
*/
[_DVORAK] = KEYMAP( \
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_ESC, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_SLSH, \
KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_ENT , \
ADJUST, 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] = KEYMAP( \
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_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] = KEYMAP( \
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, _______, _______, _______, \
_______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY \
),
/* Adjust (Lower + Raise)
* ,-----------------------------------------------------------------------------------.
* | | Reset| | | | | | | | | | Del |
* |------+------+------+------+------+-------------+------+------+------+------+------|
* | | | |Aud on|Audoff|AGnorm|AGswap|Qwerty|Colemk|Dvorak| | |
* |------+------+------+------+------+------|------+------+------+------+------+------|
* | | | | | | | | | | | | |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | | | | | | | | | | | |
* `-----------------------------------------------------------------------------------'
*/
[_ADJUST] = KEYMAP( \
_______, RESET, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_DEL, \
_______, _______, _______, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, _______, _______, \
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ \
)
};
#ifdef AUDIO_ENABLE
float tone_qwerty[][2] = SONG(QWERTY_SOUND);
float tone_dvorak[][2] = SONG(DVORAK_SOUND);
float tone_colemak[][2] = SONG(COLEMAK_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 DVORAK:
if (record->event.pressed) {
#ifdef AUDIO_ENABLE
PLAY_NOTE_ARRAY(tone_dvorak, false, 0);
#endif
persistant_default_layer_set(1UL<<_DVORAK);
}
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 ADJUST:
if (record->event.pressed) {
layer_on(_ADJUST);
} else {
layer_off(_ADJUST);
}
return false;
break;
}
return true;
}

View File

@ -0,0 +1,102 @@
/*
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 0x3060
#define DEVICE_VER 0x0001
#define MANUFACTURER Wootpatoot
#define PRODUCT Lets Split
#define DESCRIPTION A split keyboard for the cheap makers
/* key matrix size */
// Rows are doubled-up
#define MATRIX_ROWS 8
#define MATRIX_COLS 6
// wiring of each half
#define MATRIX_ROW_PINS { B5, B4, E6, D7 }
#define MATRIX_COL_PINS { F4, F5, F6, F7, B1, B3 }
#define CATERINA_BOOTLOADER
// #define USE_I2C
// Use serial if not using I2C
#ifndef USE_I2C
# define USE_SERIAL
#endif
// #define EE_HANDS
#define I2C_MASTER_LEFT
// #define I2C_MASTER_RIGHT
/* COL2ROW or ROW2COL */
#define DIODE_DIRECTION COL2ROW
/* define if matrix has ghost */
//#define MATRIX_HAS_GHOST
/* number of backlight levels */
// #define BACKLIGHT_LEVELS 3
/* Set 0 if debouncing isn't needed */
#define DEBOUNCING_DELAY 5
/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
#define LOCKING_SUPPORT_ENABLE
/* Locking resynchronize hack */
#define LOCKING_RESYNC_ENABLE
/* key combination for command */
#define IS_COMMAND() ( \
keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \
)
/* ws2812 RGB LED */
#define RGB_DI_PIN D4
#define RGBLIGHT_TIMER
#define RGBLED_NUM 8 // Number of LEDs
#define RGBLIGHT_HUE_STEP 10
#define RGBLIGHT_SAT_STEP 17
#define RGBLIGHT_VAL_STEP 17
/*
* Feature disable options
* These options are also useful to firmware size reduction.
*/
/* disable debug print */
// #define NO_DEBUG
/* disable print */
// #define NO_PRINT
/* disable action features */
//#define NO_ACTION_LAYER
//#define NO_ACTION_TAPPING
//#define NO_ACTION_ONESHOT
//#define NO_ACTION_MACRO
//#define NO_ACTION_FUNCTION
#endif

View File

@ -0,0 +1,214 @@
#include "lets_split.h"
#include "action_layer.h"
#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 0
#define _COLEMAK 1
#define _DVORAK 2
#define _LOWER 3
#define _RAISE 4
#define _ADJUST 16
enum custom_keycodes {
QWERTY = SAFE_RANGE,
COLEMAK,
DVORAK,
LOWER,
RAISE,
ADJUST,
};
// Fillers to make layering more clear
#define _______ KC_TRNS
#define XXXXXXX KC_NO
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* 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 |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* |Adjust| Ctrl | Alt | GUI |Lower |Space |Space |Raise | Left | Down | Up |Right |
* `-----------------------------------------------------------------------------------'
*/
[_QWERTY] = KEYMAP( \
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 , \
ADJUST, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \
),
/* 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 | , | . | / |Enter |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* |Adjust| Ctrl | Alt | GUI |Lower |Space |Space |Raise | Left | Down | Up |Right |
* `-----------------------------------------------------------------------------------'
*/
[_COLEMAK] = KEYMAP( \
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, KC_ENT , \
ADJUST, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \
),
/* Dvorak
* ,-----------------------------------------------------------------------------------.
* | Tab | " | , | . | P | Y | F | G | C | R | L | Bksp |
* |------+------+------+------+------+-------------+------+------+------+------+------|
* | Esc | A | O | E | U | I | D | H | T | N | S | / |
* |------+------+------+------+------+------|------+------+------+------+------+------|
* | Shift| ; | Q | J | K | X | B | M | W | V | Z |Enter |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* |Adjust| Ctrl | Alt | GUI |Lower |Space |Space |Raise | Left | Down | Up |Right |
* `-----------------------------------------------------------------------------------'
*/
[_DVORAK] = KEYMAP( \
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_ESC, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_SLSH, \
KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_ENT , \
ADJUST, 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] = KEYMAP( \
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_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] = KEYMAP( \
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, _______, _______, _______, \
_______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY \
),
/* Adjust (Lower + Raise)
* ,-----------------------------------------------------------------------------------.
* | | Reset| | | | | | | | | | Del |
* |------+------+------+------+------+-------------+------+------+------+------+------|
* | | | |Aud on|Audoff|AGnorm|AGswap|Qwerty|Colemk|Dvorak| | |
* |------+------+------+------+------+------|------+------+------+------+------+------|
* | | | | | | | | | | | | |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | | | | | | | | | | | |
* `-----------------------------------------------------------------------------------'
*/
[_ADJUST] = KEYMAP( \
_______, RESET, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_DEL, \
_______, _______, _______, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, _______, _______, \
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ \
)
};
#ifdef AUDIO_ENABLE
float tone_qwerty[][2] = SONG(QWERTY_SOUND);
float tone_dvorak[][2] = SONG(DVORAK_SOUND);
float tone_colemak[][2] = SONG(COLEMAK_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 DVORAK:
if (record->event.pressed) {
#ifdef AUDIO_ENABLE
PLAY_NOTE_ARRAY(tone_dvorak, false, 0);
#endif
persistant_default_layer_set(1UL<<_DVORAK);
}
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 ADJUST:
if (record->event.pressed) {
layer_on(_ADJUST);
} else {
layer_off(_ADJUST);
}
return false;
break;
}
return true;
}

View File

@ -28,14 +28,18 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "debug.h" #include "debug.h"
#include "util.h" #include "util.h"
#include "matrix.h" #include "matrix.h"
#include "i2c.h"
#include "serial.h"
#include "split_util.h" #include "split_util.h"
#include "pro_micro.h" #include "pro_micro.h"
#include "config.h" #include "config.h"
#ifdef USE_I2C
# include "i2c.h"
#else // USE_SERIAL
# include "serial.h"
#endif
#ifndef DEBOUNCE #ifndef DEBOUNCE
# define DEBOUNCE 5 # define DEBOUNCE 5
#endif #endif
#define ERROR_DISCONNECT_COUNT 5 #define ERROR_DISCONNECT_COUNT 5
@ -145,6 +149,8 @@ uint8_t _matrix_scan(void)
return 1; return 1;
} }
#ifdef USE_I2C
// Get rows from other half over i2c // Get rows from other half over i2c
int i2c_transaction(void) { int i2c_transaction(void) {
int slaveOffset = (isLeftHand) ? (ROWS_PER_HAND) : 0; int slaveOffset = (isLeftHand) ? (ROWS_PER_HAND) : 0;
@ -176,7 +182,8 @@ i2c_error: // the cable is disconnceted, or something else went wrong
return 0; return 0;
} }
#ifndef USE_I2C #else // USE_SERIAL
int serial_transaction(void) { int serial_transaction(void) {
int slaveOffset = (isLeftHand) ? (ROWS_PER_HAND) : 0; int slaveOffset = (isLeftHand) ? (ROWS_PER_HAND) : 0;
@ -199,7 +206,7 @@ uint8_t matrix_scan(void)
#ifdef USE_I2C #ifdef USE_I2C
if( i2c_transaction() ) { if( i2c_transaction() ) {
#else #else // USE_SERIAL
if( serial_transaction() ) { if( serial_transaction() ) {
#endif #endif
// turn on the indicator led when halves are disconnected // turn on the indicator led when halves are disconnected
@ -235,7 +242,7 @@ void matrix_slave_scan(void) {
/* i2c_slave_buffer[i] = matrix[offset+i]; */ /* i2c_slave_buffer[i] = matrix[offset+i]; */
i2c_slave_buffer[i] = matrix[offset+i]; i2c_slave_buffer[i] = matrix[offset+i];
} }
#else #else // USE_SERIAL
for (int i = 0; i < ROWS_PER_HAND; ++i) { for (int i = 0; i < ROWS_PER_HAND; ++i) {
serial_slave_buffer[i] = matrix[offset+i]; serial_slave_buffer[i] = matrix[offset+i];
} }
@ -290,7 +297,7 @@ static void init_cols(void)
static matrix_row_t read_cols(void) static matrix_row_t read_cols(void)
{ {
matrix_row_t result = 0; matrix_row_t result = 0;
for(int x = 0; x < MATRIX_COLS; x++) { for(int x = 0; x < MATRIX_COLS; x++) {
result |= (_SFR_IO8(col_pins[x] >> 4) & _BV(col_pins[x] & 0xF)) ? 0 : (1 << x); result |= (_SFR_IO8(col_pins[x] >> 4) & _BV(col_pins[x] & 0xF)) ? 0 : (1 << x);
} }
return result; return result;
@ -298,7 +305,7 @@ static matrix_row_t read_cols(void)
static void unselect_rows(void) static void unselect_rows(void)
{ {
for(int x = 0; x < ROWS_PER_HAND; x++) { for(int x = 0; x < ROWS_PER_HAND; x++) {
_SFR_IO8((row_pins[x] >> 4) + 1) &= ~_BV(row_pins[x] & 0xF); _SFR_IO8((row_pins[x] >> 4) + 1) &= ~_BV(row_pins[x] & 0xF);
_SFR_IO8((row_pins[x] >> 4) + 2) |= _BV(row_pins[x] & 0xF); _SFR_IO8((row_pins[x] >> 4) + 2) |= _BV(row_pins[x] & 0xF);
} }

View File

@ -52,7 +52,7 @@ OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
OPT_DEFS += -DBOOTLOADER_SIZE=4096 OPT_DEFS += -DBOOTLOADER_SIZE=4096
# Build Options # Build Options
# change to "no" to disable the options, or define them in the Makefile in # change to "no" to disable the options, or define them in the Makefile in
# the appropriate keymap folder that will get included automatically # the appropriate keymap folder that will get included automatically
# #
BOOTMAGIC_ENABLE ?= no # Virtual DIP switch configuration(+1000) BOOTMAGIC_ENABLE ?= no # Virtual DIP switch configuration(+1000)
@ -71,4 +71,4 @@ RGBLIGHT_ENABLE ?= no # Enable WS2812 RGB underlight. Do not enable this
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE # Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
SLEEP_LED_ENABLE ?= no # Breathing sleep LED during USB suspend SLEEP_LED_ENABLE ?= no # Breathing sleep LED during USB suspend
CUSTOM_MATRIX = yes CUSTOM_MATRIX = yes

View File

@ -10,9 +10,10 @@
#include <avr/interrupt.h> #include <avr/interrupt.h>
#include <util/delay.h> #include <util/delay.h>
#include <stdbool.h> #include <stdbool.h>
#include "serial.h" #include "serial.h"
#ifdef USE_SERIAL
// Serial pulse period in microseconds. Its probably a bad idea to lower this // Serial pulse period in microseconds. Its probably a bad idea to lower this
// value. // value.
#define SERIAL_DELAY 24 #define SERIAL_DELAY 24
@ -223,3 +224,5 @@ int serial_update_buffers(void) {
sei(); sei();
return 0; return 0;
} }
#endif

View File

@ -6,11 +6,15 @@
#include <avr/eeprom.h> #include <avr/eeprom.h>
#include "split_util.h" #include "split_util.h"
#include "matrix.h" #include "matrix.h"
#include "i2c.h"
#include "serial.h"
#include "keyboard.h" #include "keyboard.h"
#include "config.h" #include "config.h"
#ifdef USE_I2C
# include "i2c.h"
#else
# include "serial.h"
#endif
volatile bool isLeftHand = true; volatile bool isLeftHand = true;
static void setup_handedness(void) { static void setup_handedness(void) {

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,242 @@
// 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 _FN 1
#define _QWERTY 2
#define _QW_FN 3
#define _PLOVER 4
#define _ADJ 5
enum planck_keycodes {
WORKMAN = SAFE_RANGE,
QWERTY,
PLOVER
};
// Fillers to make layering more clear
#define _______ KC_TRNS
#define XXXXXXX KC_NO
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Workman Alpha-numeric
* ,-----------------------------------------------------------------------------------------------.
* | Q | D | R | W | B | F | U | P | J | 7 | 8 | 9 |
* |-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------|
* | A | S | H | T | G | N | E | O | I | 4 | 5 | 6 |
* |-------+-------+-------+-------+-------+-------|-------+-------+-------+-------+-------+-------|
* | Z | X | M | C | V | L | Y | K | Up | 1 | 2 | 3 |
* |-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------|
* |Alt/Tab|Gui/Esc| , |CTL/Bsp| Fn/Ent|SFT/SPC| . | Left | Down | Right | 0 |Adj/Ent|
* `-----------------------------------------------------------------------------------------------'
*/
[_WORKMAN] = {
{KC_Q, KC_D, KC_R, KC_W, KC_B, KC_F, KC_U, KC_P, KC_J, KC_KP_7, KC_KP_8, KC_KP_9},
{KC_A, KC_S, KC_H, KC_T, KC_G, KC_N, KC_E, KC_O, KC_I, KC_KP_4, KC_KP_5, KC_KP_6},
{KC_Z, KC_X, KC_M, KC_C, KC_V, KC_L, KC_Y, KC_K, KC_UP, KC_KP_1, KC_KP_2, KC_KP_3},
{ALT_T(KC_TAB), GUI_T(KC_ESC), KC_COMM, CTL_T(KC_BSPC), LT(_FN, KC_ENT), SFT_T(KC_SPC), KC_DOT, KC_LEFT, KC_DOWN, KC_RGHT, KC_KP_0, LT(_ADJ, KC_ENT)}
},
/* FN-key held (Workman)
* ,-----------------------------------------------------------------------------------------------.
* | ! | @ | # | $ | % | ^ | & | * | F12 | F7 | F8 | F9 |
* |-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------|
* | Tab | [ | ] | - | Del | ' | ( | ) | F11 | F4 | F5 | F6 |
* |-------+-------+-------+-------+-------+-------|-------+-------+-------+-------+-------+-------|
* | Menu | | | = | \ | / | | | PgUp | F1 | F2 | F3 |
* |-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------|
* |Alt/Tab| Gui | ~ |CTL/Bsp| Fn/Ent|SFT/Spc| ; | Home | PgDn | End | F10 |Adj/Ent|
* `-----------------------------------------------------------------------------------------------'
*/
[_FN] = {
{KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_F12, KC_F7, KC_F8, KC_F9},
{KC_TAB, KC_LBRACKET, KC_RBRACKET, KC_MINUS, KC_DELETE, KC_QUOT, KC_LPRN, KC_RPRN, KC_F11, KC_F4, KC_F5, KC_F6},
{KC_MENU, _______, _______, KC_EQUAL, KC_BSLS, KC_SLSH, XXXXXXX, XXXXXXX, KC_PGUP, KC_F1, KC_F2, KC_F3},
{_______, KC_LGUI, KC_GRAVE, _______, _______, _______, KC_SCOLON, KC_HOME, KC_PGDN, KC_END, KC_F10, _______}
},
/* Qwerty
* ,-----------------------------------------------------------------------------------------------.
* |Gui/Esc| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp |
* |-------+-------+-------+-------+-------+---------------+-------+-------+-------+-------+-------|
* | Ctrl | Q | W | E | R | T | Y | U | I | O | P | / |
* |-------+-------+-------+-------+-------+---------------+-------+-------+-------+-------+-------|
* | Shift | A | S | D | F | G | H | J | K | L | ; | " |
* |-------+-------+-------+-------+-------+-------|-------+-------+-------+-------+-------+-------|
* |Alt/Tab| Z | X | C | V | Fn/SPC| B | N | M | , | . |Adj/Ent|
* `-----------------------------------------------------------------------------------------------'
*/
[_QWERTY] = {
{GUI_T(KC_ESC), KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC},
{KC_LCTL, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_ENT},
{KC_LSFT, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT},
{ALT_T(KC_TAB), KC_Z, KC_X, KC_C, KC_V, LT(_QW_FN, KC_SPC), KC_B, KC_N, KC_M, KC_COMM, KC_DOT, LT(_ADJ, KC_ENT)},
},
/* FN-key held (Qwerty)
* ,-----------------------------------------------------------------------------------------------.
* | Gui | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 |
* |-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------|
* | Ctrl | ~ | [ | PgUp | ] | | | - | Up | = | | F12 |
* |-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------|
* | Shift | Tab | Home | PgDn | End | Del | | Left | Down | Right | | |
* |-------+-------+-------+-------+-------+-------|-------+-------+-------+-------+-------+-------|
* |Alt/Tab| | | | | Fn/Spc| | | | | Menu |Adj/Ent|
* `-----------------------------------------------------------------------------------------------'
*/
[_QW_FN] = {
{KC_LGUI, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11},
{_______, KC_GRAVE, KC_LBRC, KC_PGUP, KC_RBRC, XXXXXXX, XXXXXXX, KC_MINS, KC_UP, KC_EQUAL, XXXXXXX, KC_F12},
{_______, KC_TAB, KC_HOME, KC_PGDN, KC_END, KC_DELETE, XXXXXXX, KC_LEFT, KC_DOWN, KC_RIGHT, XXXXXXX, XXXXXXX},
{_______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, XXXXXXX, _______, _______, _______, KC_MENU, _______}
},
/* Plover layer (http://opensteno.org)
* ,-----------------------------------------------------------------------------------------------.
* | S | T | P | H | * | F | P | L | T | D | | |
* |-------+-------+-------+-------+-------+-------|-------+-------+-------+-------+-------+-------|
* | S | K | W | R | * | R | B | G | S | Z | | |
* |-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------|
* | # | # | # | # | | # | # | # | # | # | | |
* |-------+-------+-------+-------+-------+---------------+-------+-------+-------+-------+-------|
* | | | A | O | | E | U | | | | |Adj/Ent|
* `-----------------------------------------------------------------------------------------------'
*/
[_PLOVER] = {
{KC_Q, KC_W, KC_E, KC_R, KC_T, KC_U, KC_I, KC_O, KC_P, KC_LBRC, XXXXXXX, XXXXXXX},
{KC_A, KC_S, KC_D, KC_F, KC_G, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, XXXXXXX, XXXXXXX},
{KC_1, KC_1, KC_1, KC_1, XXXXXXX, KC_1, KC_1, KC_1, KC_1, KC_1, XXXXXXX, XXXXXXX},
{XXXXXXX, XXXXXXX, KC_C, KC_V, XXXXXXX, KC_N, KC_M, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, LT(_ADJ, KC_ENT)}
},
/* Adjust
* ,-----------------------------------------------------------------------------------------------.
* | | | | | | | | | Insert| PrtSc | Pause | RESET |
* |-------+-------+-------+-------+-------+---------------+-------+-------+-------+-------+-------|
* | | | | | | | | CapLk |Voice +| Audio |MIDIoff| |
* |-------+-------+-------+-------+-------+-------|-------+-------+-------+-------+-------+-------|
* | | | | | | | | ScrLk |Voice -| Music |MIDI on| |
* |-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------|
* | | | | | | | | Numlk |Workman| Qwerty| Plover|Adj/Ent|
* `-----------------------------------------------------------------------------------------------'
*/
[_ADJ] = {
{_______, _______, _______, _______, _______, _______, _______, _______, KC_INS, KC_PSCR, KC_PAUSE, RESET},
{_______, _______, _______, _______, _______, _______, _______, KC_CLCK, MUV_IN, AU_TOG, MI_OFF, _______},
{_______, _______, _______, _______, _______, _______, _______, KC_SLCK, MUV_DE, MU_TOG, MI_ON, _______},
{_______, _______, _______, _______, _______, _______, _______, KC_NLCK, WORKMAN, QWERTY, PLOVER, _______}
}
};
#ifdef AUDIO_ENABLE
float tone_startup[][2] = SONG(STARTUP_SOUND);
float tone_goodbye[][2] = SONG(GOODBYE_SOUND);
float tone_workman[][2] = SONG(QWERTY_SOUND);
float tone_qwerty[][2] = SONG(COLEMAK_SOUND);
float tone_plover[][2] = SONG(PLOVER_SOUND);
float music_scale[][2] = SONG(MUSIC_SCALE_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 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 PLOVER:
if (record->event.pressed) {
#ifdef AUDIO_ENABLE
PLAY_NOTE_ARRAY(tone_plover, false, 0);
#endif
if (!eeconfig_is_enabled()) {
eeconfig_init();
}
keymap_config.raw = eeconfig_read_keymap();
keymap_config.nkro = 1;
eeconfig_update_keymap(keymap_config.raw);
persistant_default_layer_set(1UL<<_PLOVER);
}
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,73 @@
# The Impossible Layout
The Impossible Layout is named such because it manages to fit in both a numpad and an inverted-T arrow cluster into the same layer as the alpha keys.
## Main layout
The Impossible Layout places the middle column of the alphas onto where the punctuation keys were, moving he most used punctuation to be accessed by the thumbs. Because removing the middle columns fits with the Workman layout's philosopy, Workman is used as the basis for the layout. This means the layout should be very easy to learn for Workman users, and reasonable for Colemak users. Other space gains are made by combining keys that are only ever chorded with other non symbol keys (with function-layer alternatives where needed).
### Alpha-numeric layer
| | | | | | | | | | | | |
|:-----:|:-----:|:-----:|:-----:|:-----:|:-----:|:-----:|:-----:|:-----:|:-----:|:-----:|:-----:|
| Q | D | R | W | B | F | U | P | J | 7 | 8 | 9 |
| A | S | H | T | G | N | E | O | I | 4 | 5 | 6 |
| Z | X | M | C | V | L | Y | K | Up | 1 | 2 | 3 |
|Alt/Tab|Gui/Esc| , |CTL/Bsp| Fn/Ent|SFT/SPC| . | Left | Down | Right | 0 |Adj/Ent|
### Function layer
| | | | | | | | | | | | |
|:-----:|:-----:|:-----:|:-----:|:-----:|:-----:|:-----:|:-----:|:-----:|:-----:|:-----:|:-----:|
| ! | @ | # | $ | % | ^ | & | * | F12 | F7 | F8 | F9 |
| Tab | [ | ] | - | Del | ' | ( | ) | F11 | F4 | F5 | F6 |
| Menu | | | = | \ | / | | | PgUp | F1 | F2 | F3 |
|Alt/Tab| Gui | ~ |CTL/Bsp| Fn/Ent|SFT/Spc| ; | Home | PgDn | End | F10 |Adj/Ent|
## Qwerty
The Qwerty layer, mostly intended for gaming use, makes use of the doubled chorded/non-symbolic keys to obtain use of the entire alpha-numeric typing area.
### Qwerty layer
| | | | | | | | | | | | |
|:-----:|:-----:|:-----:|:-----:|:-----:|:-----:|:-----:|:-----:|:-----:|:-----:|:-----:|:-----:|
|Gui/Esc| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp |
| Ctrl | Q | W | E | R | T | Y | U | I | O | P | / |
| Shift | A | S | D | F | G | H | J | K | L | ; | " |
|Alt/Tab| Z | X | C | V | Fn/SPC| B | N | M | , | . |Adj/Ent|
### Qwerty Fn Layer
| | | | | | | | | | | | |
|:-----:|:-----:|:-----:|:-----:|:-----:|:-----:|:-----:|:-----:|:-----:|:-----:|:-----:|:-----:|
| Gui | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 |
| Ctrl | ~ | [ | PgUp | ] | | | - | Up | = | | F12 |
| Shift | Tab | Home | PgDn | End | Del | | Left | Down | Right | | |
|Alt/Tab| | | | | Fn/Spc| | | | | Menu |Adj/Ent|
## Stenography
The Steno/Plover layer moves the number row below the regular keys, providing a much more comfortable placement for the thumb keys. Using this layout will require a slightly different dictionary to account for different keys being adjacent to the number row.
### Steno Layer
| | | | | | | | | | | | |
|:-----:|:-----:|:-----:|:-----:|:-----:|:-----:|:-----:|:-----:|:-----:|:-----:|:-----:|:-----:|
| S | T | P | H | * | F | P | L | T | D | | |
| S | K | W | R | * | R | B | G | S | Z | | |
| # | # | # | # | | # | # | # | # | # | | |
| | | A | O | | E | U | | | | |Adj/Ent|
## Adjustments and Options
In order to switch between layouts and change other keyboard settings, an adjustment layer is accessible from the same position over any layout.
### Adjustment Layer
| | | | | | | | | | | | |
|:-----:|:-----:|:-----:|:-----:|:-----:|:-----:|:-----:|:-----:|:-----:|:-----:|:-----:|:-----:|
| | | | | | | | | Insert| PrtSc | Pause | RESET |
| | | | | | | | CapLk |Voice +| Audio |MIDIoff| |
| | | | | | | | ScrLk |Voice -| Music |MIDI on| |
| | | | | | | | Numlk |Workman| Qwerty| Plover|Adj/Ent|

View File

@ -0,0 +1,3 @@
ifndef MAKEFILE_INCLUDED
include ../../Makefile
endif

97
keyboards/tada68/config.h Normal file
View File

@ -0,0 +1,97 @@
/*
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 0x0003
#define MANUFACTURER TADA
#define PRODUCT TADA68
#define DESCRIPTION QMK keyboard firmware for TADA68 with WS2812 support
/* key matrix size */
#define MATRIX_ROWS 5
#define MATRIX_COLS 15
// ROWS: Top to bottom, COLS: Left to right
#define MATRIX_ROW_PINS {D0,D1,F6,F7,D5}
#define MATRIX_COL_PINS {F0,F1,E6,C7,C6,B7,D4,B1,B0,B5,B4,D7,D6,B3,F4}
#define UNUSED_PINS
#define BACKLIGHT_PIN B6
/* COL2ROW or ROW2COL */
#define DIODE_DIRECTION COL2ROW
/* define if matrix has ghost */
//#define MATRIX_HAS_GHOST
/* Set 0 if debouncing isn't needed */
#define DEBOUNCING_DELAY 5
/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
#define LOCKING_SUPPORT_ENABLE
/* Locking resynchronize hack */
#define LOCKING_RESYNC_ENABLE
/* key combination for command */
#define IS_COMMAND() ( \
keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \
)
/* Backlight configuration
*/
#define BACKLIGHT_LEVELS 4
/* Underlight configuration
*/
/*#define RGB_DI_PIN E2
#define RGBLIGHT_TIMER
#define RGBLED_NUM 2 // Number of LEDs
#define RGBLIGHT_HUE_STEP 10
#define RGBLIGHT_SAT_STEP 17
#define RGBLIGHT_VAL_STEP 17*/
//Disabled while I figure out a suitable pin for RGB support.
//I've tried F5, D2, D3, and E2 but it's possible the end of my
//strand is bad. New LEDs on order.
/*
* Feature disable options
* These options are also useful to firmware size reduction.
*/
/* disable debug print */
//#define NO_DEBUG
/* disable print */
//#define NO_PRINT
/* disable action features */
//#define NO_ACTION_LAYER
//#define NO_ACTION_TAPPING
//#define NO_ACTION_ONESHOT
//#define NO_ACTION_MACRO
//#define NO_ACTION_FUNCTION
#endif

View File

@ -0,0 +1,21 @@
# 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 = no # 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.
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
ifndef QUANTUM_DIR
include ../../../../Makefile
endif

View File

@ -0,0 +1,98 @@
#include "tada68.h"
// Used for SHIFT_ESC
#define MODS_CTRL_MASK (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT))
// 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 _BL 0
#define _FL 1
#define _______ KC_TRNS
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Keymap _BL: (Base Layer) Default Layer
* ,----------------------------------------------------------------.
* |Esc | 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backsp |~ ` |
* |----------------------------------------------------------------|
* |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \ |Del |
* |----------------------------------------------------------------|
* |CAPS | A| S| D| F| G| H| J| K| L| ;| '|Return |PgUp|
* |----------------------------------------------------------------|
* |Shift | Z| X| C| V| B| N| M| ,| .| /|Shift | Up|PgDn|
* |----------------------------------------------------------------|
* |Ctrl|Win |Alt | Space |Alt| FN|Ctrl|Lef|Dow|Rig |
* `----------------------------------------------------------------'
*/
[_BL] = KEYMAP_ANSI(
KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC,KC_GRV, \
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC,KC_BSLS,KC_DEL, \
KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN,KC_QUOT, KC_ENT,KC_PGUP, \
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM,KC_DOT, KC_SLSH, KC_RSFT,KC_UP,KC_PGDN, \
KC_LCTL, KC_LGUI,KC_LALT, KC_SPC, KC_RALT,MO(_FL),KC_RCTRL, KC_LEFT,KC_DOWN,KC_RGHT),
/* Keymap _FL: Function Layer
* ,----------------------------------------------------------------.
* | | | | | | | | | | | | | | RESET| |
* |----------------------------------------------------------------|
* | | | | | | | | | | | |BL-|BL+|BL | |
* |----------------------------------------------------------------|
* | | | | | | | | | | | | | |
* |----------------------------------------------------------------|
* | | F1|F2 | F3|F4 | F5| F6| F7| F8| | | | | |
* |----------------------------------------------------------------|
* | | | | | | | | | | |
* `----------------------------------------------------------------'
*/
[_FL] = KEYMAP_ANSI(
#ifdef RGBLIGHT_ENABLE
_______, _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,RESET,_______, \
_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, BL_DEC,BL_INC, BL_TOGG,_______, \
_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, _______,_______, \
_______,RGB_TOG,RGB_MOD,RGB_HUI,RGB_HUD,RGB_SAI,RGB_SAD,RGB_VAI,RGB_VAD,_______,_______,_______,_______,_______, \
_______,_______,_______, _______, _______,_______,_______,_______,_______, _______),
#else
_______, _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,RESET,_______, \
_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, BL_DEC,BL_INC, BL_TOGG,_______, \
_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, _______,_______, \
_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, \
_______,_______,_______, _______, _______,_______,_______,_______,_______, _______),
#endif
};
/*enum function_id {
//SHIFT_ESC,
};
const uint16_t PROGMEM fn_actions[] = {
//[0] = ACTION_FUNCTION(SHIFT_ESC),
};
void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) {
static uint8_t shift_esc_shift_mask;
switch (id) {
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;
}
}*/

View File

@ -0,0 +1 @@
# default TADA68 layout

View File

@ -0,0 +1,4 @@
TADA68 keyboard firmware
======================
TODO: to be updated.

66
keyboards/tada68/rules.mk Normal file
View File

@ -0,0 +1,66 @@
# 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 ?= no # Virtual DIP switch configuration(+1000)
MOUSEKEY_ENABLE ?= no # 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
NKRO_ENABLE ?= yes # USB Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
RGBLIGHT_ENABLE ?= no # Enable keyboard underlight functionality (+4870)
BACKLIGHT_ENABLE ?= yes # Enable keyboard backlight functionality (+1150)
MIDI_ENABLE ?= no # MIDI controls
AUDIO_ENABLE ?= no
UNICODE_ENABLE ?= no # Unicode
BLUETOOTH_ENABLE ?= no # Enable Bluetooth with the Adafruit EZ-Key HID

30
keyboards/tada68/tada68.c Normal file
View File

@ -0,0 +1,30 @@
#include "tada68.h"
#include "led.h"
void matrix_init_kb(void) {
// put your keyboard start-up code here
// runs once when the firmware starts up
matrix_init_user();
led_init_ports();
};
void matrix_scan_kb(void) {
// put your looping keyboard code here
// runs every cycle (a lot)
matrix_scan_user();
};
void led_init_ports(void) {
// * Set our LED pins as output
DDRB |= (1<<2);
}
void led_set_kb(uint8_t usb_led) {
if (usb_led & (1<<USB_LED_CAPS_LOCK)) {
// Turn capslock on
PORTB &= ~(1<<2);
} else {
// Turn capslock off
PORTB |= (1<<2);
}
}

43
keyboards/tada68/tada68.h Normal file
View File

@ -0,0 +1,43 @@
#ifndef TADA68_H
#define TADA68_H
#include "quantum.h"
// readability
#define XXX KC_NO
/* TADA68 ANSI layout
* ,----------------------------------------------------------------.
* | 00 |01| 02| 03| 04| 05| 06| 07| 08| 09| 0a| 0b| 0c| 0d | 0e |
* |----------------------------------------------------------------|
* | 10 | 11| 12| 13| 14| 15| 16| 17| 18| 19| 1a| 1b| 1c| 1d | 1e |
* |----------------------------------------------------------------|
* | 20 | 21| 22| 23| 24| 25| 26| 27| 28| 29| 2a| 2b| 2d | 2e |
* |----------------------------------------------------------------|
* | 30 | 32| 33| 34| 35| 36| 37| 38| 39| 3a| 3b| 3c| 3d| 3e |
* |----------------------------------------------------------------|
* | 40 | 41 | 42 | 45 | 49| 4a| 4b| 4c| 4d| 4e |
* `----------------------------------------------------------------'
*/
// The first section contains all of the arguments
// The second converts the arguments into a two-dimensional array
#define KEYMAP_ANSI( \
k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, k0c, k0d, k0e, \
k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, k1c, k1d, k1e, \
k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, k2d, k2e, \
k30, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b, k3c, k3d, k3e, \
k40, k41, k42, k45, k49, k4a, k4b, k4c, k4d, k4e \
) \
{ \
{k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, k0c, k0d, k0e}, \
{k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, k1c, k1d, k1e}, \
{k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, XXX, k2d, k2e}, \
{k30, XXX, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b, k3c, k3d, k3e}, \
{k40, k41, k42, XXX, XXX, k45, XXX, XXX, XXX, k49, k4a, k4b, k4c, k4d, k4e} \
}
void matrix_init_user(void);
void matrix_scan_user(void);
#endif

View File

@ -70,6 +70,7 @@ bool process_tap_dance(uint16_t keycode, keyrecord_t *record) {
action->state.keycode = keycode; action->state.keycode = keycode;
action->state.count++; action->state.count++;
action->state.timer = timer_read(); action->state.timer = timer_read();
process_tap_dance_action_on_each_tap (action);
if (last_td && last_td != keycode) { if (last_td && last_td != keycode) {
qk_tap_dance_action_t *paction = &tap_dance_actions[last_td - QK_TAP_DANCE]; qk_tap_dance_action_t *paction = &tap_dance_actions[last_td - QK_TAP_DANCE];

View File

@ -39,15 +39,17 @@ typedef struct
#define ACTION_TAP_DANCE_DOUBLE(kc1, kc2) { \ #define ACTION_TAP_DANCE_DOUBLE(kc1, kc2) { \
.fn = { NULL, qk_tap_dance_pair_finished, qk_tap_dance_pair_reset }, \ .fn = { NULL, qk_tap_dance_pair_finished, qk_tap_dance_pair_reset }, \
.user_data = (void *)&((qk_tap_dance_pair_t) { kc1, kc2 }) \ .user_data = (void *)&((qk_tap_dance_pair_t) { kc1, kc2 }), \
} }
#define ACTION_TAP_DANCE_FN(user_fn) { \ #define ACTION_TAP_DANCE_FN(user_fn) { \
.fn = { NULL, user_fn, NULL } \ .fn = { NULL, user_fn, NULL }, \
.user_data = NULL, \
} }
#define ACTION_TAP_DANCE_FN_ADVANCED(user_fn_on_each_tap, user_fn_on_dance_finished, user_fn_on_reset) { \ #define ACTION_TAP_DANCE_FN_ADVANCED(user_fn_on_each_tap, user_fn_on_dance_finished, user_fn_on_dance_reset) { \
.fn = { user_fn_on_each_tap, user_fn_on_dance_finished, user_fn_on_reset } \ .fn = { user_fn_on_each_tap, user_fn_on_dance_finished, user_fn_on_dance_reset }, \
.user_data = NULL, \
} }
extern qk_tap_dance_action_t tap_dance_actions[]; extern qk_tap_dance_action_t tap_dance_actions[];

View File

@ -526,7 +526,7 @@ This array specifies what actions shall be taken when a tap-dance key is in acti
* `ACTION_TAP_DANCE_DOUBLE(kc1, kc2)`: Sends the `kc1` keycode when tapped once, `kc2` otherwise. When the key is held, the appropriate keycode is registered: `kc1` when pressed and held, `kc2` when tapped once, then pressed and held. * `ACTION_TAP_DANCE_DOUBLE(kc1, kc2)`: Sends the `kc1` keycode when tapped once, `kc2` otherwise. When the key is held, the appropriate keycode is registered: `kc1` when pressed and held, `kc2` when tapped once, then pressed and held.
* `ACTION_TAP_DANCE_FN(fn)`: Calls the specified function - defined in the user keymap - with the final tap count of the tap dance action. * `ACTION_TAP_DANCE_FN(fn)`: Calls the specified function - defined in the user keymap - with the final tap count of the tap dance action.
* `ACTION_TAP_DANCE_FN_ADVANCED(on_each_tap_fn, on_dance_finished_fn, on_reset_fn)`: Calls the first specified function - defined in the user keymap - on every tap, the second function on when the dance action finishes (like the previous option), and the last function when the tap dance action resets. * `ACTION_TAP_DANCE_FN_ADVANCED(on_each_tap_fn, on_dance_finished_fn, on_dance_reset_fn)`: Calls the first specified function - defined in the user keymap - on every tap, the second function on when the dance action finishes (like the previous option), and the last function when the tap dance action resets.
The first option is enough for a lot of cases, that just want dual roles. For example, `ACTION_TAP_DANCE(KC_SPC, KC_ENT)` will result in `Space` being sent on single-tap, `Enter` otherwise. The first option is enough for a lot of cases, that just want dual roles. For example, `ACTION_TAP_DANCE(KC_SPC, KC_ENT)` will result in `Space` being sent on single-tap, `Enter` otherwise.

View File

@ -155,9 +155,10 @@ void process_action(keyrecord_t *record, action_t action)
action.key.mods<<4; action.key.mods<<4;
if (event.pressed) { if (event.pressed) {
if (mods) { if (mods) {
if (IS_MOD(action.key.code)) { if (IS_MOD(action.key.code) || action.key.code == KC_NO) {
// e.g. LSFT(KC_LGUI): we don't want the LSFT to be weak as it would make it useless. // e.g. LSFT(KC_LGUI): we don't want the LSFT to be weak as it would make it useless.
// this also makes LSFT(KC_LGUI) behave exactly the same as LGUI(KC_LSFT) // This also makes LSFT(KC_LGUI) behave exactly the same as LGUI(KC_LSFT).
// Same applies for some keys like KC_MEH which are declared as MEH(KC_NO).
add_mods(mods); add_mods(mods);
} else { } else {
add_weak_mods(mods); add_weak_mods(mods);
@ -168,7 +169,7 @@ void process_action(keyrecord_t *record, action_t action)
} else { } else {
unregister_code(action.key.code); unregister_code(action.key.code);
if (mods) { if (mods) {
if (IS_MOD(action.key.code)) { if (IS_MOD(action.key.code) || action.key.code == KC_NO) {
del_mods(mods); del_mods(mods);
} else { } else {
del_weak_mods(mods); del_weak_mods(mods);