1
0
Fork 0

[Keymap] Add narze userspace (#6652)

* Refactor & reimplement mod tap macros

* Reduce tapping term

* Update readme

* Add narze userspace

* Make use of narze userspace

* Extract Superduper mode

* Refactor Superduper mode

* (Ergodox Infinity) Prevent stuck modifiers

* Update ergodox_infinity/narze likewise

* Add warning for building Infinity with docker

* Fix include eeprom.h in superduper

* Try enabling superduper mode with combo for ergodox infinity

* Apply suggestions on #4546

* Convert to 4 spaces

* Map backlight step key

* Replace PLAY_NOTE_ARRAY

* Fix superduper toggle

* Re enable audio in planck rev4

* Use perform_space_cadet

* Remove superduper mod tap triggers

* Add readme for planck light firmware flashing command

* Remove unused layers

* Remove unused keycodes

* Add backlight toggle

* Remove unused songs & use DEFAULT_LAYER_SONGS

* Update readme

* Move includes to header file
This commit is contained in:
Manassarn Manoonchai 2019-09-07 22:06:30 +07:00 committed by Drashna Jaelre
parent 6ca29f2b9b
commit c21281c593
14 changed files with 523 additions and 775 deletions

View file

@ -1,14 +1,11 @@
#ifndef CONFIG_H_ #pragma once
#define CONFIG_H_
#include "../../config.h"
#undef TAPPING_TERM #undef TAPPING_TERM
#define TAPPING_TERM 150 #define TAPPING_TERM 150
// Combos not working yet // Combos not working yet
// #define COMBO_TERM 20 #define COMBO_TERM 20
// #define COMBO_COUNT 1 #define COMBO_COUNT 1
// #define COMBO_ALLOW_ACTION_KEYS // #define COMBO_ALLOW_ACTION_KEYS
#define IGNORE_MOD_TAP_INTERRUPT #define IGNORE_MOD_TAP_INTERRUPT
@ -16,5 +13,3 @@
#undef MOUSEKEY_DELAY #undef MOUSEKEY_DELAY
#define MOUSEKEY_DELAY 100 #define MOUSEKEY_DELAY 100
#endif

View file

@ -1,93 +1,55 @@
#include QMK_KEYBOARD_H #include QMK_KEYBOARD_H
// #include "debug.h" #include "narze.h"
#include "action_layer.h"
#include "version.h" #include "version.h"
#include "eeconfig.h"
#include "eeprom.h"
#include "keymap_colemak.h" #include "keymap_colemak.h"
extern keymap_config_t keymap_config; extern keymap_config_t keymap_config;
enum ergodox_layers { enum ergodox_layers {
_QWERTY, _QWERTY,
_COLEMAK, _COLEMAK,
_QWOC, _QWOC,
_LOWER, _LOWER,
_RAISE, _RAISE,
_PLOVER, _PLOVER,
// Intermediate layers for SuperDuper (Combo keys does not work on Infinity yet) // Intermediate layers for SuperDuper (Combo keys does not work on Infinity yet)
_SUPER, _SUPERDUPER,
_DUPER, _MOUSE,
_SUPERDUPER, _ADJUST,
_MOUSE, _MDIA,
_ADJUST, _SYMB,
_MDIA,
_SYMB,
}; };
enum ergodox_keycodes { enum ergodox_keycodes {
QWERTY = SAFE_RANGE, QWERTY = SAFE_RANGE,
COLEMAK, COLEMAK,
QWOC, QWOC,
PLOVER, LOWER,
SUPER, RAISE,
DUPER, PLOVER,
SUPERDUPER, SUPERDUPER,
MOUSE, MOUSE,
LOWER, BACKLIT,
RAISE, EXT_PLV,
BACKLIT, SDTOGG, // Toggle SuperDuper
EXT_PLV, EPRM,
SDTOGG, // Toggle SuperDuper VRSN,
EPRM, RGB_SLD,
VRSN, GUI_UNDS,
RGB_SLD LSFT_LPRN,
RSFT_RPRN,
}; };
enum functions {
M_GUI_UNDS, // Simulate GUI_T(KC_UNDS)
M_SFT_PO, // SFT_T(KC_LPRN)
M_SFT_PC, // SFT_T(KC_RPRN)
};
// Timer for custom mod tap
static uint16_t m_gui_unds_timer;
static uint16_t m_sft_po_timer;
static uint16_t m_sft_pc_timer;
// Narze : Custom Macros // Narze : Custom Macros
#define HPR_ESC ALL_T(KC_ESC) #define HPR_ESC ALL_T(KC_ESC)
#define SFT_ENT SFT_T(KC_ENT) #define SFT_ENT SFT_T(KC_ENT)
#define SFT_PO F(M_SFT_PO) #define SFT_PO LSFT_LPRN
#define SFT_PC F(M_SFT_PC) #define SFT_PC RSFT_RPRN
#define GUI_MINS GUI_T(KC_MINS) #define GUI_MINS GUI_T(KC_MINS)
#define GUI_UNDS F(M_GUI_UNDS)
// Combo : SuperDuper layer from S+D (R+S in Colemak) enum process_combo_event {
// #define COMBO_COUNT 1 CB_SUPERDUPER,
// #define SUPERDUPER_COMBO_COUNT 3 };
// #define EECONFIG_SUPERDUPER_INDEX (uint8_t *) 19
// enum process_combo_event {
// CB_SUPERDUPER,
// };
// const uint16_t PROGMEM superduper_combos[SUPERDUPER_COMBO_COUNT][3] = {
// [_QWERTY] = {KC_S, KC_D, COMBO_END},
// [_COLEMAK] = {KC_R, KC_S, COMBO_END},
// [_QWOC] = {CM_S, CM_D, COMBO_END},
// };
// combo_t PROGMEM key_combos[COMBO_COUNT] = {
// [CB_SUPERDUPER] = COMBO_ACTION(superduper_combos[_QWERTY]),
// };
// volatile bool superduper_enabled = true;
// const uint16_t empty_combo[] = {COMBO_END};
// void set_superduper_key_combos(void);
// void clear_superduper_key_combos(void);
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Qwerty /* Qwerty
@ -115,7 +77,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
// left hand // left hand
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, LT(_MDIA, KC_NO), KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, LT(_MDIA, KC_NO),
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, LT(_SYMB, KC_NO), KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, LT(_SYMB, KC_NO),
HPR_ESC, KC_A, LT(_SUPER, KC_S), LT(_DUPER, KC_D), KC_F, KC_G, HPR_ESC, KC_A, KC_S, KC_D, KC_F, KC_G,
SFT_PO, LT(_MOUSE, KC_Z), KC_X, KC_C, KC_V, KC_B, ALL_T(KC_NO), SFT_PO, LT(_MOUSE, KC_Z), KC_X, KC_C, KC_V, KC_B, ALL_T(KC_NO),
LT(_RAISE, KC_LBRC),KC_LCTL, KC_LALT, GUI_UNDS, LOWER, LT(_RAISE, KC_LBRC),KC_LCTL, KC_LALT, GUI_UNDS, LOWER,
KC_ENT, KC_LGUI, KC_ENT, KC_LGUI,
@ -156,7 +118,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
// left hand // left hand
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, LT(_MDIA, KC_NO), KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, LT(_MDIA, KC_NO),
KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, LT(_SYMB, KC_NO), KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, LT(_SYMB, KC_NO),
HPR_ESC, KC_A, LT(_SUPER,KC_R), LT(_DUPER,KC_S), KC_T, KC_D, HPR_ESC, KC_A, KC_R, KC_S, KC_T, KC_D,
SFT_PO, LT(_MOUSE, KC_Z), KC_X, KC_C, KC_V, KC_B, ALL_T(KC_NO), SFT_PO, LT(_MOUSE, KC_Z), KC_X, KC_C, KC_V, KC_B, ALL_T(KC_NO),
LT(_RAISE, KC_LBRC),KC_LCTL, KC_LALT, GUI_UNDS, LOWER, LT(_RAISE, KC_LBRC),KC_LCTL, KC_LALT, GUI_UNDS, LOWER,
KC_ENT, KC_LGUI, KC_ENT, KC_LGUI,
@ -177,7 +139,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
// left hand // left hand
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, LT(_MDIA, KC_NO), KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, LT(_MDIA, KC_NO),
KC_TAB, CM_Q, CM_W, CM_E, CM_R, CM_T, LT(_SYMB, KC_NO), KC_TAB, CM_Q, CM_W, CM_E, CM_R, CM_T, LT(_SYMB, KC_NO),
HPR_ESC, CM_A, LT(_SUPER,CM_S), LT(_DUPER,CM_D), CM_F, CM_G, HPR_ESC, CM_A, CM_S, CM_D, CM_F, CM_G,
SFT_PO, LT(_MOUSE, CM_Z), CM_X, CM_C, CM_V, CM_B, ALL_T(KC_NO), SFT_PO, LT(_MOUSE, CM_Z), CM_X, CM_C, CM_V, CM_B, ALL_T(KC_NO),
LT(_RAISE, KC_LBRC),KC_LCTL, KC_LALT, GUI_UNDS, LOWER, LT(_RAISE, KC_LBRC),KC_LCTL, KC_LALT, GUI_UNDS, LOWER,
KC_ENT, KC_LGUI, KC_ENT, KC_LGUI,
@ -357,47 +319,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
_______, _______,
_______,_______, KC_LSFT _______,_______, KC_LSFT
), ),
// Intermediate keymaps for SuperDuper (Combo keys does not work on Infinity yet)
[_SUPER] = LAYOUT_ergodox(
// left hand
_______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, DUPER, _______, _______,
_______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______,
_______, _______,
_______,
_______,_______,_______,
// right hand
_______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______,
_______, _______,
_______,
_______,_______, _______
),
[_DUPER] = LAYOUT_ergodox(
// left hand
_______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______,
_______, _______, SUPER, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______,
_______, _______,
_______,
_______,_______,_______,
// right hand
_______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______,
_______, _______,
_______,
_______,_______, _______
),
/* Mouse /* Mouse
* *
@ -452,7 +373,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
* | | | | | | | | | |SDTogg| | | | | | * | | | | | | | | | |SDTogg| | | | | |
* `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
* | | | | | | | | | | | | * | | | | | | | | | | | BACKLIT|
* `----------------------------------' `----------------------------------' * `----------------------------------' `----------------------------------'
* ,-------------. ,-------------. * ,-------------. ,-------------.
* | | | | | | * | | | | | |
@ -477,7 +398,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
_______, _______, _______, _______, _______, _______, KC_DEL, _______, _______, _______, _______, _______, _______, KC_DEL,
AG_SWAP, QWERTY, COLEMAK, QWOC, PLOVER, _______, AG_SWAP, QWERTY, COLEMAK, QWOC, PLOVER, _______,
_______, SDTOGG, _______, _______, _______, _______, _______, _______, SDTOGG, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, BACKLIT,
_______, _______, _______, _______,
_______, _______,
_______,_______, _______ _______,_______, _______
@ -569,146 +490,123 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
) )
}; };
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) { bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) { switch (keycode) {
case QWERTY: case QWERTY:
if (record->event.pressed) { if (record->event.pressed) {
persistant_default_layer_set(1UL<<_QWERTY); set_single_persistent_default_layer(_QWERTY);
// key_combos[CB_SUPERDUPER].keys = superduper_combos[_QWERTY]; set_superduper_key_combo_layer(_QWERTY);
// eeprom_update_byte(EECONFIG_SUPERDUPER_INDEX, _QWERTY); }
} return false;
return false;
break;
case COLEMAK:
if (record->event.pressed) {
persistant_default_layer_set(1UL<<_COLEMAK);
// key_combos[CB_SUPERDUPER].keys = superduper_combos[_COLEMAK]; case COLEMAK:
// eeprom_update_byte(EECONFIG_SUPERDUPER_INDEX, _COLEMAK); if (record->event.pressed) {
} set_single_persistent_default_layer(_COLEMAK);
return false;
break;
case QWOC:
if (record->event.pressed) {
persistant_default_layer_set(1UL<<_QWOC);
// key_combos[CB_SUPERDUPER].keys = superduper_combos[_QWOC]; set_superduper_key_combo_layer(_COLEMAK);
// eeprom_update_byte(EECONFIG_SUPERDUPER_INDEX, _QWOC); }
} return false;
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 SUPER:
if (record->event.pressed) {
layer_on(_SUPER);
update_tri_layer(_SUPER, _DUPER, _SUPERDUPER);
} else {
layer_off(_SUPER);
update_tri_layer(_SUPER, _DUPER, _SUPERDUPER);
}
return false;
break;
case DUPER:
if (record->event.pressed) {
layer_on(_DUPER);
update_tri_layer(_SUPER, _DUPER, _SUPERDUPER);
} else {
layer_off(_DUPER);
update_tri_layer(_SUPER, _DUPER, _SUPERDUPER);
}
return false;
break;
case BACKLIT:
if (record->event.pressed) {
register_code(KC_RSFT);
#ifdef BACKLIGHT_ENABLE
backlight_step();
#endif
} else {
unregister_code(KC_RSFT);
}
return false;
break;
case PLOVER:
if (record->event.pressed) {
layer_off(_RAISE);
layer_off(_LOWER);
layer_off(_ADJUST);
layer_on(_PLOVER);
if (!eeconfig_is_enabled()) {
eeconfig_init();
}
keymap_config.raw = eeconfig_read_keymap();
keymap_config.nkro = 1;
eeconfig_update_keymap(keymap_config.raw);
}
return false;
break;
case EXT_PLV:
if (record->event.pressed) {
layer_off(_PLOVER);
}
return false;
break;
case SDTOGG:
if (record->event.pressed) {
// superduper_enabled = !superduper_enabled;
// if (superduper_enabled) { case QWOC:
// set_superduper_key_combos(); if (record->event.pressed) {
// } else { set_single_persistent_default_layer(_QWOC);
// clear_superduper_key_combos();
// } set_superduper_key_combo_layer(_QWOC);
} }
return false; return false;
break;
case EPRM: case LOWER:
if (record->event.pressed) { if (record->event.pressed) {
eeconfig_init(); layer_on(_LOWER);
} update_tri_layer(_LOWER, _RAISE, _ADJUST);
return false; } else {
break; layer_off(_LOWER);
case VRSN: update_tri_layer(_LOWER, _RAISE, _ADJUST);
if (record->event.pressed) { }
SEND_STRING (QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION); return false;
}
return false; case RAISE:
break; if (record->event.pressed) {
case RGB_SLD: layer_on(_RAISE);
if (record->event.pressed) { update_tri_layer(_LOWER, _RAISE, _ADJUST);
#ifdef RGBLIGHT_ENABLE } else {
rgblight_mode(1); layer_off(_RAISE);
#endif update_tri_layer(_LOWER, _RAISE, _ADJUST);
} }
return false; return false;
break;
} case BACKLIT:
return true; if (record->event.pressed) {
register_code(KC_RSFT);
#ifdef BACKLIGHT_ENABLE
backlight_step();
#endif
} else {
unregister_code(KC_RSFT);
}
return false;
case PLOVER:
if (record->event.pressed) {
layer_off(_RAISE);
layer_off(_LOWER);
layer_off(_ADJUST);
layer_on(_PLOVER);
if (!eeconfig_is_enabled()) {
eeconfig_init();
}
keymap_config.raw = eeconfig_read_keymap();
keymap_config.nkro = 1;
eeconfig_update_keymap(keymap_config.raw);
}
return false;
case EXT_PLV:
if (record->event.pressed) {
layer_off(_PLOVER);
}
return false;
case SDTOGG:
if (record->event.pressed) {
toggle_superduper_mode();
}
return false;
case VRSN:
if (record->event.pressed) {
SEND_STRING(QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION);
}
return false;
case RGB_SLD:
if (record->event.pressed) {
#ifdef RGBLIGHT_ENABLE
rgblight_mode(1);
#endif
}
return false;
// Macros
// 1. Hold for LGUI, tap for Underscore
case GUI_UNDS:
perform_space_cadet(record, KC_LGUI, KC_LSFT, KC_MINS);
return false;
// 2. Hold for LSHIFT, tap for Parens open
case LSFT_LPRN:
perform_space_cadet(record, KC_LSFT, KC_LSFT, KC_9);
return false;
// 3. Hold for RSHIFT, tap for Parens close
case RSFT_RPRN:
perform_space_cadet(record, KC_RSFT, KC_RSFT, KC_0);
return false;
}
return true;
} }
void matrix_init_user(void) { void matrix_init_user(void) {
@ -716,25 +614,9 @@ void matrix_init_user(void) {
} }
void matrix_setup(void) { void matrix_setup(void) {
// set_superduper_key_combos(); set_superduper_key_combos();
} }
// void set_superduper_key_combos(void) {
// uint8_t layer = eeprom_read_byte(EECONFIG_SUPERDUPER_INDEX);
// switch (layer) {
// case _QWERTY:
// case _COLEMAK:
// case _QWOC:
// key_combos[CB_SUPERDUPER].keys = superduper_combos[layer];
// break;
// }
// }
// void clear_superduper_key_combos(void) {
// key_combos[CB_SUPERDUPER].keys = empty_combo;
// }
void matrix_scan_user(void) { void matrix_scan_user(void) {
// uint8_t layer = biton32(layer_state); // uint8_t layer = biton32(layer_state);
@ -758,91 +640,17 @@ void matrix_scan_user(void) {
// Combos // Combos
// void process_combo_event(uint8_t combo_index, bool pressed) { void process_combo_event(uint8_t combo_index, bool pressed) {
// if (pressed) { if (pressed) {
// switch(combo_index) { switch(combo_index) {
// case CB_SUPERDUPER: case CB_SUPERDUPER:
// layer_on(_SUPERDUPER); layer_on(_SUPERDUPER);
// ergodox_board_led_on(); ergodox_board_led_on();
// break; break;
// }
// } else {
// layer_off(_SUPERDUPER);
// ergodox_board_led_off();
// unregister_mods(MOD_BIT(KC_LGUI) | MOD_BIT(KC_LCTL) | MOD_BIT(KC_LALT)); // Sometimes mods are held, unregister them
// }
// }
// Macros
const uint16_t PROGMEM fn_actions[] = {
[M_GUI_UNDS] = ACTION_MACRO_TAP(M_GUI_UNDS),
[M_SFT_PO] = ACTION_MACRO_TAP(M_SFT_PO),
[M_SFT_PC] = ACTION_MACRO_TAP(M_SFT_PC),
};
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
{
bool tap_not_interrupted = record->tap.count > 0 && !record->tap.interrupted;
switch(id) {
// Hold for LGUI, tap for Underscore
case M_GUI_UNDS:
if (record->event.pressed) {
m_gui_unds_timer = timer_read();
if (!tap_not_interrupted) {
register_mods(MOD_BIT(KC_LGUI));
} }
} else { } else {
if (tap_not_interrupted && timer_elapsed(m_gui_unds_timer) < TAPPING_TERM) { layer_off(_SUPERDUPER);
ergodox_board_led_off();
add_weak_mods(MOD_BIT(KC_LSFT)); unregister_mods(MOD_BIT(KC_LGUI) | MOD_BIT(KC_LCTL) | MOD_BIT(KC_LALT)); // Sometimes mods are held, unregister them
send_keyboard_report(); }
register_code(KC_MINS); }
unregister_code(KC_MINS);
del_weak_mods(MOD_BIT(KC_LSFT));
send_keyboard_report();
record->tap.count = 0; // ad hoc: cancel tap
} else {
unregister_mods(MOD_BIT(KC_LGUI));
}
}
break;
// Hold for LSHIFT, tap for Parens open
case M_SFT_PO:
if (record->event.pressed) {
m_sft_po_timer = timer_read();
if (!tap_not_interrupted) {
register_mods(MOD_BIT(KC_LSFT));
}
} else {
if (tap_not_interrupted && timer_elapsed(m_sft_po_timer) < TAPPING_TERM) {
record->tap.count = 0;
return MACRO(D(RSFT), T(9), U(RSFT), END);
} else {
unregister_mods(MOD_BIT(KC_LSFT));
}
}
break;
// Hold for RSHIFT, tap for Parens close
case M_SFT_PC:
if (record->event.pressed) {
m_sft_pc_timer = timer_read();
if (!tap_not_interrupted) {
register_mods(MOD_BIT(KC_RSFT));
}
} else {
if (tap_not_interrupted && timer_elapsed(m_sft_pc_timer) < TAPPING_TERM) {
record->tap.count = 0;
return MACRO(D(LSFT), T(0), U(LSFT), END);
} else {
unregister_mods(MOD_BIT(KC_RSFT));
}
}
break;
}
return MACRO_NONE;
};

View file

@ -25,21 +25,22 @@ Press `S+D` simultaneously and hold, then...
- It can be activated by holding `/` as well, but it's slower since `LT()` uses `TAPPING_TERM` of 200ms but `S+D` uses `COMBO_TERM` of only 20ms (Can be changed within config.h) - It can be activated by holding `/` as well, but it's slower since `LT()` uses `TAPPING_TERM` of 200ms but `S+D` uses `COMBO_TERM` of only 20ms (Can be changed within config.h)
## Build instructions ## Build instructions
- `cd /path/to/qmk_firmware` If your environment is ready to build with `make`, don't use docker since it takes 5m+ to compile.
Use the instructions in Ergodox Infinity's readme.
#### Left side #### Left side (Docker)
``` ```
docker run -e keymap=narze -e subproject=infinity -e keyboard=ergodox --rm -v $('pwd'):/qmk:rw edasque/qmk_firmware cd /path/to/qmk_firmware
util/docker_build.sh ergodox_infinity:narze
avr-objcopy -Iihex -Obinary .build/ergodox_infinity_narze.hex .build/ergodox_infinity_narze_left.bin avr-objcopy -Iihex -Obinary .build/ergodox_infinity_narze.hex .build/ergodox_infinity_narze_left.bin
dfu-util --device 1c11:b007 -D .build/ergodox_infinity_narze_left.bin dfu-util --device 1c11:b007 -D .build/ergodox_infinity_narze_left.bin
``` ```
#### Right side #### Right side (Docker)
You have to override `usb_args` in order to pass `MASTER=right` to docker using provided build script.
``` ```
docker run -e keymap=narze -e subproject=infinity -e keyboard=ergodox -e MASTER=right --rm -v $('pwd'):/qmk:rw edasque/qmk_firmware cd /path/to/qmk_firmware
usb_args="-e MASTER=right" util/docker_build.sh ergodox_infinity:narze
avr-objcopy -Iihex -Obinary .build/ergodox_infinity_narze.hex .build/ergodox_infinity_narze_right.bin avr-objcopy -Iihex -Obinary .build/ergodox_infinity_narze.hex .build/ergodox_infinity_narze_right.bin
dfu-util --device 1c11:b007 -D .build/ergodox_infinity_narze_right.bin dfu-util --device 1c11:b007 -D .build/ergodox_infinity_narze_right.bin
``` ```
## TODO
- [ ] Make SuperDuper mode fully-compatible in Windows by swapping GUI with Ctrl

View file

@ -20,5 +20,4 @@ RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight.
# 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
# Combos not working yet COMBO_ENABLE = yes
COMBO_ENABLE = no

View file

@ -1,7 +1,4 @@
#ifndef CONFIG_USER_H #pragma once
#define CONFIG_USER_H
#include "../../config.h"
/* /*
* MIDI options * MIDI options
@ -26,7 +23,8 @@
/* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */ /* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */
//#define MIDI_TONE_KEYCODE_OCTAVES 2 //#define MIDI_TONE_KEYCODE_OCTAVES 2
#define TAPPING_TERM 200 #undef TAPPING_TERM
#define TAPPING_TERM 100
#define COMBO_TERM 20 #define COMBO_TERM 20
#define COMBO_COUNT 1 #define COMBO_COUNT 1
@ -38,4 +36,11 @@
#define MOUSEKEY_DELAY 100 #define MOUSEKEY_DELAY 100
#ifdef AUDIO_ENABLE
#define STARTUP_SONG SONG(PLANCK_SOUND)
#define DEFAULT_LAYER_SONGS { SONG(QWERTY_SOUND), \
SONG(COLEMAK_SOUND), \
SONG(DVORAK_SOUND) \
}
#endif #endif

