aboutsummaryrefslogtreecommitdiffstats
path: root/users/issmirnov
diff options
context:
space:
mode:
authorIvan Smirnov <isgsmirnov@gmail.com>2019-11-08 19:17:21 -0800
committerJames Young <18669334+noroadsleft@users.noreply.github.com>2019-11-08 19:17:21 -0800
commit2b30776dd0f6dc6571fb741113bc71cea578b971 (patch)
tree9ad71df7d21d7bc75c42ad85d9bcbff136ec06b5 /users/issmirnov
parent5414ff709f2ab6f47b722a70aa2c4d18bed7c458 (diff)
downloadfirmware-2b30776dd0f6dc6571fb741113bc71cea578b971.tar.gz
firmware-2b30776dd0f6dc6571fb741113bc71cea578b971.tar.bz2
firmware-2b30776dd0f6dc6571fb741113bc71cea578b971.zip
[Keymap] Add issmirnov {user, ergodox, levinson} files. (#7239)
* Add issmirnov {user, ergodox, levinson} files. There are enough interesting QMK tricks in these layouts that it seems worth it to share with the broader community. Big thanks to Drashna for inspiration, as well as all the wonderful creators of QMK documentation. Some highlights: - Common layout shared between levinson and ergodox_ez - TAP_TOG macro for fast layer switching - Autogenerated keymaps ascii art with git hooks I will do my best to do periodic rolls here, but the source of truth will always be https://github.com/issmirnov/qmk-keebs * Incorporate review feedback. - Remove CLEAR_EEPROM in favor of built in EEP_RST - Remove custom handlers for audio on bootup and shutdown - Remove plethora of unneeded includes - Remove deprecated and dupliated config options HUGE thanks to drashna for the review! * Apply suggestions from code review Huge thanks to drashna@ for a very thorough review and the very useful suggestions. Co-Authored-By: Drashna Jaelre <drashna@live.com> * Remove unclear optimization This was an artifact from some other keymap I saw.
Diffstat (limited to 'users/issmirnov')
-rw-r--r--users/issmirnov/config.h45
-rw-r--r--users/issmirnov/issmirnov.c43
-rw-r--r--users/issmirnov/issmirnov.h35
-rw-r--r--users/issmirnov/rows.h55
-rw-r--r--users/issmirnov/rules.mk25
-rw-r--r--users/issmirnov/tap_tog.c52
-rw-r--r--users/issmirnov/tap_tog.h10
7 files changed, 265 insertions, 0 deletions
diff --git a/users/issmirnov/config.h b/users/issmirnov/config.h
new file mode 100644
index 000000000..664ebfe8a
--- /dev/null
+++ b/users/issmirnov/config.h
@@ -0,0 +1,45 @@
+#pragma once
+
+// Allows sending more than one key per scan. Useful for chords.
+#define QMK_KEYS_PER_SCAN 4
+
+// how long before a tap becomes a hold
+#undef TAPPING_TERM
+#define TAPPING_TERM 100
+
+// makes tap and hold keys work better for fast typers who don't want
+// tapping term set above 500
+#define PERMISSIVE_HOLD
+
+// tap anyway, even after TAPPING_TERM, if there was no other key
+// interruption between press and release
+#define RETRO_TAPPING
+
+// how many taps before triggering the toggle
+#undef ONESHOT_TAP_TOGGLE
+#define ONESHOT_TAP_TOGGLE 2
+
+// how long before oneshot modifier key times out (currently only shift)
+#undef ONESHOT_TIMEOUT
+#define ONESHOT_TIMEOUT 2000
+
+// Enable combos for vim
+#define COMBO_COUNT 5 // Specify the number of combos used. BE SURE TO INCREMENT AS NEEDED
+#define COMBO_TERM 50 // window in milliseconds to trigger combo
+
+// Allow more than 4 keys to be sent to the system. Useful for gaming.
+// #define FORCE_NKRO
+
+// Save 200 bytes on unused keycodes
+#undef LOCKING_SUPPORT_ENABLE
+#undef LOCKING_RESYNC_ENABLE
+
+// Enable HID_listen commands.
+#define NO_DEBUG
+#undef NO_PRINT
+#define USER_PRINT
+
+// Note: Defining the following does not have any impact on space:
+// - NO_ACTION_MACRO
+// - NO_ACTION_FUNCTION
+// - DISABLE_LEADER
diff --git a/users/issmirnov/issmirnov.c b/users/issmirnov/issmirnov.c
new file mode 100644
index 000000000..665afbcfd
--- /dev/null
+++ b/users/issmirnov/issmirnov.c
@@ -0,0 +1,43 @@
+#include "issmirnov.h"
+
+enum combo_events {
+ JK_ESC,
+ DF_CLN,
+ SD_SLASH,
+ XC_COPY,
+ XV_PASTE
+};
+
+
+const uint16_t PROGMEM jk_combo[] = {KC_J, KC_K, COMBO_END};
+const uint16_t PROGMEM df_combo[] = {KC_D, KC_F, COMBO_END};
+const uint16_t PROGMEM sd_combo[] = {KC_S, KC_D, COMBO_END};
+const uint16_t PROGMEM copy_combo[] = {KC_X, KC_C, COMBO_END};
+const uint16_t PROGMEM paste_combo[] = {KC_X, KC_V, COMBO_END};
+
+
+// BE SURE TO UPDATE THE CONFIG.H "COMBO_COUNT" value when you add elements here!
+combo_t key_combos[COMBO_COUNT] = {
+ COMBO(jk_combo, KC_ESC),
+ COMBO(df_combo, KC_COLON),
+ COMBO(sd_combo, KC_SLASH),
+ [XC_COPY] = COMBO_ACTION(copy_combo),
+ [XV_PASTE] = COMBO_ACTION(paste_combo),
+};
+
+
+void process_combo_event(uint8_t combo_index, bool pressed) {
+ switch(combo_index) {
+ case XC_COPY:
+ if (pressed) {
+ tap_code16(LCTL(KC_C));
+ }
+ break;
+
+ case XV_PASTE:
+ if (pressed) {
+ tap_code16(LCTL(KC_V));
+ }
+ break;
+ }
+}
diff --git a/users/issmirnov/issmirnov.h b/users/issmirnov/issmirnov.h
new file mode 100644
index 000000000..eef80dfc4
--- /dev/null
+++ b/users/issmirnov/issmirnov.h
@@ -0,0 +1,35 @@
+#pragma once
+
+#include QMK_KEYBOARD_H
+
+#include "rows.h"
+
+// 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 {
+ _QWERTY = 0,
+ _SYMB,
+ _NUMP,
+ _OVERWATCH,
+ _NAVI
+};
+
+enum custom_keycodes {
+ PLACEHOLDER = SAFE_RANGE,
+ TAP_TOG_LAYER,
+ CLEAR_EEPROM,
+ WKSP_LEFT, // Smart key that only activates when we are momentarily in a layer
+ WKSP_RIGHT, // Smart key that only activates when we are momentarily in a layer
+};
+
+
+#define LOWER MO(_SYMB)
+#define RAISE MO(_NUMP)
+
+#define CTL_SPC MT(MOD_LCTL, KC_SPC)
+#define OSMSFT OSM(MOD_LSFT)
+#define LOCK LGUI(KC_L)
+#define MODSFT LSFT(KC_LGUI)
+#define APPS LGUI(KC_SPC)
diff --git a/users/issmirnov/rows.h b/users/issmirnov/rows.h
new file mode 100644
index 000000000..d35af2175
--- /dev/null
+++ b/users/issmirnov/rows.h
@@ -0,0 +1,55 @@
+#pragma once
+
+#include QMK_KEYBOARD_H
+
+// This wrapper is required in order to expand the row macro inside the keymap configs.
+#define LAYOUT_ergodox_wrapper(...) LAYOUT_ergodox(__VA_ARGS__)
+#define LAYOUT_ortho_4x12_wrapper(...) LAYOUT_ortho_4x12(__VA_ARGS__)
+
+// Share common config. We'll skip the mod rows and func rows.
+// Note, it's also really neat the way the scoping works. Since we perform the expansion in the keymap.c file
+// so we can use our enums for custom keycodes
+#define _________________QWERTY_L1_________________ KC_Q , KC_W , KC_E , KC_R , KC_T
+#define _________________QWERTY_L2_________________ KC_A , KC_S , KC_D , KC_F , KC_G
+#define _________________QWERTY_L3_________________ KC_Z , KC_X , KC_C , KC_V , KC_B
+
+#define _________________QWERTY_R1_________________ KC_Y , KC_U , KC_I , KC_O , KC_P
+#define _________________QWERTY_R2_________________ KC_H , KC_J , KC_K , KC_L , TAP_TOG_LAYER
+#define _________________QWERTY_R3_________________ KC_N , KC_M , KC_DOT , KC_COMMA , TG(_NUMP)
+
+#define ___________________BLANK___________________ _______ , _______ , _______ , _______ , _______
+#define ___________________XXXXX___________________ XXXXXXX , XXXXXXX , XXXXXXX , XXXXXXX , XXXXXXX
+
+#define _________________SYMB_L1___________________ KC_MINS , KC_AT , KC_LCBR , KC_RCBR , KC_GRV
+#define _________________SYMB_L2___________________ KC_CIRC , KC_UNDS , KC_LPRN , KC_RPRN , KC_DLR
+#define _________________SYMB_L3___________________ KC_LABK , KC_RABK , KC_LBRACKET , KC_RBRACKET , KC_TILD
+
+#define _________________SYMB_R1___________________ KC_ASTR , KC_EXLM , KC_PIPE , KC_PERC , KC_PLUS
+#define _________________SYMB_R2___________________ KC_HASH , KC_EQL , KC_COLN , KC_SCLN , TAP_TOG_LAYER
+#define _________________SYMB_R3___________________ KC_AMPR , KC_QUES , KC_SLASH , KC_BSLASH , TG(_NUMP)
+
+
+#define _________________NUMP_L1___________________ KC_NO , KC_NO , LGUI(KC_UP) , XXXXXXX , XXXXXXX
+#define _________________NUMP_L2___________________ XXXXXXX , LGUI(KC_LEFT) , LGUI(KC_DOWN) , LGUI(KC_RIGHT) , XXXXXXX
+#define _________________NUMP_L3___________________ XXXXXXX , XXXXXXX , XXXXXXX , KC_AUDIO_VOL_DOWN , KC_AUDIO_VOL_UP
+
+#define _________________NUMP_R1___________________ KC_COMM , KC_7 , KC_8 , KC_9 , XXXXXXX
+#define _________________NUMP_R2___________________ KC_0 , KC_4 , KC_5 , KC_6 , TO(_SYMB)
+#define _________________NUMP_R3___________________ KC_DOT , KC_1 , KC_2 , KC_3 , TO(_QWERTY)
+
+// Note: These are 6x1 blocks, since modifiers are also adjusted.
+#define ______________OVERWATCH_L1_________________ KC_TAB , KC_Q , KC_W , KC_E , KC_R , KC_T
+#define ______________OVERWATCH_L2_________________ KC_LCTL , KC_A , KC_S , KC_D , KC_F , KC_P
+#define ______________OVERWATCH_L3_________________ KC_LSHIFT , KC_Z , KC_X , KC_C , KC_V , KC_GRAVE
+// Ergodox only has 5 keys on bottom row:
+#define ______________OVERWATCH_L4_________________ KC_LCTL , KC_F9 , KC_PSCREEN , KC_H , KC_R
+
+
+
+#define _________________NAVI_L1___________________ XXXXXXX , XXXXXXX , KC_UP , XXXXXXX , XXXXXXX
+#define _________________NAVI_L2___________________ XXXXXXX , KC_LEFT , KC_DOWN , KC_RGHT , XXXXXXX
+#define _________________NAVI_L3___________________ XXXXXXX , XXXXXXX , XXXXXXX , XXXXXXX , XXXXXXX
+
+#define _________________NAVI_R1___________________ XXXXXXX , XXXXXXX , XXXXXXX , XXXXXXX , XXXXXXX
+#define _________________NAVI_R2___________________ XXXXXXX , KC_LCTL , XXXXXXX , XXXXXXX , XXXXXXX
+#define _________________NAVI_R3___________________ XXXXXXX , XXXXXXX , XXXXXXX , XXXXXXX , XXXXXXX
diff --git a/users/issmirnov/rules.mk b/users/issmirnov/rules.mk
new file mode 100644
index 000000000..096d7b4c0
--- /dev/null
+++ b/users/issmirnov/rules.mk
@@ -0,0 +1,25 @@
+
+SRC += tap_tog.c
+SRC += issmirnov.c
+
+# https://www.reddit.com/r/olkb/comments/bmpgjm/programming_help/
+# Should shave 2000 bytes
+LINK_TIME_OPTIMIZATION_ENABLE = yes
+
+# Enable debugging only when needed.
+CONSOLE_ENABLE = yes # +400 bytes (hid_listen support)
+
+# Enable combo keys for vim usage.
+# https://github.com/qmk/qmk_firmware/blob/master/docs/feature_combo.md
+COMBO_ENABLE = yes
+
+# This allows the keyboard to tell the host OS that up to 248 keys are held down at once
+NKRO_ENABLE = no # note: also needs FORCE_NKRO in config.h
+
+# Disable unused features to save on space
+# https://thomasbaart.nl/2018/12/01/reducing-firmware-size-in-qmk/
+MOUSEKEY_ENABLE = no # 2000 bytes
+BOOTMAGIC_ENABLE = no
+COMMAND_ENABLE = no # https://beta.docs.qmk.fm/features/feature_command
+UNICODE_ENABLE = no # Unicode
+SWAP_HANDS_ENABLE = no # Allow swapping hands of keyboard
diff --git a/users/issmirnov/tap_tog.c b/users/issmirnov/tap_tog.c
new file mode 100644
index 000000000..02cea08b1
--- /dev/null
+++ b/users/issmirnov/tap_tog.c
@@ -0,0 +1,52 @@
+#include QMK_KEYBOARD_H
+
+#include "tap_tog.h"
+
+bool tap_tog_layer_other_key_pressed = false;
+bool tap_tog_layer_toggled_on = false;
+uint8_t tap_tog_count = 0;
+
+void process_tap_tog(uint8_t layer, keyrecord_t *record) {
+ tap_tog_count++;
+ // press
+ if (record->event.pressed) {
+
+ // TTL has already been pressed and we are toggled into that layer
+ // so now we need to leave
+ if(tap_tog_layer_toggled_on) {
+ layer_clear();
+ tap_tog_layer_toggled_on = false;
+ }
+
+ // this means we're in our default layer
+ // so switch the layer immediately
+ // whether we'll switch back when it's released depends on if a button gets pressed while this is held down
+ else {
+ // switch layer
+ layer_on(layer);
+ tap_tog_layer_other_key_pressed = false; // if this becomes true before it gets released, it will act as a held modifier
+ }
+ }
+
+ // release
+ else {
+ // if it was used as a held modifier (like traditional shift)
+ if(tap_tog_layer_other_key_pressed) {
+ // switch layer back
+ layer_clear();
+ }
+ // if it was used as a toggle button
+ else {
+ // next time, it will turn layer off
+ tap_tog_layer_toggled_on = true;
+
+ // If it's been tapped twice, reset the toggle flag.
+ // Otherwise, we get stuck oscillating between this code block and the
+ // pressed && TTL_toggled_on block.
+ if (tap_tog_count >= 4 ) {
+ tap_tog_count = 0;
+ tap_tog_layer_toggled_on = false;
+ }
+ }
+ }
+}
diff --git a/users/issmirnov/tap_tog.h b/users/issmirnov/tap_tog.h
new file mode 100644
index 000000000..f59711f04
--- /dev/null
+++ b/users/issmirnov/tap_tog.h
@@ -0,0 +1,10 @@
+#pragma once
+
+#include "issmirnov.h"
+
+extern bool tap_tog_layer_other_key_pressed; // set to true if any key pressed while TAP_TOG_LAYER held down
+extern bool tap_tog_layer_toggled_on; // will become true if no keys are pressed while TTL held down
+extern uint8_t tap_tog_count; // number of presses on TAP_TOG_LAYER button.
+
+// Tap dance analog with momentary toggle when held, switch when tapped
+void process_tap_tog(uint8_t layer, keyrecord_t *record);