View file

@ -1,89 +1,49 @@
// This is the canonical layout file for the Quantum project. If you want to add another keyboard, #include QMK_KEYBOARD_H
// this is the style you want to emulate. #include "narze.h"
#pragma message "You may need to add LAYOUT_planck_grid to your keymap layers - see default for an example"
#include "planck.h"
#include "action_layer.h"
#ifdef AUDIO_ENABLE #ifdef AUDIO_ENABLE
#include "audio.h" #include "audio.h"
#endif #endif
#include "eeconfig.h"
#include "keymap_colemak.h" #include "keymap_colemak.h"
extern keymap_config_t keymap_config; 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.
enum planck_layers { enum planck_layers {
_QWERTY, _QWERTY,
_COLEMAK, _COLEMAK,
_QWOC, _QWOC,
_LOWER, _LOWER,
_RAISE, _RAISE,
_PLOVER, _PLOVER,
_SUPERDUPER, _SUPERDUPER,
_MOUSE, _MOUSE,
_ADJUST _ADJUST
}; };
enum planck_keycodes { enum planck_keycodes {
QWERTY = SAFE_RANGE, QWERTY = SAFE_RANGE,
COLEMAK, COLEMAK,
QWOC, QWOC,
PLOVER, PLOVER,
SUPERDUPER, SUPERDUPER,
MOUSE, MOUSE,
LOWER, LOWER,
RAISE, RAISE,
BACKLIT, BACKLIT,
EXT_PLV, EXT_PLV,
SDTOGG, // Toggle SuperDuper SDTOGG, // Toggle SuperDuper
GUI_UNDS,
LSFT_LPRN,
}; };
enum functions {
M_GUI_UNDS, // Simulate GUI_T(KC_UNDS)
M_SFT_PO, // SFT_T(KC_LPRN)
};
// Timer for custom mod tap
static uint16_t m_gui_unds_timer;
static uint16_t m_sft_po_timer;
// Narze : Custom Macros // Narze : Custom Macros
#define HPR_ESC ALL_T(KC_ESC) #define HPR_ESC ALL_T(KC_ESC)
#define SFT_ENT SFT_T(KC_ENT) #define SFT_ENT SFT_T(KC_ENT)
#define SFT_PO F(M_SFT_PO)
#define GUI_MINS GUI_T(KC_MINS) #define GUI_MINS GUI_T(KC_MINS)
#define GUI_UNDS F(M_GUI_UNDS)
// Combo : SuperDuper layer from S+D (R+S in Colemak)
#define SUPERDUPER_COMBO_COUNT 3
#define EECONFIG_SUPERDUPER_INDEX (uint8_t *) 19
enum process_combo_event { enum process_combo_event {
CB_SUPERDUPER, CB_SUPERDUPER,
}; };
const uint16_t PROGMEM superduper_combos[SUPERDUPER_COMBO_COUNT][3] = {
[_QWERTY] = {KC_S, KC_D, COMBO_END},
[_COLEMAK] = {KC_R, KC_S, COMBO_END},
[_QWOC] = {CM_S, CM_D, COMBO_END},
};
combo_t key_combos[COMBO_COUNT] = {
[CB_SUPERDUPER] = COMBO_ACTION(superduper_combos[_QWERTY]),
};
volatile bool superduper_enabled = true;
const uint16_t empty_combo[] = {COMBO_END};
void set_superduper_key_combos(void);
void clear_superduper_key_combos(void);
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Qwerty /* Qwerty
@ -97,12 +57,12 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* | Rse/[| Ctrl | Alt | GUI/_|Lower | Space |Raise | GUI/-| Alt | Ctrl | Low/]| * | Rse/[| Ctrl | Alt | GUI/_|Lower | Space |Raise | GUI/-| Alt | Ctrl | Low/]|
* `-----------------------------------------------------------------------------------' * `-----------------------------------------------------------------------------------'
*/ */
[_QWERTY] = { [_QWERTY] = LAYOUT_planck_grid(
{KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC}, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC,
{HPR_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT}, HPR_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT,
{SFT_PO, LT(_MOUSE, KC_Z), KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, LT(_SUPERDUPER, KC_SLSH), SFT_ENT}, LSFT_LPRN, LT(_MOUSE, KC_Z), KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, LT(_SUPERDUPER, KC_SLSH), SFT_ENT,
{LT(_RAISE, KC_LBRC), KC_LCTL, KC_LALT, GUI_UNDS, LOWER, KC_SPC, KC_SPC, RAISE, GUI_MINS, KC_RALT, KC_RCTL, LT(_LOWER, KC_RBRC)} LT(_RAISE, KC_LBRC), KC_LCTL, KC_LALT, GUI_UNDS, LOWER, KC_SPC, KC_SPC, RAISE, GUI_MINS, KC_RALT, KC_RCTL, LT(_LOWER, KC_RBRC)
}, ),
/* Colemak /* Colemak
* ,-----------------------------------------------------------------------------------. * ,-----------------------------------------------------------------------------------.
@ -115,20 +75,20 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* | Brite| Ctrl | Alt | GUI/_|Lower | Space |Raise | GUI/-| Alt | Ctrl | Low/]| * | Brite| Ctrl | Alt | GUI/_|Lower | Space |Raise | GUI/-| Alt | Ctrl | Low/]|
* `-----------------------------------------------------------------------------------' * `-----------------------------------------------------------------------------------'
*/ */
[_COLEMAK] = { [_COLEMAK] = LAYOUT_planck_grid(
{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_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC,
{HPR_ESC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT}, HPR_ESC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT,
{SFT_PO, LT(_MOUSE, KC_Z), KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, LT(_SUPERDUPER, KC_SLSH), SFT_ENT}, LSFT_LPRN, LT(_MOUSE, KC_Z), KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, LT(_SUPERDUPER, KC_SLSH), SFT_ENT,
{LT(_RAISE, KC_LBRC), KC_LCTL, KC_LALT, GUI_UNDS, LOWER, KC_SPC, KC_SPC, RAISE, GUI_MINS, KC_RALT, KC_RCTL, LT(_LOWER, KC_RBRC)} LT(_RAISE, KC_LBRC), KC_LCTL, KC_LALT, GUI_UNDS, LOWER, KC_SPC, KC_SPC, RAISE, GUI_MINS, KC_RALT, KC_RCTL, LT(_LOWER, KC_RBRC)
}, ),
/* Qwerty on software Colemak : Useful for gaming with qwerty keymaps! */ /* Qwerty on software Colemak : Useful for gaming with qwerty keymaps! */
[_QWOC] = { [_QWOC] = LAYOUT_planck_grid(
{KC_TAB, CM_Q, CM_W, CM_E, CM_R, CM_T, CM_Y, CM_U, CM_I, CM_O, CM_P, KC_BSPC}, KC_TAB, CM_Q, CM_W, CM_E, CM_R, CM_T, CM_Y, CM_U, CM_I, CM_O, CM_P, KC_BSPC,
{HPR_ESC, CM_A, CM_S, CM_D, CM_F, CM_G, CM_H, CM_J, CM_K, CM_L, CM_SCLN, KC_QUOT}, HPR_ESC, CM_A, CM_S, CM_D, CM_F, CM_G, CM_H, CM_J, CM_K, CM_L, CM_SCLN, KC_QUOT,
{SFT_PO, LT(_MOUSE, CM_Z), CM_X, CM_C, CM_V, CM_B, CM_N, CM_M, CM_COMM, CM_DOT, LT(_SUPERDUPER, CM_SLSH), SFT_ENT}, LSFT_LPRN, LT(_MOUSE, CM_Z), CM_X, CM_C, CM_V, CM_B, CM_N, CM_M, CM_COMM, CM_DOT, LT(_SUPERDUPER, CM_SLSH), SFT_ENT,
{LT(_RAISE, KC_LBRC), KC_LCTL, KC_LALT, GUI_UNDS, LOWER, KC_SPC, KC_SPC, RAISE, GUI_MINS, KC_RALT, KC_RCTL, LT(_LOWER, KC_RBRC)} LT(_RAISE, KC_LBRC), KC_LCTL, KC_LALT, GUI_UNDS, LOWER, KC_SPC, KC_SPC, RAISE, GUI_MINS, KC_RALT, KC_RCTL, LT(_LOWER, KC_RBRC)
}, ),
/* Lower /* Lower
* ,-----------------------------------------------------------------------------------. * ,-----------------------------------------------------------------------------------.
@ -136,17 +96,17 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* |------+------+------+------+------+-------------+------+------+------+------+------| * |------+------+------+------+------+-------------+------+------+------+------+------|
* | Del | F1 | F2 | F3 | F4 | F5 | F6 | _ | + | { | } | | | * | Del | F1 | F2 | F3 | F4 | F5 | F6 | _ | + | { | } | | |
* |------+------+------+------+------+------|------+------+------+------+------+------| * |------+------+------+------+------+------|------+------+------+------+------+------|
* | | F7 | F8 | F9 | F10 | F11 | F12 |ISO ~ |ISO | | | |Sft/Ent| * | | F7 | F8 | F9 | F10 | F11 | F12 |ISO ~ | | | |Sft/Ent|
* |------+------+------+------+------+------+------+------+------+------+------+------| * |------+------+------+------+------+------+------+------+------+------+------+------|
* | | | | | | | | Next | Vol- | Vol+ | Play | * | | | | | | | | Next | Vol- | Vol+ | Play |
* `-----------------------------------------------------------------------------------' * `-----------------------------------------------------------------------------------'
*/ */
[_LOWER] = { [_LOWER] = LAYOUT_planck_grid(
{KC_GRV, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC}, KC_GRV, 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_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_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12,S(KC_NUHS),_______,_______, _______, _______,
{_______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY} _______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY
}, ),
/* Raise /* Raise
* ,-----------------------------------------------------------------------------------. * ,-----------------------------------------------------------------------------------.
@ -154,17 +114,17 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* |------+------+------+------+------+-------------+------+------+------+------+------| * |------+------+------+------+------+-------------+------+------+------+------+------|
* | Del | F1 | F2 | F3 | F4 | F5 | F6 | - | = | [ | ] | \ | * | Del | F1 | F2 | F3 | F4 | F5 | F6 | - | = | [ | ] | \ |
* |------+------+------+------+------+------|------+------+------+------+------+------| * |------+------+------+------+------+------|------+------+------+------+------+------|
* | | F7 | F8 | F9 | F10 | F11 | F12 |ISO # |ISO / | | |Sft/Ent| * | | F7 | F8 | F9 | F10 | F11 | F12 |ISO # | | | |Sft/Ent|
* |------+------+------+------+------+------+------+------+------+------+------+------| * |------+------+------+------+------+------+------+------+------+------+------+------|
* | | | | | | | | Next | Vol- | Vol+ | Play | * | | | | | | | | Next | Vol- | Vol+ | Play |
* `-----------------------------------------------------------------------------------' * `-----------------------------------------------------------------------------------'
*/ */
[_RAISE] = { [_RAISE] = LAYOUT_planck_grid(
{KC_TILD, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC}, KC_TILD, 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_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_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_NUHS, _______, _______, _______, _______,
{_______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY} _______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY
}, ),
/* Plover layer (http://opensteno.org) /* Plover layer (http://opensteno.org)
* ,-----------------------------------------------------------------------------------. * ,-----------------------------------------------------------------------------------.
@ -178,12 +138,12 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* `-----------------------------------------------------------------------------------' * `-----------------------------------------------------------------------------------'
*/ */
[_PLOVER] = { [_PLOVER] = LAYOUT_planck_grid(
{KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1 }, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1 ,
{XXXXXXX, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC}, XXXXXXX, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC,
{XXXXXXX, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT}, XXXXXXX, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT,
{EXT_PLV, XXXXXXX, XXXXXXX, KC_C, KC_V, XXXXXXX, XXXXXXX, KC_N, KC_M, XXXXXXX, XXXXXXX, XXXXXXX} EXT_PLV, XXXXXXX, XXXXXXX, KC_C, KC_V, XXXXXXX, XXXXXXX, KC_N, KC_M, XXXXXXX, XXXXXXX, XXXXXXX
}, ),
/* SuperDuper : https://gist.github.com/narze/861e2167784842d38771 /* SuperDuper : https://gist.github.com/narze/861e2167784842d38771
* /-----------------------------------------------------------------------------------\ * /-----------------------------------------------------------------------------------\
@ -196,12 +156,12 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* | | | | | | Shift | | | | | | * | | | | | | Shift | | | | | |
* \-----------------------------------------------------------------------------------/ * \-----------------------------------------------------------------------------------/
*/ */
[_SUPERDUPER] = { [_SUPERDUPER] = LAYOUT_planck_grid(
{_______, _______, _______, _______, _______, _______, _______, _______, S(LGUI(KC_LBRC)), S(LGUI(KC_RBRC)), _______, _______}, _______, _______, _______, _______, _______, _______, _______, _______, S(LGUI(KC_LBRC)), S(LGUI(KC_RBRC)), _______, _______,
{_______, KC_LALT, _______, _______, KC_BSPC, KC_LGUI, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, KC_DEL, _______}, _______, KC_LALT, _______, _______, KC_BSPC, KC_LGUI, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, KC_DEL, _______,
{_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______}, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
{_______, _______, _______, _______, _______, KC_LSFT, KC_LSFT, _______, _______, _______, _______, _______} _______, _______, _______, _______, _______, KC_LSFT, KC_LSFT, _______, _______, _______, _______, _______
}, ),
/* Mouse /* Mouse
* /-----------------------------------------------------------------------------------\ * /-----------------------------------------------------------------------------------\
@ -214,12 +174,12 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* | | | | | M2 | LeftClick | M2 | | | | | * | | | | | M2 | LeftClick | M2 | | | | |
* \-----------------------------------------------------------------------------------/ * \-----------------------------------------------------------------------------------/
*/ */
[_MOUSE] = { [_MOUSE] = LAYOUT_planck_grid(
{_______, _______, KC_WH_U, KC_MS_U, KC_WH_D, _______, _______, _______, KC_WH_U, KC_WH_D, _______, _______}, _______, _______, KC_WH_U, KC_MS_U, KC_WH_D, _______, _______, _______, KC_WH_U, KC_WH_D, _______, _______,
{_______, _______, KC_MS_L, KC_MS_D, KC_MS_R, _______, KC_MS_L, KC_MS_D, KC_MS_U, KC_MS_R, _______, _______}, _______, _______, KC_MS_L, KC_MS_D, KC_MS_R, _______, KC_MS_L, KC_MS_D, KC_MS_U, KC_MS_R, _______, _______,
{_______, _______, _______, _______, _______, KC_BTN3, KC_BTN3, _______, _______, _______, _______, _______}, _______, _______, _______, _______, _______, KC_BTN3, KC_BTN3, _______, _______, _______, _______, _______,
{_______, _______, _______, _______, KC_BTN2, KC_BTN1, KC_BTN1, KC_BTN2, _______, _______, _______, _______} _______, _______, _______, _______, KC_BTN2, KC_BTN1, KC_BTN1, KC_BTN2, _______, _______, _______, _______
}, ),
/* Adjust (Lower + Raise) /* Adjust (Lower + Raise)
* ,-----------------------------------------------------------------------------------. * ,-----------------------------------------------------------------------------------.
@ -232,290 +192,161 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* | | | | | | | | | | | | * | | | | | | | | | | | |
* `-----------------------------------------------------------------------------------' * `-----------------------------------------------------------------------------------'
*/ */
[_ADJUST] = { [_ADJUST] = LAYOUT_planck_grid(
{_______, RESET, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_DEL}, _______, RESET, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_DEL,
{_______, _______, _______, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, QWOC, PLOVER, _______}, _______, _______, _______, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, QWOC, PLOVER, _______,
{_______, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, SDTOGG, _______, _______, _______, _______}, _______, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, SDTOGG, _______, _______, _______, _______,
{_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______} _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, BACKLIT
} )
}; };
#ifdef AUDIO_ENABLE #ifdef AUDIO_ENABLE
float tone_startup[][2] = SONG(STARTUP_SOUND); float tone_plover[][2] = SONG(PLOVER_SOUND);
float tone_qwerty[][2] = SONG(QWERTY_SOUND); float tone_plover_gb[][2] = SONG(PLOVER_GOODBYE_SOUND);
float tone_qwoc[][2] = SONG(DVORAK_SOUND); float tone_coin[][2] = SONG(VIOLIN_SOUND);
float tone_colemak[][2] = SONG(COLEMAK_SOUND); float tone_goodbye[][2] = SONG(GOODBYE_SOUND);
float tone_plover[][2] = SONG(PLOVER_SOUND);
float tone_plover_gb[][2] = SONG(PLOVER_GOODBYE_SOUND);
float music_scale[][2] = SONG(MUSIC_SCALE_SOUND);
float tone_coin[][2] = SONG(COIN_SOUND);
float tone_sonic_ring[][2] = SONG(SONIC_RING);
float tone_goodbye[][2] = SONG(GOODBYE_SOUND);
float tone_superduper[][2] = SONG(SUPER_DUPER_SOUND);
#endif #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) { bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) { switch (keycode) {
case QWERTY: case QWERTY:
if (record->event.pressed) { if (record->event.pressed) {
#ifdef AUDIO_ENABLE set_single_persistent_default_layer(_QWERTY);
PLAY_NOTE_ARRAY(tone_qwerty, false, 0);
#endif
persistant_default_layer_set(1UL<<_QWERTY);
key_combos[CB_SUPERDUPER].keys = superduper_combos[_QWERTY]; set_superduper_key_combo_layer(_QWERTY);
eeprom_update_byte(EECONFIG_SUPERDUPER_INDEX, _QWERTY); }
} return false;
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);
key_combos[CB_SUPERDUPER].keys = superduper_combos[_COLEMAK]; case COLEMAK:
eeprom_update_byte(EECONFIG_SUPERDUPER_INDEX, _COLEMAK); if (record->event.pressed) {
} set_single_persistent_default_layer(_COLEMAK);
return false;
break;
case QWOC:
if (record->event.pressed) {
#ifdef AUDIO_ENABLE
PLAY_NOTE_ARRAY(tone_qwoc, false, 0);
#endif
persistant_default_layer_set(1UL<<_QWOC);
key_combos[CB_SUPERDUPER].keys = superduper_combos[_QWOC]; set_superduper_key_combo_layer(_COLEMAK);
eeprom_update_byte(EECONFIG_SUPERDUPER_INDEX, _QWOC); }
} return false;
return false;
break;
case LOWER:
if (record->event.pressed) {
layer_on(_LOWER);
update_tri_layer(_LOWER, _RAISE, _ADJUST);
} else {
layer_off(_LOWER);
update_tri_layer(_LOWER, _RAISE, _ADJUST);
}
return false;
break;
case RAISE:
if (record->event.pressed) {
layer_on(_RAISE);
update_tri_layer(_LOWER, _RAISE, _ADJUST);
} else {
layer_off(_RAISE);
update_tri_layer(_LOWER, _RAISE, _ADJUST);
}
return false;
break;
case BACKLIT:
if (record->event.pressed) {
register_code(KC_RSFT);
#ifdef BACKLIGHT_ENABLE
backlight_step();
#endif
} else {
unregister_code(KC_RSFT);
}
return false;
break;
case PLOVER:
if (record->event.pressed) {
#ifdef AUDIO_ENABLE
stop_all_notes();
PLAY_NOTE_ARRAY(tone_plover, false, 0);
#endif
layer_off(_RAISE);
layer_off(_LOWER);
layer_off(_ADJUST);
layer_on(_PLOVER);
if (!eeconfig_is_enabled()) {
eeconfig_init();
}
keymap_config.raw = eeconfig_read_keymap();
keymap_config.nkro = 1;
eeconfig_update_keymap(keymap_config.raw);
}
return false;
break;
case EXT_PLV:
if (record->event.pressed) {
#ifdef AUDIO_ENABLE
PLAY_NOTE_ARRAY(tone_plover_gb, false, 0);
#endif
layer_off(_PLOVER);
}
return false;
break;
case SDTOGG:
if (record->event.pressed) {
superduper_enabled = !superduper_enabled;
if (superduper_enabled) { case QWOC:
set_superduper_key_combos(); if (record->event.pressed) {
set_single_persistent_default_layer(_QWOC);
#ifdef AUDIO_ENABLE set_superduper_key_combo_layer(_QWOC);
PLAY_NOTE_ARRAY(tone_sonic_ring, false, 0); }
#endif return false;
} else {
clear_superduper_key_combos();
#ifdef AUDIO_ENABLE case LOWER:
PLAY_NOTE_ARRAY(tone_coin, false, 0); if (record->event.pressed) {
#endif layer_on(_LOWER);
} update_tri_layer(_LOWER, _RAISE, _ADJUST);
} } else {
return false; layer_off(_LOWER);
break; update_tri_layer(_LOWER, _RAISE, _ADJUST);
} }
return true; return false;
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;
case BACKLIT:
if (record->event.pressed) {
register_code(KC_RSFT);
#ifdef BACKLIGHT_ENABLE
backlight_step();
#endif
} else {
unregister_code(KC_RSFT);
}
return false;
case PLOVER:
if (record->event.pressed) {
#ifdef AUDIO_ENABLE
stop_all_notes();
PLAY_SONG(tone_plover);
#endif
layer_off(_RAISE);
layer_off(_LOWER);
layer_off(_ADJUST);
layer_on(_PLOVER);
if (!eeconfig_is_enabled()) {
eeconfig_init();
}
keymap_config.raw = eeconfig_read_keymap();
keymap_config.nkro = 1;
eeconfig_update_keymap(keymap_config.raw);
}
return false;
case EXT_PLV:
if (record->event.pressed) {
#ifdef AUDIO_ENABLE
PLAY_SONG(tone_plover_gb);
#endif
layer_off(_PLOVER);
}
return false;
case SDTOGG:
if (record->event.pressed) {
bool enabled = toggle_superduper_mode();
#ifdef AUDIO_ENABLE
if (enabled) {
PLAY_SONG(tone_coin);
} else {
PLAY_SONG(tone_goodbye);
}
#endif
}
return false;
// Macros
// 1. Hold for LGUI, tap for Underscore
case GUI_UNDS:
perform_space_cadet(record, KC_LGUI, KC_LSFT, KC_MINS);
return false;
// 2. Hold for LSHIFT, tap for Parens open
case LSFT_LPRN:
perform_space_cadet(record, KC_LSFT, KC_LSFT, KC_9);
return false;
default:
return true;
}
return true;
} }
void matrix_init_user(void) { void matrix_init_user(void) {
#ifdef AUDIO_ENABLE #ifdef AUDIO_ENABLE
startup_user(); startup_user();
#endif #endif
} }
void matrix_setup(void) { void matrix_setup(void) {
set_superduper_key_combos(); set_superduper_key_combos();
}
void set_superduper_key_combos(void) {
uint8_t layer = eeprom_read_byte(EECONFIG_SUPERDUPER_INDEX);
switch (layer) {
case _QWERTY:
case _COLEMAK:
case _QWOC:
key_combos[CB_SUPERDUPER].keys = superduper_combos[layer];
break;
}
}
void clear_superduper_key_combos(void) {
key_combos[CB_SUPERDUPER].keys = empty_combo;
} }
void matrix_scan_user(void) { void matrix_scan_user(void) {
} }
#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
// Combos
void process_combo_event(uint8_t combo_index, bool pressed) { void process_combo_event(uint8_t combo_index, bool pressed) {
if (pressed) { if (pressed) {
switch(combo_index) { switch(combo_index) {
case CB_SUPERDUPER: case CB_SUPERDUPER:
layer_on(_SUPERDUPER); layer_on(_SUPERDUPER);
break;
#ifdef AUDIO_ENABLE }
PLAY_NOTE_ARRAY(tone_superduper, false, 0); } else {
#endif layer_off(_SUPERDUPER);
break; unregister_mods(MOD_BIT(KC_LGUI) | MOD_BIT(KC_LCTL) | MOD_BIT(KC_LALT)); // Sometimes mods are held, unregister them
} }
} else {
layer_off(_SUPERDUPER);
unregister_mods(MOD_BIT(KC_LGUI) | MOD_BIT(KC_LCTL) | MOD_BIT(KC_LALT)); // Sometimes mods are held, unregister them
}
} }
// Macros
const uint16_t PROGMEM fn_actions[] = {
[M_GUI_UNDS] = ACTION_MACRO_TAP(M_GUI_UNDS),
[M_SFT_PO] = ACTION_MACRO_TAP(M_SFT_PO),
};
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
{
bool tap_not_interrupted = record->tap.count > 0 && !record->tap.interrupted;
switch(id) {
// Hold for LGUI, tap for Underscore
case M_GUI_UNDS:
if (record->event.pressed) {
m_gui_unds_timer = timer_read();
if (!tap_not_interrupted) {
register_mods(MOD_BIT(KC_LGUI));
}
} else {
if (tap_not_interrupted && timer_elapsed(m_gui_unds_timer) < TAPPING_TERM) {
#ifdef AUDIO_ENABLE
PLAY_NOTE_ARRAY(tone_superduper, false, 0);
#endif
add_weak_mods(MOD_BIT(KC_LSFT));
send_keyboard_report();
register_code(KC_MINS);
unregister_code(KC_MINS);
del_weak_mods(MOD_BIT(KC_LSFT));
send_keyboard_report();
record->tap.count = 0; // ad hoc: cancel tap
} else {
unregister_mods(MOD_BIT(KC_LGUI));
}
}
break;
// Hold for LSHIFT, tap for Parens open
case M_SFT_PO:
if (record->event.pressed) {
m_sft_po_timer = timer_read();
if (!tap_not_interrupted) {
register_mods(MOD_BIT(KC_LSFT));
}
} else {
if (tap_not_interrupted && timer_elapsed(m_sft_po_timer) < TAPPING_TERM) {
#ifdef AUDIO_ENABLE
PLAY_NOTE_ARRAY(tone_superduper, false, 0);
#endif
record->tap.count = 0;
return MACRO(D(RSFT), T(9), U(RSFT), END);
} else {
unregister_mods(MOD_BIT(KC_LSFT));
}
}
break;
}
return MACRO_NONE;
};

View file

@ -22,10 +22,11 @@ Press `S+D` simultaneously and hold, then...
## Build instructions ## Build instructions
- `cd /path/to/qmk_firmware` - `cd /path/to/qmk_firmware`
- `docker run -e keymap=narze -e subproject=rev4 -e keyboard=planck --rm -v $('pwd'):/qmk:rw edasque/qmk_firmware` - Ensure latest libraries are loaded `make git-submodule`
- `dfu-programmer atmega32u4 erase && dfu-programmer atmega32u4 flash .build/planck_rev4_narze.hex` - Build with docker
- Planck Rev. 4 : `util/docker_build.sh planck/rev4:narze`
## TODO - Planck Light : `util/docker_build.sh planck/light:narze`
- [] Make SuperDuper mode fully-compatible in Windows by swapping GUI with Ctrl - Flash hex file
- Using dfu-programmer `dfu-programmer atmega32u4 erase --force && dfu-programmer atmega32u4 flash .build/planck_rev4_narze.hex`
- For Planck Light change the target microcontroller `dfu-programmer at90usb1286 erase --force && dfu-programmer at90usb1286 flash .build/planck_light_narze.hex`
- Use [QMK Toolbox](https://github.com/qmk/qmk_toolbox/releases)

View file

@ -1,23 +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) BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000)
MOUSEKEY_ENABLE = yes # Mouse keys(+4700)
EXTRAKEY_ENABLE = yes # Audio control and System control(+450) EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
CONSOLE_ENABLE = no # Console for debug(+400) CONSOLE_ENABLE = no # Console for debug(+400)
COMMAND_ENABLE = yes # Commands for debug and configuration 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 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 BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
MIDI_ENABLE = no # MIDI controls
AUDIO_ENABLE = no # Audio output on port C6
UNICODE_ENABLE = no # Unicode UNICODE_ENABLE = no # Unicode
BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight.
AUDIO_ENABLE = yes
# 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
COMBO_ENABLE = yes COMBO_ENABLE = yes
ifeq ($(strip $(KEYBOARD)), planck/rev4)
MOUSEKEY_ENABLE = no # Mouse keys(+4700)
MIDI_ENABLE = no
else
MOUSEKEY_ENABLE = yes
MIDI_ENABLE = yes
endif

1
users/narze/narze.c Normal file
View file

@ -0,0 +1 @@
#include "narze.h"

9
users/narze/narze.h Normal file
View file

@ -0,0 +1,9 @@
#pragma once
#include "quantum.h"
#include "eeconfig.h"
#include "keymap_colemak.h"
#ifdef COMBO_ENABLE
# include "superduper.h"
#endif

18
users/narze/readme.md Normal file
View file

@ -0,0 +1,18 @@
# TODO
- [ ] Make SuperDuper mode fully-compatible in Windows by swapping GUI with Ctrl
# LICENSE
Copyright 2019 Manassarn Manoonchai manassarn@gmail.com @narze
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/>.

5
users/narze/rules.mk Normal file
View file

@ -0,0 +1,5 @@
SRC += narze.c
ifeq ($(strip $(COMBO_ENABLE)), yes)
SRC += superduper.c
endif

66
users/narze/superduper.c Normal file
View file

@ -0,0 +1,66 @@
#include "superduper.h"
#include "eeconfig.h"
#include "eeprom.h"
#include "keymap_colemak.h"
// SuperDuper
#define SUPERDUPER_COMBO_COUNT 3
#define EECONFIG_SUPERDUPER_INDEX (uint8_t *) 19
enum process_combo_event {
CB_SUPERDUPER,
};
enum supported_layers {
_QWERTY,
_COLEMAK,
_QWOC
};
const uint16_t PROGMEM superduper_combos[SUPERDUPER_COMBO_COUNT][3] = {
[_QWERTY] = {KC_S, KC_D, COMBO_END},
[_COLEMAK] = {KC_R, KC_S, COMBO_END},
[_QWOC] = {CM_S, CM_D, COMBO_END},
};
combo_t key_combos[COMBO_COUNT] = {
[CB_SUPERDUPER] = COMBO_ACTION(superduper_combos[_QWERTY]),
};
volatile bool superduper_enabled = true;
const uint16_t PROGMEM empty_combo[] = {COMBO_END};
bool toggle_superduper_mode(void) {
superduper_enabled = !superduper_enabled;
if (superduper_enabled) {
set_superduper_key_combos();
} else {
clear_superduper_key_combos();
}
return superduper_enabled;
}
void set_superduper_key_combo_layer(uint16_t layer) {
key_combos[CB_SUPERDUPER].keys = superduper_combos[layer];
eeprom_update_byte(EECONFIG_SUPERDUPER_INDEX, layer);
}
void set_superduper_key_combos(void) {
uint8_t layer = eeprom_read_byte(EECONFIG_SUPERDUPER_INDEX);
switch (layer) {
case _QWERTY:
case _COLEMAK:
case _QWOC:
key_combos[CB_SUPERDUPER].keys = superduper_combos[layer];
break;
}
}
void clear_superduper_key_combos(void) {
key_combos[CB_SUPERDUPER].keys = empty_combo;
}

7
users/narze/superduper.h Normal file
View file

@ -0,0 +1,7 @@
#pragma once
#include "narze.h"
bool toggle_superduper_mode(void);
void set_superduper_key_combo_layer(uint16_t layer);
void set_superduper_key_combos(void);
void clear_superduper_key_combos(void);