diff options
author | William Chang <william@factual.com> | 2019-07-13 10:18:33 -0700 |
---|---|---|
committer | William Chang <william@factual.com> | 2019-07-13 10:18:33 -0700 |
commit | 71493b2f9bbd5f3d18373c518fa14ccafcbf48fc (patch) | |
tree | 3bb3e5e496621535611e087720aa5c4d7a533e5e /users | |
parent | 86ad4988fe7ff64916127509d84f44c56fa097aa (diff) | |
parent | da1f05fbc19477c05c0c01bb07fabfaf1ece9d54 (diff) | |
download | firmware-71493b2f9bbd5f3d18373c518fa14ccafcbf48fc.tar.gz firmware-71493b2f9bbd5f3d18373c518fa14ccafcbf48fc.tar.bz2 firmware-71493b2f9bbd5f3d18373c518fa14ccafcbf48fc.zip |
Merge branch 'master' of https://github.com/qmk/qmk_firmware
Diffstat (limited to 'users')
60 files changed, 1962 insertions, 284 deletions
diff --git a/users/333fred/333fred.c b/users/333fred/333fred.c index 3b2b36d02..79df8c4de 100644 --- a/users/333fred/333fred.c +++ b/users/333fred/333fred.c @@ -86,31 +86,37 @@ qk_tap_dance_action_t tap_dance_actions[] = { [TD_COPY_PASTE] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, tap_dance_copy_paste_finished, NULL) }; -void tap_dance_process_record(uint16_t keycode) { +void tap_dance_process_keycode(uint16_t keycode) { if (tap_dance_state == SINGLE_TAP && keycode != TD(TD_SYM_VIM)) { tap_dance_active = false; } } __attribute__ ((weak)) -void matrix_init_rgb(void) {} - -__attribute__ ((weak)) void layer_state_set_rgb(uint32_t state) {} -__attribute__ ((weak)) -void matrix_scan_user_keyboard(void) {} - -void matrix_scan_user() { - static bool first_run = true; - if (first_run) { - first_run = false; - matrix_init_rgb(); - } - matrix_scan_user_keyboard(); -} - uint32_t layer_state_set_user(uint32_t state) { layer_state_set_rgb(state); return state; } + +bool try_handle_macro(uint16_t keycode, keyrecord_t *record) { + switch (keycode) + { + case DLEFT: + if (record->event.pressed) + SEND_STRING(SS_LGUI(SS_LALT(SS_TAP(X_LEFT)))); + return true; + case DRIGHT: + if (record->event.pressed) + SEND_STRING(SS_LGUI(SS_LALT(SS_TAP(X_RIGHT)))); + return true; + case PSCREEN_APP: + if (record->event.pressed) + SEND_STRING(SS_LALT(SS_TAP(X_PSCREEN))); + return true; + + default: + return false; + } +} diff --git a/users/333fred/333fred.h b/users/333fred/333fred.h index 0e6c6a196..716b61a25 100644 --- a/users/333fred/333fred.h +++ b/users/333fred/333fred.h @@ -1,6 +1,7 @@ #pragma once #include "quantum.h" +#include "layout_macros.h" #define BASE 0 #define CODE 1 // code layer @@ -17,6 +18,13 @@ enum tap_dance_declarations { TD_COPY_PASTE, }; +enum custom_keys { + DLEFT = SAFE_RANGE, + DRIGHT, + PSCREEN_APP +}; + void tap_dance_sym_vim_finished(qk_tap_dance_state_t*, void*); void tap_dance_sym_vim_reset(qk_tap_dance_state_t*, void*); -void tap_dance_process_record(uint16_t); +void tap_dance_process_keycode(uint16_t); +bool try_handle_macro(uint16_t keycode, keyrecord_t *record); diff --git a/users/333fred/333fred_config.h b/users/333fred/333fred_config.h index b158e2d5a..c099072fc 100644 --- a/users/333fred/333fred_config.h +++ b/users/333fred/333fred_config.h @@ -1,3 +1,4 @@ #pragma once #define PERMISSIVE_HOLD +#define NO_ACTION_MACRO diff --git a/users/333fred/layout_macros.h b/users/333fred/layout_macros.h new file mode 100644 index 000000000..3b163f6ce --- /dev/null +++ b/users/333fred/layout_macros.h @@ -0,0 +1,44 @@ +#pragma once + +#define SIX_TRNS _______, _______, _______, _______, _______, _______ +#define FOUR_TRNS _______, _______, _______, _______ + +// Row 5: 6 keys +#define ROW5_LEFT_BASE KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5 +#define ROW5_RGHT_BASE KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS +#define ROW5_LEFT_SYMB _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5 +#define ROW5_RGHT_SYMB KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11 +#define ROW5_LEFT_VIM SIX_TRNS +#define ROW5_RGHT_VIM SIX_TRNS + +// Row 4: 6 keys +#define ROW4_LEFT_BASE KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T +#define ROW4_RGHT_BASE KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLS +#define ROW4_LEFT_SYMB _______, KC_EXLM, KC_AT, KC_LPRN, KC_RPRN, KC_PIPE +#define ROW4_RGHT_SYMB KC_UP, KC_7, KC_8, KC_9, KC_ASTR, KC_F12 +#define ROW4_LEFT_VIM SIX_TRNS +#define ROW4_RGHT_VIM SIX_TRNS + +// Row 3: 6 keys +#define ROW3_LEFT_BASE CTL_T(KC_ESC), KC_A, KC_S, KC_D, KC_F, KC_G +#define ROW3_RGHT_BASE KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT +#define ROW3_LEFT_SYMB _______, KC_HASH, KC_DLR, KC_LCBR, KC_RCBR, KC_GRV +#define ROW3_RGHT_SYMB KC_DOWN, KC_4, KC_5, KC_6, KC_PLUS, _______ +#define ROW3_LEFT_VIM _______, DLEFT, DRIGHT, KC_LCTL, KC_LGUI, _______ +#define ROW3_RGHT_VIM KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT, _______, _______ + +// Row 2: 6 keys +#define ROW2_LEFT_BASE OSM(MOD_LSFT), CTL_T(KC_Z), KC_X, KC_C, KC_V, KC_B +#define ROW2_RGHT_BASE KC_N, KC_M, KC_COMM, KC_DOT, CTL_T(KC_SLSH), OSM(MOD_RSFT) +#define ROW2_LEFT_SYMB _______, KC_PERC, KC_CIRC, KC_LBRC, KC_RBRC, KC_TILD +#define ROW2_RGHT_SYMB KC_AMPR, KC_1, KC_2, KC_3, KC_BSLS, _______ +#define ROW2_LEFT_VIM _______, _______, KC_TAB, _______, _______, _______ +#define ROW2_RGHT_VIM SIX_TRNS + +// Row 1: 4 keys +#define ROW1_LEFT_BASE OSM(MOD_LCTL), KC_F4, KC_F5, KC_LALT +#define ROW1_RGHT_BASE KC_DOWN, KC_EQL, KC_RIGHT, KC_RGUI +#define ROW1_LEFT_SYMB _______, _______, _______, _______ +#define ROW1_RGHT_SYMB KC_0, KC_DOT, KC_EQL, _______ +#define ROW1_LEFT_VIM FOUR_TRNS +#define ROW1_RGHT_VIM FOUR_TRNS diff --git a/users/333fred/rgb.c b/users/333fred/rgb.c index a3dfd905c..c86cd1c77 100644 --- a/users/333fred/rgb.c +++ b/users/333fred/rgb.c @@ -1,24 +1,19 @@ #include "quantum.h" #include "333fred.h" -void matrix_init_rgb(void) { - rgblight_enable_noeeprom(); - rgblight_sethsv_noeeprom(270, 255, 20); -} - void layer_state_set_rgb(uint32_t state) { switch (biton32(state)) { case BASE: // purple - rgblight_sethsv_noeeprom(270, 255, 20); + rgblight_sethsv_noeeprom(210, 255, 20); break; case SYMB: // blue - rgblight_sethsv_noeeprom(240, 255, 20); + rgblight_sethsv_noeeprom(191, 255, 20); break; case VIM: // green - rgblight_sethsv_noeeprom(120, 255, 20); + rgblight_sethsv_noeeprom(85, 255, 20); break; case GAME: // red @@ -26,3 +21,8 @@ void layer_state_set_rgb(uint32_t state) { break; } } + +void keyboard_post_init_user(void) { + rgblight_enable_noeeprom(); + layer_state_set_rgb(1); // Set layer 0 (bit 1) on +} diff --git a/users/bcat/config.h b/users/bcat/config.h new file mode 100644 index 000000000..7d4200895 --- /dev/null +++ b/users/bcat/config.h @@ -0,0 +1,36 @@ +/* Delay between tap_code register and unregister to fix flaky media keys. */ +#undef TAP_CODE_DELAY + +#define TAP_CODE_DELAY 10 + +/* Turn off RGB lighting when the host goes to sleep. */ +#define RGBLIGHT_SLEEP + +/* Keep backlight and RGB level increments consistent across keyboards. */ +#undef BACKLIGHT_LEVELS +#undef RGBLIGHT_HUE_STEP +#undef RGBLIGHT_SAT_STEP +#undef RGBLIGHT_VAL_STEP + +#define BACKLIGHT_LEVELS 7 +#define RGBLIGHT_HUE_STEP 8 +#define RGBLIGHT_SAT_STEP 17 +#define RGBLIGHT_VAL_STEP 17 + +/* Make mouse operation smoother. */ +#undef MOUSEKEY_DELAY +#undef MOUSEKEY_INTERVAL + +#define MOUSEKEY_DELAY 0 +#define MOUSEKEY_INTERVAL 16 + +/* Lower mouse speed to adjust for reduced MOUSEKEY_INTERVAL. */ +#undef MOUSEKEY_MAX_SPEED +#undef MOUSEKEY_TIME_TO_MAX +#undef MOUSEKEY_WHEEL_MAX_SPEED +#undef MOUSEKEY_WHEEL_TIME_TO_MAX + +#define MOUSEKEY_MAX_SPEED 7 +#define MOUSEKEY_TIME_TO_MAX 150 +#define MOUSEKEY_WHEEL_MAX_SPEED 3 +#define MOUSEKEY_WHEEL_TIME_TO_MAX 150 diff --git a/users/bcat/rules.mk b/users/bcat/rules.mk new file mode 100644 index 000000000..59f82709a --- /dev/null +++ b/users/bcat/rules.mk @@ -0,0 +1,11 @@ +# Enable Bootmagic Lite to consistently reset to bootloader and clear EEPROM. +BOOTMAGIC_ENABLE = lite + +# Enable mouse and media keys on all keyboards. +MOUSEKEY_ENABLE = yes +EXTRAKEY_ENABLE = yes + +# Disable some unwanted features on all keyboards. +CONSOLE_ENABLE = no +COMMAND_ENABLE = no +NKRO_ENABLE = no diff --git a/users/drashna/drashna.c b/users/drashna/drashna.c index 7c60a2e4a..acc6b9f9e 100644 --- a/users/drashna/drashna.c +++ b/users/drashna/drashna.c @@ -187,13 +187,13 @@ void matrix_scan_user(void) { __attribute__ ((weak)) -uint32_t layer_state_set_keymap (uint32_t state) { +layer_state_t layer_state_set_keymap (layer_state_t state) { return state; } // on layer change, no matter where the change was initiated // Then runs keymap's layer change check -uint32_t layer_state_set_user(uint32_t state) { +layer_state_t layer_state_set_user(layer_state_t state) { state = update_tri_layer_state(state, _RAISE, _LOWER, _ADJUST); #ifdef RGBLIGHT_ENABLE state = layer_state_set_rgb(state); @@ -203,12 +203,12 @@ uint32_t layer_state_set_user(uint32_t state) { __attribute__ ((weak)) -uint32_t default_layer_state_set_keymap (uint32_t state) { +layer_state_t default_layer_state_set_keymap (layer_state_t state) { return state; } // Runs state check and changes underglow color and animation -uint32_t default_layer_state_set_user(uint32_t state) { +layer_state_t default_layer_state_set_user(layer_state_t state) { state = default_layer_state_set_keymap(state); #if 0 #ifdef RGBLIGHT_ENABLE diff --git a/users/drashna/drashna.h b/users/drashna/drashna.h index 5df67792a..507504f04 100644 --- a/users/drashna/drashna.h +++ b/users/drashna/drashna.h @@ -67,8 +67,8 @@ void shutdown_keymap(void); void suspend_power_down_keymap(void); void suspend_wakeup_init_keymap(void); void matrix_scan_keymap(void); -uint32_t layer_state_set_keymap (uint32_t state); -uint32_t default_layer_state_set_keymap (uint32_t state); +layer_state_t layer_state_set_keymap (layer_state_t state); +layer_state_t default_layer_state_set_keymap (layer_state_t state); void led_set_keymap(uint8_t usb_led); void eeconfig_init_keymap(void); diff --git a/users/drashna/process_records.c b/users/drashna/process_records.c index a5487b585..770219917 100644 --- a/users/drashna/process_records.c +++ b/users/drashna/process_records.c @@ -39,22 +39,26 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { clear_mods(); clear_oneshot_mods(); send_string_with_delay_P(PSTR("make " QMK_KEYBOARD ":" QMK_KEYMAP), TAP_CODE_DELAY); #ifndef MAKE_BOOTLOADER - if ( ( temp_mod | temp_osm ) & MOD_MASK_SHIFT ) + if ( ( temp_mod | temp_osm ) & MOD_MASK_SHIFT ) +#endif + { + #if defined(__arm__) + send_string_with_delay_P(PSTR(":dfu-util"), TAP_CODE_DELAY); + #elif defined(BOOTLOADER_DFU) + send_string_with_delay_P(PSTR(":dfu"), TAP_CODE_DELAY); + #elif defined(BOOTLOADER_HALFKAY) + send_string_with_delay_P(PSTR(":teensy"), TAP_CODE_DELAY); + #elif defined(BOOTLOADER_CATERINA) + send_string_with_delay_P(PSTR(":avrdude"), TAP_CODE_DELAY); + #endif // bootloader options + } + if ( ( temp_mod | temp_osm ) & MOD_MASK_CTRL) { send_string_with_delay_P(PSTR(" -j8 --output-sync"), TAP_CODE_DELAY); } +#ifdef RGB_MATRIX_SPLIT_RIGHT + send_string_with_delay_P(PSTR(" RGB_MATRIX_SPLIT_RIGHT=yes OLED_DRIVER_ENABLE=no"), TAP_CODE_DELAY); #endif - { - #if defined(__arm__) - send_string_with_delay_P(PSTR(":dfu-util"), TAP_CODE_DELAY); - #elif defined(BOOTLOADER_DFU) - send_string_with_delay_P(PSTR(":dfu"), TAP_CODE_DELAY); - #elif defined(BOOTLOADER_HALFKAY) - send_string_with_delay_P(PSTR(":teensy"), TAP_CODE_DELAY); - #elif defined(BOOTLOADER_CATERINA) - send_string_with_delay_P(PSTR(":avrdude"), TAP_CODE_DELAY); - #endif // bootloader options - } - if ( ( temp_mod | temp_osm ) & MOD_MASK_CTRL) { send_string_with_delay_P(PSTR(" -j8 --output-sync"), TAP_CODE_DELAY); } send_string_with_delay_P(PSTR(SS_TAP(X_ENTER)), TAP_CODE_DELAY); } + break; case VRSN: // Prints firmware version diff --git a/users/drashna/rgb_stuff.c b/users/drashna/rgb_stuff.c index 38e86ae0e..7d364fa68 100644 --- a/users/drashna/rgb_stuff.c +++ b/users/drashna/rgb_stuff.c @@ -5,8 +5,6 @@ #if defined(RGBLIGHT_ENABLE) extern rgblight_config_t rgblight_config; bool has_initialized; -#elif defined(RGB_MATRIX_ENABLE) -extern rgb_config_t rgb_matrix_config; #endif #ifdef RGBLIGHT_ENABLE @@ -277,7 +275,7 @@ void matrix_scan_rgb(void) { } -uint32_t layer_state_set_rgb(uint32_t state) { +layer_state_t layer_state_set_rgb(layer_state_t state) { #ifdef RGBLIGHT_ENABLE if (userspace_config.rgb_layer_change) { switch (biton32(state)) { @@ -336,3 +334,14 @@ uint32_t layer_state_set_rgb(uint32_t state) { return state; } + +#ifdef RGB_MATRIX_ENABLE +extern led_config_t g_led_config; +void rgb_matrix_layer_helper (uint8_t red, uint8_t green, uint8_t blue, uint8_t led_type) { + for (int i = 0; i < DRIVER_LED_TOTAL; i++) { + if (HAS_FLAGS(g_led_config.flags[i], led_type)) { + rgb_matrix_set_color( i, red, green, blue ); + } + } +} +#endif diff --git a/users/drashna/rgb_stuff.h b/users/drashna/rgb_stuff.h index 886f20ffc..f5bbd0f3b 100644 --- a/users/drashna/rgb_stuff.h +++ b/users/drashna/rgb_stuff.h @@ -15,7 +15,9 @@ bool process_record_user_rgb(uint16_t keycode, keyrecord_t *record); void scan_rgblight_fadeout(void); void keyboard_post_init_rgb(void); void matrix_scan_rgb(void); -uint32_t layer_state_set_rgb(uint32_t state); -uint32_t default_layer_state_set_rgb(uint32_t state); +layer_state_t layer_state_set_rgb(layer_state_t state); +layer_state_t default_layer_state_set_rgb(layer_state_t state); void rgblight_sethsv_default_helper(uint8_t index); void rgb_matrix_set_color_all( uint8_t red, uint8_t green, uint8_t blue ); + +void rgb_matrix_layer_helper (uint8_t red, uint8_t green, uint8_t blue, uint8_t led_type); diff --git a/users/drashna/rules.mk b/users/drashna/rules.mk index 085840f1c..cdb9e5436 100644 --- a/users/drashna/rules.mk +++ b/users/drashna/rules.mk @@ -33,6 +33,7 @@ ifeq ($(strip $(RGBLIGHT_ENABLE)), yes) endif endif +RGB_MATRIX_ENABLE ?= no ifneq ($(strip $(RGB_MATRIX_ENABLE)), no) SRC += rgb_stuff.c endif diff --git a/users/drashna/template.c b/users/drashna/template.c index 0e188f3a5..d90e6bdec 100644 --- a/users/drashna/template.c +++ b/users/drashna/template.c @@ -62,11 +62,11 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { __attribute__ ((weak)) -uint32_t layer_state_set_keymap (uint32_t state) { +layer_state_t layer_state_set_keymap (layer_state_t state) { return state; } -uint32_t layer_state_set_user (uint32_t state) { +layer_state_t layer_state_set_user (layer_state_t state) { return layer_state_set_keymap (state); } diff --git a/users/konstantin/config.h b/users/konstantin/config.h index 4ca19f824..4edab2baa 100644 --- a/users/konstantin/config.h +++ b/users/konstantin/config.h @@ -14,8 +14,9 @@ #define NO_ACTION_ONESHOT #define PERMISSIVE_HOLD -#define TAPPING_TERM 200 -#define TAPPING_TOGGLE 2 +#define TAPPING_TERM 200 +#define TAPPING_TOGGLE 2 +#define TAP_HOLD_CAPS_DELAY 50 #define UNICODE_CYCLE_PERSIST false #define UNICODE_SELECTED_MODES UC_WINC, UC_WIN, UC_LNX diff --git a/users/konstantin/rgb.c b/users/konstantin/rgb.c index 0f0c73c49..a96cad019 100644 --- a/users/konstantin/rgb.c +++ b/users/konstantin/rgb.c @@ -1,24 +1,25 @@ #include "rgb.h" #ifdef RGBLIGHT_EFFECT_BREATHING -const uint8_t RGBLED_BREATHING_INTERVALS[] PROGMEM = {20, 30, 5, 10}; +const uint8_t PROGMEM RGBLED_BREATHING_INTERVALS[] = { 20, 30, 5, 10 }; #endif #ifdef RGBLIGHT_EFFECT_RAINBOW_MOOD -const uint8_t RGBLED_RAINBOW_MOOD_INTERVALS[] PROGMEM = {20, 50, 100}; +const uint8_t PROGMEM RGBLED_RAINBOW_MOOD_INTERVALS[] = { 20, 50, 100 }; #endif #ifdef RGBLIGHT_EFFECT_RAINBOW_SWIRL -const uint8_t RGBLED_RAINBOW_SWIRL_INTERVALS[] PROGMEM = {20, 50, 100}; +const uint8_t PROGMEM RGBLED_RAINBOW_SWIRL_INTERVALS[] = { 20, 50, 100 }; #endif #ifdef RGBLIGHT_EFFECT_SNAKE -const uint8_t RGBLED_SNAKE_INTERVALS[] PROGMEM = {20, 50, 100}; +const uint8_t PROGMEM RGBLED_SNAKE_INTERVALS[] = { 20, 50, 100 }; #endif #ifdef RGBLIGHT_EFFECT_KNIGHT -const uint8_t RGBLED_KNIGHT_INTERVALS[] PROGMEM = {20, 50, 100}; +const uint8_t PROGMEM RGBLED_KNIGHT_INTERVALS[] = { 20, 50, 100 }; #endif -const hsv_t GODSPEED_BLUE = { .h = 280, .s = 68, .v = RGBLIGHT_LIMIT_VAL }; -const hsv_t GODSPEED_YELLOW = { .h = 38, .s = 153, .v = RGBLIGHT_LIMIT_VAL }; +const HSV GODSPEED_BLUE = { .h = 198, .s = 68, .v = 255 }; +const HSV GODSPEED_YELLOW = { .h = 27, .s = 153, .v = 255 }; +const HSV MODERN_DOLCH_RED = { .h = 252, .s = 255, .v = 144 }; diff --git a/users/konstantin/rgb.h b/users/konstantin/rgb.h index aed855aa0..36a9d9cd7 100644 --- a/users/konstantin/rgb.h +++ b/users/konstantin/rgb.h @@ -2,17 +2,6 @@ #include "quantum.h" -typedef struct { - uint16_t h; // 0–360 - uint8_t s; // 0–255 - uint8_t v; // 0–255 -} hsv_t; - -typedef struct { - uint8_t r; // 0–255 - uint8_t g; // 0–255 - uint8_t b; // 0–255 -} rgb_t; - -extern const hsv_t GODSPEED_BLUE; -extern const hsv_t GODSPEED_YELLOW; +extern const HSV GODSPEED_BLUE; +extern const HSV GODSPEED_YELLOW; +extern const HSV MODERN_DOLCH_RED; diff --git a/users/konstantin/tap_dance.c b/users/konstantin/tap_dance.c index fa43288ce..ba1453fc0 100644 --- a/users/konstantin/tap_dance.c +++ b/users/konstantin/tap_dance.c @@ -110,6 +110,7 @@ qk_tap_dance_action_t tap_dance_actions[] = { [TD_RAL_LAL] = ACTION_TAP_DANCE_DOUBLE_MOD(KC_RALT, KC_LALT), [TD_RAL_RGU] = ACTION_TAP_DANCE_DOUBLE_MOD(KC_RALT, KC_RGUI), [TD_RCT_RSF] = ACTION_TAP_DANCE_DOUBLE_MOD(KC_RCTL, KC_RSFT), + [TD_RSF_RCT] = ACTION_TAP_DANCE_DOUBLE_MOD(KC_RSFT, KC_RCTL), [TD_LSFT_FN] = ACTION_TAP_DANCE_MOD_LAYER(KC_LSFT, L_FN), [TD_RCTL_FN] = ACTION_TAP_DANCE_MOD_LAYER(KC_RCTL, L_FN), diff --git a/users/konstantin/tap_dance.h b/users/konstantin/tap_dance.h index 13d682a60..d2f00c8cb 100644 --- a/users/konstantin/tap_dance.h +++ b/users/konstantin/tap_dance.h @@ -7,6 +7,7 @@ #define RAL_LAL TD(TD_RAL_LAL) #define RAL_RGU TD(TD_RAL_RGU) #define RCT_RSF TD(TD_RCT_RSF) +#define RSF_RCT TD(TD_RSF_RCT) #define LSFT_FN TD(TD_LSFT_FN) #define RCTL_FN TD(TD_RCTL_FN) @@ -18,6 +19,7 @@ enum tap_dance { TD_RAL_LAL, TD_RAL_RGU, TD_RCT_RSF, + TD_RSF_RCT, TD_LSFT_FN, TD_RCTL_FN, diff --git a/users/kuatsure/kuatsure.c b/users/kuatsure/kuatsure.c index a18713626..f935e83c7 100644 --- a/users/kuatsure/kuatsure.c +++ b/users/kuatsure/kuatsure.c @@ -1,35 +1,62 @@ #include "kuatsure.h" +#include "version.h" -void tmux_prefix(void) { - register_code(KC_LCTL); - register_code(KC_SPC); +qk_tap_dance_action_t tap_dance_actions[] = { + [TD_LBRC] = ACTION_TAP_DANCE_DOUBLE(KC_LBRC, KC_LT), + [TD_RBRC] = ACTION_TAP_DANCE_DOUBLE(KC_RBRC, KC_GT) +}; - unregister_code(KC_LCTL); - unregister_code(KC_SPC); +__attribute__ ((weak)) +bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { + return true; } -void tmux_pane_zoom(void) { - tmux_prefix(); +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case KB_MAKE: + if (!record->event.pressed) { + SEND_STRING("make " QMK_KEYBOARD ":" QMK_KEYMAP SS_TAP(X_ENTER)); + } + return false; + break; + + case KB_VRSN: + if (!record->event.pressed) { + SEND_STRING(QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION); + } + return false; + break; + + case KB_FLSH: + if (!record->event.pressed) { + SEND_STRING("make " QMK_KEYBOARD ":" QMK_KEYMAP + #if (defined(BOOTLOADER_DFU) || defined(BOOTLOADER_LUFA_DFU) || defined(BOOTLOADER_QMK_DFU)) + ":dfu " + #elif defined(BOOTLOADER_HALFKAY) + ":teensy " + #elif defined(BOOTLOADER_CATERINA) + ":avrdude " + #endif + SS_TAP(X_ENTER) + ); + + reset_keyboard(); + } + return false; + break; + } - register_code(KC_Z); - unregister_code(KC_Z); + return process_record_keymap(keycode, record); } -void tmux_pane_switch(uint16_t keycode) { - tmux_prefix(); - - register_code(KC_Q); - unregister_code(KC_Q); - - register_code(keycode); - unregister_code(keycode); +void tmux_prefix(void) { + tap_code16(LCTL(KC_SPC)); } -void tmux_window_switch(uint16_t keycode) { +void tmux_pane_zoom(void) { tmux_prefix(); - register_code(keycode); - unregister_code(keycode); + SEND_STRING("z"); } LEADER_EXTERNS(); @@ -43,69 +70,70 @@ void matrix_scan_user(void) { // anything you can do in a macro https://docs.qmk.fm/macros.html // https://docs.qmk.fm/feature_leader_key.html + // Stop music and lock computer via alfred + SEQ_ONE_KEY(KC_H) { + SEND_STRING(SS_LGUI(" ") SS_TAP(X_LGUI) "afk" SS_TAP(X_ENTER)); + } + + // Stop music and lock computer via alfred + SEQ_TWO_KEYS(KC_H, KC_H) { + SEND_STRING(SS_LGUI(" ") SS_TAP(X_LGUI) "afk" SS_TAP(X_ENTER) SS_TAP(X_MEDIA_PLAY_PAUSE)); + } + // Whole Screen Shot SEQ_ONE_KEY(KC_A) { - register_code(KC_LGUI); - register_code(KC_LSFT); - register_code(KC_3); - - unregister_code(KC_3); - unregister_code(KC_LSFT); - unregister_code(KC_LGUI); + SEND_STRING(SS_LGUI(SS_LSFT("3"))); } // Selective Screen Shot SEQ_ONE_KEY(KC_S) { - register_code(KC_LGUI); - register_code(KC_LSFT); - register_code(KC_4); - - unregister_code(KC_4); - unregister_code(KC_LSFT); - unregister_code(KC_LGUI); + SEND_STRING(SS_LGUI(SS_LSFT("4"))); } // TMUX - shift to pane 1 and zoom SEQ_ONE_KEY(KC_J) { - tmux_pane_switch(KC_1); + tmux_prefix(); + SEND_STRING("q1"); tmux_pane_zoom(); } + // TMUX - shift to first window + SEQ_TWO_KEYS(KC_J, KC_J) { + tmux_prefix(); + SEND_STRING("1"); + } + // TMUX - shift to pane 2 and zoom SEQ_ONE_KEY(KC_K) { - tmux_pane_switch(KC_2); + tmux_prefix(); + SEND_STRING("q2"); tmux_pane_zoom(); } + // TMUX - shift to second window + SEQ_TWO_KEYS(KC_K, KC_K) { + tmux_prefix(); + SEND_STRING("2"); + } + // TMUX - shift to pane 3 and zoom SEQ_ONE_KEY(KC_L) { - tmux_pane_switch(KC_3); + tmux_prefix(); + SEND_STRING("q3"); tmux_pane_zoom(); } + // TMUX - shift to third window + SEQ_TWO_KEYS(KC_L, KC_L) { + tmux_prefix(); + SEND_STRING("3"); + } + // TMUX - shift to last pane and zoom SEQ_ONE_KEY(KC_SCOLON) { tmux_prefix(); - - register_code(KC_SCOLON); - unregister_code(KC_SCOLON); - + SEND_STRING(";"); tmux_pane_zoom(); } - - // TMUX - shift to first window - SEQ_ONE_KEY(KC_U) { - tmux_window_switch(KC_1); - } - - // TMUX - shift to second window - SEQ_ONE_KEY(KC_I) { - tmux_window_switch(KC_2); - } - - // TMUX - shift to third window - SEQ_ONE_KEY(KC_O) { - tmux_window_switch(KC_3); - } } } diff --git a/users/kuatsure/kuatsure.h b/users/kuatsure/kuatsure.h index 23d3c617c..8961d5621 100644 --- a/users/kuatsure/kuatsure.h +++ b/users/kuatsure/kuatsure.h @@ -3,12 +3,32 @@ #include "quantum.h" +enum kuatsure_keycodes { + KB_MAKE = SAFE_RANGE, + KB_FLSH, + KB_VRSN, + + USER_SAFE_RANGE, +}; + +enum { + TD_LBRC = 0, + TD_RBRC, +}; + +#define KT_LBRC TD(TD_LBRC) +#define KT_RBRC TD(TD_RBRC) + +#define TAPPING_TERM 200 + +#define LEADER_TIMEOUT 250 +#define LEADER_PER_KEY_TIMING + void tmux_prefix(void); void tmux_pane_zoom(void); -void tmux_pane_switch(uint16_t keycode); -void tmux_window_switch(uint16_t keycode); #define KT_CESC CTL_T(KC_ESC) +#define KT_MTAB MEH_T(KC_TAB) #undef LEADER_TIMEOUT #define LEADER_TIMEOUT 300 @@ -18,6 +38,9 @@ void tmux_window_switch(uint16_t keycode); #define _________________NUMBER_L1_________________ KC_1, KC_2, KC_3, KC_4, KC_5 #define _________________NUMBER_R1_________________ KC_6, KC_7, KC_8, KC_9, KC_0 +#define _________________SYMBOL_L1_________________ KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC +#define _________________SYMBOL_R1_________________ KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN + #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 @@ -30,4 +53,9 @@ void tmux_window_switch(uint16_t keycode); #define ____________FUNCTION_2____________ KC_F5, KC_F6, KC_F7, KC_F8 #define ____________FUNCTION_3____________ KC_F9, KC_F10, KC_F11, KC_F12 +#define ___SQBRACKETS___ KT_LBRC, KT_RBRC +#define _____PARENS_____ KC_LPRN, KC_RPRN +#define ____CRBRACES____ KC_LCBR, KC_RCBR +#define ___ANBRACKETS___ KC_LT, KC_GT + #endif diff --git a/users/kuatsure/rules.mk b/users/kuatsure/rules.mk index f0d295aad..ed7e92905 100644 --- a/users/kuatsure/rules.mk +++ b/users/kuatsure/rules.mk @@ -1,3 +1,4 @@ CONSOLE_ENABLE = no +TAP_DANCE_ENABLE = yes SRC += kuatsure.c diff --git a/users/manna-harbour_miryoku/README.org b/users/manna-harbour_miryoku/README.org new file mode 120000 index 000000000..b6caaade1 --- /dev/null +++ b/users/manna-harbour_miryoku/README.org @@ -0,0 +1 @@ +miryoku.org
\ No newline at end of file diff --git a/users/manna-harbour_miryoku/config.h b/users/manna-harbour_miryoku/config.h new file mode 100644 index 000000000..c3c513d06 --- /dev/null +++ b/users/manna-harbour_miryoku/config.h @@ -0,0 +1,13 @@ + +// generated from users/manna-harbour_miryoku/miryoku.org + +#pragma once + +// Prevent normal rollover on alphas from accidentally triggering mods. +#define IGNORE_MOD_TAP_INTERRUPT + +// Enable rapid switch from tap to hold, disables double tap hold auto-repeat. +#define TAPPING_FORCE_HOLD + +// Recommended for heavy chording. +#define QMK_KEYS_PER_SCAN 4 diff --git a/users/manna-harbour_miryoku/manna-harbour_miryoku.c b/users/manna-harbour_miryoku/manna-harbour_miryoku.c new file mode 100644 index 000000000..bb4770afc --- /dev/null +++ b/users/manna-harbour_miryoku/manna-harbour_miryoku.c @@ -0,0 +1,56 @@ + +// generated from users/manna-harbour_miryoku/miryoku.org + +#include QMK_KEYBOARD_H + +#define KC_NP KC_NO // key is not present +#define KC_NA KC_NO // present but not available for use +#define KC_NU KC_NO // available but not used +#define KC_RST RESET + +enum layers { BASE, MEDR, NAVR, MOUR, NSSL, NSL, FUNL }; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [BASE] = LAYOUT_miryoku( + KC_Q, KC_W, KC_F, KC_P, KC_B, KC_J, KC_L, KC_U, KC_Y, KC_QUOT, + LGUI_T(KC_A), LALT_T(KC_R), LCTL_T(KC_S), LSFT_T(KC_T), KC_G, KC_M, LSFT_T(KC_N), LCTL_T(KC_E), LALT_T(KC_I), LGUI_T(KC_O), + KC_Z, KC_X, KC_C, KC_D, KC_V, KC_K, KC_H, KC_COMM, KC_DOT, KC_SLSH, + KC_NP, KC_NP, LT(MEDR, KC_ESC), LT(NAVR, KC_SPC), LT(MOUR, KC_TAB), LT(NSSL, KC_ENT), LT(NSL, KC_BSPC), LT(FUNL, KC_DEL), KC_NP, KC_NP + ), + [NAVR] = LAYOUT_miryoku( + KC_RST, KC_NA, KC_NA, KC_NA, KC_NA, KC_AGIN, KC_UNDO, KC_CUT, KC_COPY, KC_PSTE, + KC_LGUI, KC_LALT, KC_LCTL, KC_LSFT, KC_NA, KC_CAPS, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, + KC_NA, KC_NA, KC_NA, KC_NA, KC_NA, KC_INS, KC_HOME, KC_PGDN, KC_PGUP, KC_END, + KC_NP, KC_NP, KC_NA, KC_NA, KC_NA, KC_ENT, KC_BSPC, KC_DEL, KC_NP, KC_NP + ), + [MOUR] = LAYOUT_miryoku( + KC_RST, KC_NA, KC_NA, KC_NA, KC_NA, KC_NU, KC_NU, KC_NU, KC_NU, KC_NU, + KC_LGUI, KC_LALT, KC_LCTL, KC_LSFT, KC_NA, KC_NU, KC_MS_L, KC_MS_D, KC_MS_U, KC_MS_R, + KC_NA, KC_NA, KC_NA, KC_NA, KC_NA, KC_NU, KC_WH_L, KC_WH_D, KC_WH_U, KC_WH_R, + KC_NP, KC_NP, KC_NA, KC_NA, KC_NA, KC_BTN3, KC_BTN1, KC_BTN2, KC_NP, KC_NP + ), + [MEDR] = LAYOUT_miryoku( + KC_RST, KC_NA, KC_NA, KC_NA, KC_NA, KC_NU, KC_NU, KC_NU, KC_NU, KC_NU, + KC_LGUI, KC_LALT, KC_LCTL, KC_LSFT, KC_NA, KC_NU, KC_MPRV, KC_VOLD, KC_VOLU, KC_MNXT, + KC_NA, KC_NA, KC_NA, KC_NA, KC_NA, KC_NU, KC_NU, KC_NU, KC_NU, KC_NU, + KC_NP, KC_NP, KC_NA, KC_NA, KC_NA, KC_MSTP, KC_MPLY, KC_MUTE, KC_NP, KC_NP + ), + [FUNL] = LAYOUT_miryoku( + KC_F12, KC_F7, KC_F8, KC_F9, KC_PSCR, KC_NA, KC_NA, KC_NA, KC_NA, KC_RST, + KC_F11, KC_F4, KC_F5, KC_F6, KC_SLCK, KC_NA, KC_LSFT, KC_LCTL, KC_LALT, KC_LGUI, + KC_F10, KC_F1, KC_F2, KC_F3, KC_PAUS, KC_NA, KC_NA, KC_NA, KC_NA, KC_NA, + KC_NP, KC_NP, KC_APP, KC_SPC, KC_TAB, KC_NA, KC_NA, KC_NA, KC_NP, KC_NP + ), + [NSL] = LAYOUT_miryoku( + KC_LBRC, KC_7, KC_8, KC_9, KC_RBRC, KC_NA, KC_NA, KC_NA, KC_NA, KC_RST, + KC_SCLN, KC_4, KC_5, KC_6, KC_EQL, KC_NA, KC_LSFT, KC_LCTL, KC_LALT, KC_LGUI, + KC_GRV, KC_1, KC_2, KC_3, KC_BSLS, KC_NA, KC_NA, KC_NA, KC_NA, KC_NA, + KC_NP, KC_NP, KC_DOT, KC_0, KC_MINS, KC_NA, KC_NA, KC_NA, KC_NP, KC_NP + ), + [NSSL] = LAYOUT_miryoku( + KC_LCBR, KC_AMPR, KC_ASTR, KC_LPRN, KC_RCBR, KC_NA, KC_NA, KC_NA, KC_NA, KC_RST, + KC_COLN, KC_DLR, KC_PERC, KC_CIRC, KC_PLUS, KC_NA, KC_LSFT, KC_LCTL, KC_LALT, KC_LGUI, + KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_PIPE, KC_NA, KC_NA, KC_NA, KC_NA, KC_NA, + KC_NP, KC_NP, KC_GT, KC_RPRN, KC_UNDS, KC_NA, KC_NA, KC_NA, KC_NP, KC_NP + ) +}; diff --git a/users/manna-harbour_miryoku/miryoku.org b/users/manna-harbour_miryoku/miryoku.org new file mode 100644 index 000000000..556f95f60 --- /dev/null +++ b/users/manna-harbour_miryoku/miryoku.org @@ -0,0 +1,609 @@ +#+Title: miryoku.org + +The miryoku layout is an ergonomic, minimal, orthogonal layout for ergo or ortho +keyboards, implemented as part of the QMK firmware. The layout is maintained in +emacs org-mode tables and converted to QMK keymap data structures using embedded +python scripts. The layout is mapped onto keyboards with different physical +layouts as a subset without code duplication using the QMK userland feature and +C macros. Versions of the layout can also be seen outside of the QMK source at +[[https://github.com/manna-harbour/miryoku/]]. + +* Contents + +- [[#layout][Layout]] +- [[#code-generation][Code Generation]] +- [[#subset-mapping][Subset Mapping]] + + +* Layout +:PROPERTIES: +:CUSTOM_ID: layout +:END: + +** Info + +*** General Principles + + - Use layers instead of reaching. + - Use both hands instead of contortions. + - Use the home positions as much as possible. + - Make full use of the thumbs. + - Avoid unnecessary complication. + + +*** Specifics + + - 5 columns, 3 rows, 3 thumb keys, 2 hands. + - Can be used on almost any split or non-split ergo or ortho keyboard. + - Includes all keys found on a US layout TKL keyboard, plus media keys and + mouse emulation. + - Home row is the middle row, home thumb key is the middle thumb key. + - Maximum 1-u movement from home position for fingers and thumbs, and only + along one axis (except for the inner index finger column which is + deprioritised compared with the home columns). + - Dual-function modifiers on home row, mirrored on both hands. + - Dual-function layer change on thumbs. + - Layers are designed orthogonally with a single purpose per hand and are + accessed by holding a thumb key on the opposite hand. + - Holding layer change and modifiers on one hand combined with a single key + press on the other hand can produce any combination of modifiers and + single keys without any finger contortions. + - Single function mods are also defined on layers on the same hand as the + layer change thumb key so layer change and mods can be held in any order + or simultaneously without race conditions. + - As mods are only enabled on the opposite hand, auto-repeat is available on + the home row on layers for use with cursor and mouse keys. + - Tap-hold auto-repeat is disabled to enable faster tap-hold switching on + thumbs but thumb tap keys are mirrored onto some layers for use with + auto-repeat. + + +** Layers + +The layers are maintained in tables, with the thumb keys on the bottom row. NP +indicates the key is not present and is used to fill in the table around the +thumb keys. The grid arrangement of the tables does not imply a particular +physical layout. + +Basic keycodes are entered without the KC_ prefix. Symbols can be entered as-is +(excepting '"' (DQUO) and '|' (PIPE)). Empty cells are unused. + +The base layer has both halves of the layout joined for convenience. Other +layers are specified as a single hand. + +*** Base (BASE) + + +The base layer is maintained as separate tap and hold tables and are combined +into the corresponding tap-hold keycodes for mods and layer change. RST and +mods will be available on sub layers on the same hand as the layer change thumb +key. Unknown names are considered to be layer names. + +Base layer alphas are Colemak DHm. Thumb keys are backspace, enter, delete on +the right and space, tab, escape on the left. Dot, comma and apostrophe are +included for prose, dot and slash for file and directory names. + +#+NAME: tap +| Q | W | F | P | B | J | L | U | Y | ' | +| A | R | S | T | G | M | N | E | I | O | +| Z | X | C | D | V | K | H | , | . | / | +| NP | NP | ESC | SPC | TAB | ENT | BSPC | DEL | NP | NP | + +#+NAME: hold +| RST | | | | | | | | | RST | +| LGUI | LALT | LCTL | LSFT | | | LSFT | LCTL | LALT | LGUI | +| | | | | | | | | | | +| NP | NP | MEDR | NAVR | MOUR | NSSL | NSL | FUNL | NP | NP | + + +*** Navigation (NAVR) + +Primary right-hand layer (left home thumb) is navigation and editing. Cursor +keys are on the home position, line and page movement below, clipboard above, +caps and insert on the inner column. Thumb keys are duplicated from the base +layer to avoid having to layer change mid edit and to enable auto-repeat. + +#+NAME: navr +| AGIN | UNDO | CUT | COPY | PSTE | +| CAPS | LEFT | DOWN | UP | RGHT | +| INS | HOME | PGDN | PGUP | END | +| ENT | BSPC | DEL | NP | NP | + + +*** Mouse (MOUR) + +Secondary RH layer is mouse emulation. Mouse movement mirrors cursor navigation +on home and wheel mirrors line / page movement below. Buttons are on the +thumbs. Mouse movement, click, and drag with modifiers can be performed from +the home position. Unused keys are available for other related functions. + +#+NAME: mour +| | | | | | +| | MS_L | MS_D | MS_U | MS_R | +| | WH_L | WH_D | WH_U | WH_R | +| BTN3 | BTN1 | BTN2 | NP | NP | + + +*** Media (MEDR) + +Tertiary RH layer is media control, with volume up / down and next / prev +mirroring the navigation keys. Pause, stop and mute are on thumbs. Unused keys +are available for other related functions. + +#+NAME: medr +| | | | | | +| | MPRV | VOLD | VOLU | MNXT | +| | | | | | +| MSTP | MPLY | MUTE | NP | NP | + + +*** Numerals and Symbols (NSL) + +Primary left-hand layer (right home thumb) is numerals and symbols. Numerals +are in the standard numpad locations with symbols in the remaining positions. +Dot is duplicated from the base layer for convenience. + +#+NAME: nsl +| [ | 7 | 8 | 9 | ] | +| ; | 4 | 5 | 6 | = | +| ` | 1 | 2 | 3 | \ | +| NP | NP | . | 0 | - | + + +*** Shifted Numerals and Symbols (NSSL) + +Secondary LH layer has shifted symbols in the same locations to reduce chording +when using mods with shifted symbols. Automatically generated from unshifted +table. + + +*** Function and System (FUNL) + +Tertiary LH layer has function keys mirroring the numerals on the primary layer +with extras on the pinkie column, plus system keys on the inner column. App +(menu) is on the tertiary thumb key and other thumb keys are duplicated from the +base layer to enable auto-repeat. + + +#+NAME: funl +| F12 | F7 | F8 | F9 | PSCR | +| F11 | F4 | F5 | F6 | SLCK | +| F10 | F1 | F2 | F3 | PAUS | +| NP | NP | APP | SPC | TAB | + + +*** COMMENT Templates + +#+NAME: tem +| <l4> | <l4> | <l4> | <l4> | <l4> | <l4> | <l4> | <l4> | <l4> | <l4> | +|------+------+------+------+------+------+------+------+------+------| +| | | | | | | | | | | +| | | | | | | | | | | +| | | | | | | | | | | +| NP | NP | | | | | | | NP | NP | + + +Duplicate base layer tap keys on thumbs rather than trans to enable auto-repeat. + +#+NAME: temr +| <l4> | <l4> | <l4> | <l4> | <l4> | +|------+------+------+------+------| +| | | | | | +| | | | | | +| | | | | | +| ENT | BSPC | DEL | NP | NP | + +#+NAME: teml +| <l4> | <l4> | <l4> | <l4> | <l4> | +|------+------+------+------+------| +| | | | | | +| | | | | | +| | | | | | +| NP | NP | ESC | SPC | TAB | + + +* Code Generation +:PROPERTIES: +:CUSTOM_ID: code-generation +:END: + +** Table Conversion Scripts + +*** table-layout-taphold + +Produce base layer from separate tap and hold tables. + +#+NAME: table-layout-taphold +#+BEGIN_SRC python :var tap_table=tap :var hold_table=hold :var symbol_names_table=symbol-names :var mods_list=mods :tangle no :results verbatim +width = 19 +mods_dict = dict.fromkeys(mods_list) +symbol_names_dict = {} +for symbol, name, shifted_symbol, shifted_name in symbol_names_table: + symbol_names_dict[symbol] = name + symbol_names_dict[shifted_symbol] = shifted_name +results = ' [BASE] = LAYOUT_miryoku(\n' +for tap_row, hold_row in map(None, tap_table, hold_table): + results += ' ' + for tap, hold in map(None, tap_row, hold_row): + if tap == '': + code = 'NU' + elif tap in symbol_names_dict: + code = symbol_names_dict[tap] + else: + code = tap + code = 'KC_' + str(code) + if hold in mods_dict: + code = str(hold) + '_T(' + code + ')' + elif hold != '' and hold != 'NP' and hold != 'RST': + code = 'LT(' + str(hold) + ', ' + code + ')' + results += (code + ', ').ljust(width) + results = results.rstrip(' ') + '\n' +results = results.rstrip('\n, ') + '\n )' +return results +#+END_SRC + +#+RESULTS: table-layout-taphold +: [BASE] = LAYOUT_miryoku( +: KC_Q, KC_W, KC_F, KC_P, KC_B, KC_J, KC_L, KC_U, KC_Y, KC_QUOT, +: LGUI_T(KC_A), LALT_T(KC_R), LCTL_T(KC_S), LSFT_T(KC_T), KC_G, KC_M, LSFT_T(KC_N), LCTL_T(KC_E), LALT_T(KC_I), LGUI_T(KC_O), +: KC_Z, KC_X, KC_C, KC_D, KC_V, KC_K, KC_H, KC_COMM, KC_DOT, KC_SLSH, +: KC_NP, KC_NP, LT(MEDR, KC_ESC), LT(NAVR, KC_SPC), LT(MOUR, KC_TAB), LT(NSSL, KC_ENT), LT(NSL, KC_BSPC), LT(FUNL, KC_DEL), KC_NP, KC_NP +: ) + + +*** table-layout-half + +Produce sub layers given layer name and corresponding table for single hand and +incorporating mods and reset from base layer. Layer names must end with R or L. +A layer with shifted symbols can also be generated. + +#+NAME: table-layout-half +#+BEGIN_SRC python :var hold_table=hold :var layer_name="NSL" :var half_table=nsl :var symbol_names_table=symbol-names :var mods_list=mods :var shift="false" :tangle no :results verbatim +width = 9 +mods_dict = dict.fromkeys(mods_list) +symbol_names_dict = {} +shifted_symbol_names_dict = {} +for symbol, name, shifted_symbol, shifted_name in symbol_names_table: + symbol_names_dict[symbol] = name + symbol_names_dict[shifted_symbol] = shifted_name + shifted_symbol_names_dict[symbol] = shifted_name +length = len(half_table[0]) +mode = layer_name[-1:].lower() +results = ' [' + layer_name + '] = LAYOUT_miryoku(\n' +for half_row, hold_row in map(None, half_table, hold_table): + results += ' ' + hold_row_l, hold_row_r = hold_row[:length], hold_row[length:] + for lr, hold_row_lr in ('l', hold_row_l), ('r', hold_row_r): + if lr == mode: + for half in half_row: + if half == '': + code = 'NU' + elif shift == "true" and half in shifted_symbol_names_dict: + code = shifted_symbol_names_dict[half] + elif half in symbol_names_dict: + code = symbol_names_dict[half] + else: + code = half + results += ('KC_' + str(code) + ', ').ljust(width) + else: + for hold in hold_row_lr: + if hold == '' or hold != 'NP' and hold != 'RST' and hold not in mods_dict: + code = 'NA' + else: + code = hold + results += ('KC_' + str(code) + ', ').ljust(width) + results = results.rstrip(' ') + '\n' +results = results.rstrip('\n, ') + '\n )' +return results +#+END_SRC + +#+RESULTS: table-layout-half +: [NSL] = LAYOUT_miryoku( +: KC_LBRC, KC_7, KC_8, KC_9, KC_RBRC, KC_NA, KC_NA, KC_NA, KC_NA, KC_RST, +: KC_SCLN, KC_4, KC_5, KC_6, KC_EQL, KC_NA, KC_LSFT, KC_LCTL, KC_LALT, KC_LGUI, +: KC_GRV, KC_1, KC_2, KC_3, KC_BSLS, KC_NA, KC_NA, KC_NA, KC_NA, KC_NA, +: KC_NP, KC_NP, KC_DOT, KC_0, KC_MINS, KC_NA, KC_NA, KC_NA, KC_NP, KC_NP +: ) + + +*** table-enums + +Produce layer enums from layer names in hold table. + +#+NAME: table-enums +#+BEGIN_SRC python :var hold_table=hold :var mods_list=mods :tangle no +mods_dict = dict.fromkeys(mods_list) +results = 'enum layers { BASE, ' +for hold_row in hold_table: + for hold in hold_row: + if hold not in mods_dict and hold != '' and hold != 'NP' and hold != 'RST': + results += hold + ', ' +results = results.rstrip(', ') + ' };' +return results +#+END_SRC + +#+RESULTS: table-enums +: enum layers { BASE, MEDR, NAVR, MOUR, NSSL, NSL, FUNL }; + + +** Data + +*** symbol-names + +Symbol, name, and shifted symbol mappings for use in tables. + +#+NAME: symbol-names +| ` | GRV | ~ | TILD | +| - | MINS | _ | UNDS | +| = | EQL | + | PLUS | +| [ | LBRC | { | LCBR | +| ] | RBRC | } | RCBR | +| \ | BSLS | PIPE | PIPE | +| ; | SCLN | : | COLN | +| ' | QUOT | DQUO | DQUO | +| , | COMM | < | LT | +| . | DOT | > | GT | +| / | SLSH | ? | QUES | +| 1 | 1 | ! | EXLM | +| 2 | 2 | @ | AT | +| 3 | 3 | # | HASH | +| 4 | 4 | $ | DLR | +| 5 | 5 | % | PERC | +| 6 | 6 | ^ | CIRC | +| 7 | 7 | & | AMPR | +| 8 | 8 | * | ASTR | +| 9 | 9 | ( | LPRN | +| 0 | 0 | ) | RPRN | + + +*** mods + +Modifiers usable in hold table. Need to have the same name for KC_ and _T versions. + +#+NAME: mods +- LSFT +- LCTL +- LALT +- LGUI +- LAGR + + +** Other + +*** header + +Header for tangled src files. + +#+NAME: header +#+BEGIN_SRC C :tangle no +generated from users/manna-harbour_miryoku/miryoku.org +#+END_SRC + + +* Subset Mapping +:PROPERTIES: +:CUSTOM_ID: subset-mapping +:END: + +** Userspace + +The keymap and configuration are shared between keyboards. The keymap is +defined for LAYOUT_miryoku which is 10x4, with the outer 2 positions on the +bottom row unused and the rest of the bottom row are the thumb keys. + + +*** manna-harbour_miryoku.c + +Contains the keymap. Included from keymap.c + +[[./manna-harbour_miryoku.c][users/manna-harbour_miryoku/manna-harbour_miryoku.c]] +#+BEGIN_SRC C :noweb yes :tangle manna-harbour_miryoku.c + +// <<header>> + +#include QMK_KEYBOARD_H + +#define KC_NP KC_NO // key is not present +#define KC_NA KC_NO // present but not available for use +#define KC_NU KC_NO // available but not used +#define KC_RST RESET + +<<table-enums()>> + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { +<<table-layout-taphold()>>, +<<table-layout-half(layer_name="NAVR", half_table=navr)>>, +<<table-layout-half(layer_name="MOUR", half_table=mour)>>, +<<table-layout-half(layer_name="MEDR", half_table=medr)>>, +<<table-layout-half(layer_name="FUNL", half_table=funl)>>, +<<table-layout-half(layer_name="NSL", half_table=nsl)>>, +<<table-layout-half(layer_name="NSSL", half_table=nsl, shift="true")>> +}; +#+END_SRC + + +*** config.h + +Config options. Automatically included. + +[[./config.h][users/manna-harbour_miryoku/config.h]] +#+BEGIN_SRC C :noweb yes :tangle config.h + +// <<header>> + +#pragma once + +// Prevent normal rollover on alphas from accidentally triggering mods. +#define IGNORE_MOD_TAP_INTERRUPT + +// Enable rapid switch from tap to hold, disables double tap hold auto-repeat. +#define TAPPING_FORCE_HOLD + +// Recommended for heavy chording. +#define QMK_KEYS_PER_SCAN 4 + +#+END_SRC + + +*** rules.mk + +Build options. Automatically included. + +[[./rules.mk][users/manna-harbour_miryoku/rules.mk]] +#+BEGIN_SRC makefile :noweb yes :tangle rules.mk + +# <<header>> + +MOUSEKEY_ENABLE = yes # Mouse keys(+4700) +EXTRAKEY_ENABLE = yes # Audio control and System control(+450) + +#+END_SRC + + +** Layouts + +To use the keymap on a keyboard supporting the layouts feature, LAYOUT_miryoku +is defined as a macro mapping onto the layout's own LAYOUT macro, leaving the +unused keys as KC_NO. The userspace keymap is then included. + +*** ergodox + +For the ergodox layout, the main 5x3 alphas are used as usual. The primary and +secondary thumb keys are the inner and outer 2u thumb keys and the tertiary +thumb key is the innermost key of the partial bottom row. The remaining keys +are unused. + +[[../../layouts/community/ergodox/manna-harbour_miryoku/keymap.c][layouts/community/ergodox/manna-harbour_miryoku/keymap.c]] +#+BEGIN_SRC C :noweb yes :tangle ../../layouts/community/ergodox/manna-harbour_miryoku/keymap.c + +// <<header>> + +#define LAYOUT_miryoku(\ +K00, K01, K02, K03, K04, K05, K06, K07, K08, K09,\ +K10, K11, K12, K13, K14, K15, K16, K17, K18, K19,\ +K20, K21, K22, K23, K24, K25, K26, K27, K28, K29,\ +N30, N31, K32, K33, K34, K35, K36, K37, N38, N39\ +)\ +LAYOUT_ergodox_pretty( \ +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, K00, K01, K02, K03, K04, KC_NO, KC_NO, K05, K06, K07, K08, K09, KC_NO, \ +KC_NO, K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, KC_NO, \ +KC_NO, K20, K21, K22, K23, K24, KC_NO, KC_NO, K25, K26, K27, K28, K29, KC_NO, \ +KC_NO, KC_NO, KC_NO, KC_NO, K32, K37, KC_NO, KC_NO, KC_NO, KC_NO, \ + KC_NO, KC_NO, KC_NO, KC_NO, \ + KC_NO, KC_NO, \ + K33, K34, KC_NO, KC_NO, K35, K36 \ +) + +#include "manna-harbour_miryoku.c" + +#+END_SRC + +To build for any keyboard using the this layout (ergodone, ergodox_ez, +ergodox_infinity, hotdox) e.g. the ergodox_ez, + +#+BEGIN_SRC sh :tangle no +cd ../.. && make ergodox_ez:manna-harbour_miryoku:teensy +#+END_SRC + + + +*** ortho_4x12 + +For the ortho_4x12 layout, the right half as is as follows: The rightmost column +bottom 3 rows is the pinkie column. The middle 4 columns top 3 rows are for the +remaining fingers. The bottom row left 3 columns are the thumb keys. The +remaining keys are unused. + +[[../../layouts/community/ortho_4x12/manna-harbour_miryoku/keymap.c][layouts/community/ortho_4x12/manna-harbour_miryoku/keymap.c]] +#+BEGIN_SRC C :noweb yes :tangle ../../layouts/community/ortho_4x12/manna-harbour_miryoku/keymap.c + +// <<header>> + +#define LAYOUT_miryoku(\ +K00, K01, K02, K03, K04, K05, K06, K07, K08, K09,\ +K10, K11, K12, K13, K14, K15, K16, K17, K18, K19,\ +K20, K21, K22, K23, K24, K25, K26, K27, K28, K29,\ +N30, N31, K32, K33, K34, K35, K36, K37, N38, N39\ +)\ +LAYOUT_ortho_4x12(\ +KC_NO, K01, K02, K03, K04, KC_NO, KC_NO, K05, K06, K07, K08, KC_NO,\ +K00, K11, K12, K13, K14, KC_NO, KC_NO, K15, K16, K17, K18, K09,\ +K10, K21, K22, K23, K24, KC_NO, KC_NO, K25, K26, K27, K28, K19,\ +K20, KC_NO, KC_NO, K32, K33, K34, K35, K36, K37, KC_NO, KC_NO, K29\ +) + +#include "manna-harbour_miryoku.c" + +#+END_SRC + +To build for any keyboard using this layout (4x4, nori, chimera_ls, contra, +divergetm2, jj40, lets_split, lets_split_eh, meira, niu_mini, planck, telophase, +vitamins_included, zinc, zlant, ortho48, kbd4x, levinson, wavelet, plaid) +e.g. the levinson, + +#+BEGIN_SRC sh :tangle no +make keebio/levinson:manna-harbour_miryoku:avrdude +#+END_SRC + + +** Keyboards + +To use the keymap on a keyboard which does not support the layouts feature, +LAYOUT_miryoku is defined as a macro mapping onto the keyboard's own LAYOUT +macro, leaving the unused keys as KC_NO. The userspace keymap is then included. + + +*** crkbd + +The outer columns are unused. + +[[../../keyboards/crkbd/keymaps/manna-harbour_miryoku/keymap.c][keyboards/crkbd/keymaps/manna-harbour_miryoku/keymap.c]] +#+BEGIN_SRC C :noweb yes :tangle ../../keyboards/crkbd/keymaps/manna-harbour_miryoku/keymap.c + +// <<header>> + +#define LAYOUT_miryoku( \ + K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, \ + K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, \ + K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, \ + N30, N31, K32, K33, K34, K35, K36, K37, N38, N39 \ +) \ +LAYOUT( \ +KC_NO, K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, KC_NO, \ +KC_NO, K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, KC_NO, \ +KC_NO, K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, KC_NO, \ + K32, K33, K34, K35, K36, K37 \ +) + +#include "manna-harbour_miryoku.c" + +#+END_SRC + +To build for this keyboard, + +#+BEGIN_SRC sh :tangle no +cd ../.. && make crkbd:manna-harbour_miryoku:avrdude +#+END_SRC + + +* Related Documentation + +** QMK + +- https://qmk.fm/ +- https://docs.qmk.fm/#/getting_started_introduction +- https://docs.qmk.fm/#/hardware_keyboard_guidelines +- https://docs.qmk.fm/#/config_options +- https://docs.qmk.fm/#/keycodes +- https://docs.qmk.fm/#/feature_advanced_keycodes +- https://docs.qmk.fm/#/feature_layouts +- https://docs.qmk.fm/#/feature_userspace +- https://docs.qmk.fm/#/getting_started_make_guide + + +** Org Mode + +- https://orgmode.org/ +- https://orgmode.org/manual/Tables.html +- https://orgmode.org/manual/Working-with-Source-Code.html diff --git a/users/manna-harbour_miryoku/rules.mk b/users/manna-harbour_miryoku/rules.mk new file mode 100644 index 000000000..baff1431f --- /dev/null +++ b/users/manna-harbour_miryoku/rules.mk @@ -0,0 +1,5 @@ + +# generated from users/manna-harbour_miryoku/miryoku.org + +MOUSEKEY_ENABLE = yes # Mouse keys(+4700) +EXTRAKEY_ENABLE = yes # Audio control and System control(+450) diff --git a/users/mattly/config.h b/users/mattly/config.h new file mode 100644 index 000000000..25d379801 --- /dev/null +++ b/users/mattly/config.h @@ -0,0 +1,9 @@ +#pragma once + +// Most tactile encoders have detents every 4 stages +#define ENCODER_RESOLUTION 4 + +#define IGNORE_MOD_TAP_INTERRUPT +#define PERMISSIVE_HOLD +#define TAPPING_TOGGLE 2 +#define TAPPING_TERM 200 diff --git a/users/mattly/mattly.c b/users/mattly/mattly.c new file mode 100644 index 000000000..1e61e0126 --- /dev/null +++ b/users/mattly/mattly.c @@ -0,0 +1,70 @@ +#include "mattly.h" + +__attribute__ ((weak)) +layer_state_t layer_state_set_keymap (layer_state_t state) { + return state; +} + +void set_lights_default(void) { + #ifdef RGBLIGHT_ENABLE + if (IS_HOST_LED_ON(USB_LED_CAPS_LOCK)) { + rgblight_sethsv_noeeprom(HSV_CAPS); + } else { + rgblight_sethsv_noeeprom(HSV_DEFAULT); + } + #endif +} + +void layer_state_set_rgb(layer_state_t state) { +#ifdef RGBLIGHT_ENABLE + switch (biton32(state)) { + case _QWERTY: + set_lights_default(); + break; + case _SYMBOL: + rgblight_sethsv_noeeprom(HSV_SYMBOL); + break; + case _NAVNUM: + rgblight_sethsv_noeeprom(HSV_NAVNUM); + break; + case _FUNCT: + rgblight_sethsv_noeeprom(HSV_FUNCT); + break; + } +#endif +} + + +layer_state_t layer_state_set_user (layer_state_t state) { + state = update_tri_layer_state(state, _SYMBOL, _NAVNUM, _FUNCT); + layer_state_set_rgb(state); + return layer_state_set_keymap (state); +} + +void on_reset(void) { + #ifdef RGBLIGHT_ENABLE + rgblight_sethsv_noeeprom(HSV_RESET); + #endif +} + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case KC_CAPS: + #ifdef RGBLIGHT_ENABLE + set_lights_default(); + #endif + return true; + case RESET: + on_reset(); + return true; + default: + return true; + } +} + +void keyboard_post_init_user(void) { +#ifdef RGBLIGHT_ENABLE + rgblight_enable_noeeprom(); + set_lights_default(); +#endif +} diff --git a/users/mattly/mattly.h b/users/mattly/mattly.h new file mode 100644 index 000000000..08318840d --- /dev/null +++ b/users/mattly/mattly.h @@ -0,0 +1,83 @@ +/* Copyright 2019 Matthew Lyon + * + * 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 USERSPACE +#define USERSPACE + +#include "quantum.h" + +enum { + _QWERTY, + _NAVNUM, + _SYMBOL, + _FUNCT, +}; + +// left hand +#define ESC_HYP MT(MOD_HYPR, KC_ESC) +#define BSP_NUM LT(_NAVNUM, KC_BSPC) +#define ENT_SFT MT(MOD_LSFT, KC_ENT) +#define SPC_SFT MT(MOD_LSFT, KC_SPC) + +// right hand +#define SPC_SFT MT(MOD_LSFT, KC_SPC) +#define TAB_SYM LT(_SYMBOL, KC_TAB) +#define DEL_WRP MT(MOD_LCTL | MOD_LALT | MOD_LGUI, KC_DEL) + +#define NAVLOCK TG(_NAVNUM) +#define SYMLOCK TG(_SYMBOL) + + +// QWERTY + +#define A_CTRL MT(MOD_LCTL, KC_A) +#define S_ALT MT(MOD_LALT, KC_S) +#define D_GUI MT(MOD_LGUI, KC_D) +#define F_SHFT MT(MOD_LSFT, KC_F) +#define J_SHFT MT(MOD_RSFT, KC_J) +#define K_GUI MT(MOD_RGUI, KC_K) +#define L_ALT MT(MOD_RALT, KC_L) +#define MINSCTL MT(MOD_RCTL, KC_MINS) + +#define BWORD LALT(KC_LEFT) +#define FWORD LALT(KC_RIGHT) + +// OS X default keys +#define NWIN LGUI(KC_GRV) // Next Window +#define PWIN LGUI(LSFT(KC_GRV)) // Prev Window +#define NTAB LGUI(LSFT(KC_RBRC)) // Next Tab +#define PTAB LGUI(LSFT(KC_LBRC)) // Prev Tab +#define NAVBACK LGUI(KC_LBRC) // Navigate Forward +#define NAVFWD LGUI(KC_RBRC) // Navigate Back + +// my personal mappings to window manager commands +#define XALLWIN HYPR(KC_F14) +#define XDESKTP HYPR(KC_F15) +#define XNXTSPC HYPR(KC_F16) +#define XPRVSPC HYPR(KC_F17) +#define XNOTIFY HYPR(KC_F18) + +#ifdef RGBLIGHT_ENABLE +#define HSV_CAPS 42, 255, 255 +#define HSV_DEFAULT 30, 218, 255 +#define HSV_SYMBOL 22, 255, 255 +#define HSV_NAVNUM 245, 200, 255 +#define HSV_FUNCT 233, 255, 255 +#define HSV_RESET 180, 255, 255 +#endif + +#endif + diff --git a/users/mattly/readme.md b/users/mattly/readme.md new file mode 100644 index 000000000..356992534 --- /dev/null +++ b/users/mattly/readme.md @@ -0,0 +1,10 @@ +# mattly's layouts + +My layouts are based around: + +* making the most from small layouts on keyboards like the iris or planck +* moving held-modifiers from pinkies to thumbs or home row, giving many keys dual purposes via mod/layer taps +* easy home-row navigation on a layer, using standard keys, available to all programs, not just a specially-configured editor +* easy access to punctuation symbols used in the programming languages I work in + +[Here is an image](https://lyonheart.us/etc/mattly-keymap.png) with an outdated description of my keymap
\ No newline at end of file diff --git a/users/mattly/rules.mk b/users/mattly/rules.mk new file mode 100644 index 000000000..6803d361d --- /dev/null +++ b/users/mattly/rules.mk @@ -0,0 +1,2 @@ +SRC += mattly.c +MOUSEKEY_ENABLE = yes diff --git a/users/nstickney/nstickney.c b/users/nstickney/nstickney.c new file mode 100644 index 000000000..3e18e5c83 --- /dev/null +++ b/users/nstickney/nstickney.c @@ -0,0 +1,44 @@ +#include "nstickney.h" + +// Tap Dancing +void dance_layer (qk_tap_dance_state_t *state, void *user_data) { + switch (state -> count) { + case 1: tap_code(KC_APP); break; + case 2: layer_invert(NUMP); break; + case 3: layer_invert(SYMB); break; + case 4: layer_invert(SYSH); break; + default: break; + } +}; + +void dance_lock_finished (qk_tap_dance_state_t *state, void *user_data) { + switch (state->count) { + case 1: register_code(KC_LGUI); break; + case 2: register_code(KC_NLCK); break; + case 3: register_code(KC_CAPS); break; + case 4: register_code(KC_SLCK); break; + default: break; + } +}; + +void dance_lock_reset (qk_tap_dance_state_t *state, void *user_data) { + switch (state->count) { + case 1: unregister_code(KC_LGUI); break; + case 2: unregister_code(KC_NLCK); break; + case 3: register_code(KC_CAPS); break; + case 4: register_code(KC_SLCK); break; + default: break; + } +}; + +qk_tap_dance_action_t tap_dance_actions[] = { + [LOCKS] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, dance_lock_finished, dance_lock_reset), + [LAYERS] = ACTION_TAP_DANCE_FN(dance_layer) +}; + +void eeconfig_init_user (void) { + set_unicode_input_mode(UC_LNX); // Linux + //set_unicode_input_mode(UC_OSX); // Mac OSX + //set_unicode_input_mode(UC_WIN); // Windows (with registry key, see wiki) + //set_unicode_input_mode(UC_WINC); // Windows (with WinCompose, see wiki) +};
\ No newline at end of file diff --git a/users/nstickney/nstickney.h b/users/nstickney/nstickney.h new file mode 100644 index 000000000..d3f5a7c6f --- /dev/null +++ b/users/nstickney/nstickney.h @@ -0,0 +1,25 @@ +#include QMK_KEYBOARD_H + +#pragma once +#define USE_SERIAL +#define MASTER_LEFT + +#undef UNICODE_SELECTED_MODES +#define UNICODE_SELECTED_MODES UC_OSX, UC_LNX, UC_WINC + +// Layers +#define BASE 0 // Base layer +#define SYMB 1 // Symbols +#define SYSH 2 // Symbols, shifted +#define NUMP 3 // Numpad +#define FCTN 4 // Function + +// Make keymaps more clear +#define CC_ESC LCTL_T(KC_ESC) +#define CC_QUOT RCTL_T(KC_QUOT) +#define AC_SLSH LALT_T(KC_SLSH) +#define AC_EQL RALT_T(KC_EQL) +#define FC_BSLS LT(FCTN, KC_BSLS) +#define FC_MINS LT(FCTN, KC_MINS) + +enum tap_dances {LOCKS = 0, LAYERS = 1};
\ No newline at end of file diff --git a/users/nstickney/rules.mk b/users/nstickney/rules.mk new file mode 100644 index 000000000..f52371c79 --- /dev/null +++ b/users/nstickney/rules.mk @@ -0,0 +1,4 @@ +SRC += nstickney.c + +TAP_DANCE_ENABLE = yes +UNICODE_ENABLE = yes
\ No newline at end of file diff --git a/users/pvinis/config.h b/users/pvinis/config.h new file mode 100644 index 000000000..8e2efb40a --- /dev/null +++ b/users/pvinis/config.h @@ -0,0 +1,10 @@ +#pragma once + +#ifdef AUDIO_ENABLE +// #define STARTUP_SONG SONG(SONIC_RING) +// #define DAC_SAMPLE_MAX 65535U // maybe this works for volume? +#endif + +// allow rolling when keys have hold functionality +#define IGNORE_MOD_TAP_INTERRUPT +// #define TAPPING_TERM 150 diff --git a/users/pvinis/pvinis.c b/users/pvinis/pvinis.c new file mode 100644 index 000000000..e97edcb98 --- /dev/null +++ b/users/pvinis/pvinis.c @@ -0,0 +1,89 @@ +#include "pvinis.h" +#include "version.h" + +#ifdef AUDIO_ENABLE +#include "audio.h" +#endif // AUDIO_ENABLE + + +#ifdef AUDIO_ENABLE +// float tone_katamari_rolling_star[][2] = SONG(KATAMARI_ROLLING_STAR); +#endif // AUDIO_ENABLE + + +// SYMBOL + SYSCTL = KBCTL +uint32_t layer_state_set_user(uint32_t state) { + uint32_t intermediate_state = update_tri_layer_state(state, LR_SYMBOL, LR_SYSCTL, LR_KBCTL); + intermediate_state = layer_state_set_user_local(intermediate_state); + return intermediate_state; +} + + +// functions for the individual keymaps to implement if they need something extra +__attribute__ ((weak)) +bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { + return true; +} + + +// handle my own keycodes +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + + case PV_VRSN: + if (record->event.pressed) { + SEND_STRING(QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION); + } + return false; + + case PV_MAKE: + if (!record->event.pressed) { + SEND_STRING("make " QMK_KEYBOARD ":" QMK_KEYMAP +#if (defined(BOOTLOADER_DFU) || defined(BOOTLOADER_LUFA_DFU) || defined(BOOTLOADER_QMK_DFU)) + ":dfu" +#elif defined(BOOTLOADER_HALFKAY) + ":teensy" +#elif defined(BOOTLOADER_CATERINA) + ":avrdude" +#endif + SS_TAP(X_ENTER) + ); + } + return false; + + case PV_FLSH: + reset_keyboard(); + return false; + + case PV_KTMR: + if (record->event.pressed) { +#ifdef AUDIO_ENABLE + // PLAY_SONG(tone_katamari_rolling_star); +#endif + } + return false; + } + return process_record_keymap(keycode, record); +} + + +#ifdef TAP_DANCE_ENABLE +qk_tap_dance_action_t tap_dance_actions[] = { +}; +#endif // TAP_DANCE_ENABLE + + +// init stuff +void keyboard_post_init_user(void) { + keyboard_post_init_user_local(); +} + + +// default functions +__attribute__ ((weak)) +void keyboard_post_init_user_local(void) {} + +__attribute__ ((weak)) +uint32_t layer_state_set_user_local(uint32_t state) { + return state; +} diff --git a/users/pvinis/pvinis.h b/users/pvinis/pvinis.h new file mode 100644 index 000000000..0c75c6a66 --- /dev/null +++ b/users/pvinis/pvinis.h @@ -0,0 +1,152 @@ +#pragma once + +#include "quantum.h" + + +// my own keycodes +enum userspace_custom_keycodes { + PV_ = SAFE_RANGE, + + PV_VRSN, // prints firmware version + PV_MAKE, // prints the make command of the keyboard + PV_FLSH, // resets keyboard + PV_KTMR, // play katamari music + + PV_SAFE_RANGE, // used for extra keycodes in the individual keymaps +}; + +enum tap_dance_indexes { + // tap dance + TD_FLSH, // flash keyboard (as if the physical flash key was pressed) +}; + +#define ALLM(kc) LCAG(kc) // easier name for left ctrl-alt-gui +#define PV_ESCC CTL_T(KC_ESC) // esc on tap, ctrl on hold +#define PV_LOCK LCTL(LSFT(KC_PWR)) // lock computer +#define TD_3FLS TD(TD_FLSH) // tap dance 3 times for flash + + +// layers +enum { + LR_BASE = 0, // used for basic keys like the surrounding ctrl, cmd, etc + + LR_QWERTY, + LR_CARPALX, + + LR_SYMBOL, // symbol input (!, @, #, etc) + LR_SYSCTL, // system control (music, volume, keyboard flash, etc) + LR_KBCTL, // keyboard control (version, make, flash, etc) +}; + + +// layer switchers +#define BASE TO(LR_BASE) +#define QWERTY TO(LR_QWERTY) +#define CARPALX TO(LR_CARPALX) + +#define SYMBOL MO(LR_SYMBOL) +#define SYSCTL MO(LR_SYSCTL) +#define KBCTL MO(LR_KBCTL) + + +// layout parts for easy reuse between keyboard keymaps + +// ,-----+-----+-----+-----+-----, ,-----+-----+-----+-----+-----, +// | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | +// ,-----+-----+-----+-----+-----, ,-----+-----+-----+-----+-----, +#define ________________NUMBERS_L__________________ KC_1, KC_2, KC_3, KC_4, KC_5 +#define ________________NUMBERS_R__________________ KC_6, KC_7, KC_8, KC_9, KC_0 + +// ,-----+-----+-----+-----+-----, ,-----+-----+-----+-----+-----, +// | F1 | F2 | F3 | F4 | F5 | | F6 | F7 | F8 | F9 | F10 | +// ,-----+-----+-----+-----+-----, ,-----+-----+-----+-----+-----, +#define ______________________F_L__________________ KC_F1, KC_F2, KC_F3, KC_F4, KC_F5 +#define ______________________F_R__________________ KC_F6, KC_F7, KC_F8, KC_F9, KC_F10 + +// ,-----+-----+-----+-----+-----, ,-----+-----+-----+-----+-----, +// | Q | W | E | R | T | | Y | U | I | O | P | +// ,-----+-----+-----x-----x-----, ,-----x-----x-----+-----+-----, +// | A | S | D | F | G | | H | J | K | L | ; | +// ,-----+-----+-----x-----x-----, ,-----x-----x-----+-----+-----, +// | Z | X | C | V | B | | N | M | , | . | / | +// ,-----+-----+-----+-----+-----, ,-----+-----+-----+-----+-----, +#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 , KC_SCLN +#define _________________QWERTY_R3_________________ KC_N , KC_M , KC_COMM, KC_DOT , KC_SLSH + +#define _____________MOD_QWERTY_L2_________________ CTL_T(KC_A), SFT_T(KC_S), GUI_T(KC_D), ALT_T(KC_F), KC_G +#define _____________MOD_QWERTY_R2_________________ KC_H , ALT_T(KC_J), GUI_T(KC_K), SFT_T(KC_L), CTL_T(KC_SCLN) + +// ,-----+-----+-----+-----+-----, ,-----+-----+-----+-----+-----, +// | Q | G | M | L | W | | Y | F | I | O | P | +// ,-----+-----+-----x-----x-----, ,-----x-----x-----+-----+-----, +// | D | S | T | N | R | | I | A | K | L | ; | +// ,-----+-----+-----x-----x-----, ,-----x-----x-----+-----+-----, +// | Z | X | C | V | J | | K | P | , | . | / | +// ,-----+-----+-----+-----+-----, ,-----+-----+-----+-----+-----, +#define ________________CARPALX_L1_________________ KC_Q , KC_G , KC_M , KC_L , KC_W +#define ________________CARPALX_L2_________________ KC_D , KC_S , KC_T , KC_N , KC_R +#define ________________CARPALX_L3_________________ KC_Z , KC_X , KC_C , KC_V , KC_J + +#define ________________CARPALX_R1_________________ KC_Y , KC_F , KC_U , KC_B , KC_SCLN +#define ________________CARPALX_R2_________________ KC_I , KC_A , KC_E , KC_O , KC_H +#define ________________CARPALX_R3_________________ KC_K , KC_P , KC_COMM, KC_DOT , KC_SLSH + +// ,-----+-----+-----+-----+-----, ,-----+-----+-----+-----+-----, +// | ! | @ | { | } | _ | | \ | | ` | | | +// ,-----+-----+-----x-----x-----, ,-----x-----x-----+-----+-----, +// | # | $ | ( | ) | - | | = | & | ' | " | | | +// ,-----+-----+-----x-----x-----, ,-----x-----x-----+-----+-----, +// | % | ^ | [ | ] | + | | * | ~ | < | > | / | +// ,-----+-----+-----+-----+-----, ,-----+-----+-----+-----+-----, +#define _________________SYMBOL_L1_________________ KC_EXLM, KC_AT , KC_LCBR, KC_RCBR, KC_UNDS +#define _________________SYMBOL_L2_________________ KC_HASH, KC_DLR , KC_LPRN, KC_RPRN, KC_MINS +#define _________________SYMBOL_L3_________________ KC_PERC, KC_CIRC, KC_LBRC, KC_RBRC, KC_PLUS + +#define _________________SYMBOL_R1_________________ KC_BSLS, _______, KC_GRV , _______, _______ +#define _________________SYMBOL_R2_________________ KC_EQL , KC_AMPR, KC_QUOT, KC_DQUO, KC_PIPE +#define _________________SYMBOL_R3_________________ KC_ASTR, KC_TILD, KC_LABK, KC_RABK, KC_SLSH + +// ,-----+-----+-----+-----+-----, ,-----+-----+-----+-----+-----, +// | | | | | | |MUTE |HOME | ^ | END | | +// ,-----+-----+-----x-----x-----, ,-----x-----x-----+-----+-----, +// | | | | | | |VOLUP| < | v | > | | +// ,-----+-----+-----x-----x-----, ,-----x-----x-----+-----+-----, +// | | | | | | |VOLDN|MPREV|MPLAY|MNEXT| | +// ,-----+-----+-----+-----+-----, ,-----+-----+-----+-----+-----, +#define _________________SYSCTL_L1_________________ +#define _________________SYSCTL_L2_________________ +#define _________________SYSCTL_L3_________________ + +// vol v ctl v +#define _________________SYSCTL_R1_________________ KC_MUTE , KC_HOME , KC_UP , KC_END , PV_LOCK +#define _________________SYSCTL_R2_________________ KC_VOLU , KC_LEFT , KC_DOWN , KC_RGHT /* < arrows */ , KC_SLEP +#define _________________SYSCTL_R3_________________ KC_VOLD , KC_MPRV , KC_MPLY , KC_MNXT /* < music */ , KC_PWR + +// ,-----+-----+-----+-----+-----, ,-----+-----+-----+-----+-----, +// |XXXXX|XXXXX|XXXXX|XXXXX|XXXXX| |XXXXX|XXXXX|XXXXX|XXXXX|XXXXX| +// ,-----+-----+-----x-----x-----, ,-----x-----x-----+-----+-----, +// |XXXXX|XXXXX|XXXXX|XXXXX|XXXXX| |XXXXX|VERSN|MAKE |FLASH|XXXXX| +// ,-----+-----+-----x-----x-----, ,-----x-----x-----+-----+-----, +// |XXXXX|XXXXX|XXXXX|XXXXX|XXXXX| |XXXXX|XXXXX|XXXXX|XXXXX|XXXXX| +// ,-----+-----+-----+-----+-----, ,-----+-----+-----+-----+-----, +#define __________________KBCTL_L1_________________ XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX +#define __________________KBCTL_L2_________________ XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX +#define __________________KBCTL_L3_________________ XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX + +#define __________________KBCTL_R1_________________ XXXXXXX, XXXXXXX, XXXXXXX, PV_KTMR, XXXXXXX +#define __________________KBCTL_R2_________________ XXXXXXX, PV_VRSN, PV_MAKE, PV_FLSH, XXXXXXX +#define __________________KBCTL_R3_________________ XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX + +// we need wrappers in order for these definitions, because they need to be expanded before being used as arguments to the LAYOUT_xxx macro +#define LAYOUT_ergodox_pretty_wrapper(...) LAYOUT_ergodox_pretty(__VA_ARGS__) +#define LAYOUT_wrapper(...) LAYOUT(__VA_ARGS__) + + +// extra stuff that might be needed +void keyboard_post_init_user_local(void); +uint32_t layer_state_set_user_local(uint32_t state); diff --git a/users/pvinis/rules.mk b/users/pvinis/rules.mk new file mode 100644 index 000000000..da10cc743 --- /dev/null +++ b/users/pvinis/rules.mk @@ -0,0 +1,15 @@ +# add userspace file +SRC += pvinis.c + +AUDIO_ENABLE = no # piezo speaker sounds +RGBLIGHT_ENABLE = no # rgb leds underlight +TAP_DANCE_ENABLE = yes +BACKLIGHT_ENABLE = no # leds under keycaps +#MOUSEKEY_ENABLE = no +#SLEEP_LED_ENABLE = no # no led blinking while sleeping +#NKRO_ENABLE = yes + +# make firmware smaller +LINK_TIME_OPTIMIZATION_ENABLE = yes +CONSOLE_ENABLE = no +COMMAND_ENABLE = no diff --git a/users/spacebarracecar/readme.md b/users/spacebarracecar/readme.md index 172764c07..3d9ceb80c 100644 --- a/users/spacebarracecar/readme.md +++ b/users/spacebarracecar/readme.md @@ -14,7 +14,7 @@ I'm using the US Ansi layout however I'm living in Germany which means that ever - The keycodes are handled by the `process_record_user` function which is now located in [spacebarracecar.c](spacebarracecar.c). To change keyboard specific configuration `process_record_keymap` is used (see [drashna userspace readme](../drashna/readme.md) for better explanation). - There is a predefined `_DEADKEY` layer in [spacebarracecar.h](spacebarracecar.h) under `enum userspace_layers`. Shifted CU_QUOT enables the dead key layer, just like KC_QUOT would when using the US International layout. (See `enum userspace_custom_keycodes` for more explanation). - On Windows grave and circonflexe are defined as dead keys when using the standard german layout. Those are automatically escaped when using the custom keycodes. `CU_ESCT` can be used to enable/disable this behavior. -- For a complete example see my [fc660c](../../keyboards/fc660c/keymaps/spacebarracecar/keymap.c) or [planck](../../keyboards/planck/keymaps/spacebarracecar/keymap.c) keymaps. +- For a complete example see my [planck](../../keyboards/planck/keymaps/spacebarracecar/keymap.c) keymap. ### How it works diff --git a/users/spacebarracecar/spacebarracecar.c b/users/spacebarracecar/spacebarracecar.c index 2ab10d945..bbd864aa9 100644 --- a/users/spacebarracecar/spacebarracecar.c +++ b/users/spacebarracecar/spacebarracecar.c @@ -71,6 +71,11 @@ void timer_timeout(void){ rshiftp = false; #endif navesc = false; + timer_timeout_keymap(); +} + +__attribute__((weak)) +void timer_timeout_keymap(void){ } bool process_record_user(uint16_t keycode, keyrecord_t *record) { @@ -340,3 +345,8 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { return process_record_keymap(keycode, record); } } + +__attribute__((weak)) +bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { + return true; +} diff --git a/users/spacebarracecar/spacebarracecar.h b/users/spacebarracecar/spacebarracecar.h index 690971c39..43bfc5e65 100644 --- a/users/spacebarracecar/spacebarracecar.h +++ b/users/spacebarracecar/spacebarracecar.h @@ -75,6 +75,8 @@ extern bool game; void timer_timeout(void); +void timer_timeout_keymap(void); + bool process_record_keymap(uint16_t keycode, keyrecord_t *record); #define CTRLX LCTL(KC_X) diff --git a/users/stanrc85/layer_rgb.c b/users/stanrc85/layer_rgb.c index ac5d18122..58f17489a 100644 --- a/users/stanrc85/layer_rgb.c +++ b/users/stanrc85/layer_rgb.c @@ -1,26 +1,29 @@ #include "stanrc85.h" void matrix_init_user(void) { - rgblight_setrgb(0xFF, 0x00, 0x00); + rgblight_setrgb(0xFF, 0x00, 0x00); }; uint32_t layer_state_set_user(uint32_t state) { - switch (biton32(state)) { + switch (biton32(state)) { case 0: - rgblight_setrgb (0xFF, 0x00, 0x00); - break; + rgblight_setrgb (0xFF, 0x00, 0x00); + break; case 1: - rgblight_setrgb (0x00, 0xFF, 0x00); - break; + rgblight_setrgb (0x00, 0xFF, 0x00); + break; case 2: - rgblight_setrgb (0x00, 0x00, 0xFF); - break; + rgblight_setrgb (0x00, 0x00, 0xFF); + break; case 3: - rgblight_setrgb (0xFF, 0xFF, 0xFF); - break; + rgblight_setrgb (0xFF, 0xFF, 0xFF); + break; + case 4: + rgblight_setrgb (0xFF, 0x00, 0xFF); + break; default: // for any other layers, or the default layer - rgblight_setrgb (0xFF, 0x00, 0x00); - break; + rgblight_setrgb (0xFF, 0x00, 0x00); + break; } return state; } diff --git a/users/stanrc85/stanrc85.c b/users/stanrc85/stanrc85.c index 78b0c4a14..e3da6d646 100644 --- a/users/stanrc85/stanrc85.c +++ b/users/stanrc85/stanrc85.c @@ -45,8 +45,8 @@ void ctl_copy_reset (qk_tap_dance_state_t *state, void *user_data) { } qk_tap_dance_action_t tap_dance_actions[] = { - [TD_WIN] = ACTION_TAP_DANCE_DOUBLE(KC_CAD, KC_LOCK), - [TD_ESC] = ACTION_TAP_DANCE_DOUBLE(KC_ESC, KC_GRV), + [TD_WIN] = ACTION_TAP_DANCE_DOUBLE(KC_CAD, KC_LOCK), + [TD_ESC] = ACTION_TAP_DANCE_DOUBLE(KC_ESC, KC_GRV), [TD_RCTL] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, ctl_copy_finished, ctl_copy_reset) }; diff --git a/users/stanrc85/stanrc85.h b/users/stanrc85/stanrc85.h index da52df09b..ceb7167e1 100644 --- a/users/stanrc85/stanrc85.h +++ b/users/stanrc85/stanrc85.h @@ -3,10 +3,17 @@ #include "quantum.h" #include "version.h" -#define DEFAULT 0 //Custom ANSI -#define LAYER1 1 //Default ANSI (enable with Fn2+CAPS) -#define LAYER2 2 //Function keys, arrows, custom shortcuts, volume control -#define LAYER3 3 //RGB Underglow controls and RESET +enum my_layers { + _NUMPAD = 0, //Macropad numpad + _NAVKEY, //Macropad nav keys + _MEDIA, //Macropad media controls + _RGB, //Macropad RGB controls + _FN1PAD, //Macropad reset and make commands + _QWERTY = 0, //Qwerty with custom shortcuts and functions + _DEFAULT, //Default ANSI for gaming, enable with FN2+RCtl + _FN1_60, //Function keys, arrows, custom shortcuts, volume control + _FN2_60 //RGB Underglow controls and RESET +}; //Aliases for longer keycodes #define KC_CAD LALT(LCTL(KC_DEL)) @@ -14,13 +21,15 @@ #define CA_QUOT LCA(KC_QUOT) #define CA_SCLN LCA(KC_SCLN) #define KC_CTLE LCTL_T(KC_ESC) -#define LT_SPCF LT(2, KC_SPC) +#define LT_SPCF LT(_FN1_60, KC_SPC) #define TD_TESC TD(TD_ESC) #define TD_TWIN TD(TD_WIN) #define TD_TCTL TD(TD_RCTL) +#define CA_COPY LCTL(KC_C) +#define CA_PSTE LCTL(KC_V) enum cust_keys { - KC_MAKE = SAFE_RANGE, + KC_MAKE = SAFE_RANGE, KC_RDP }; diff --git a/users/xulkal/config.h b/users/xulkal/config.h index 2899017b0..c794530d4 100644 --- a/users/xulkal/config.h +++ b/users/xulkal/config.h @@ -1,27 +1,30 @@ #pragma once -#ifndef TAPPING_FORCE_HOLD -#define TAPPING_FORCE_HOLD -#endif // TAPPING_FORCE_HOLD +#undef TAPPING_FORCE_HOLD #undef TAPPING_TERM #define TAPPING_TERM 175 +#define SPACE_CADET_MODIFIER_CARRYOVER #define LSPO_KEYS KC_LSFT, KC_TRNS, KC_LBRC #define RSPC_KEYS KC_RSFT, KC_TRNS, KC_RBRC #define LCPO_KEYS KC_LCTL, KC_TRNS, KC_MINS #define RCPC_KEYS KC_RCTL, KC_TRNS, KC_EQL +// Running out of firmware space +#if defined(__AVR__) +#undef RGB_MATRIX_KEYPRESSES +#undef RGB_MATRIX_KEYRELEASES +#undef RGB_MATRIX_FRAMEBUFFER_EFFECTS +#else +#define RGB_MATRIX_KEYPRESSES +#undef RGB_MATRIX_KEYRELEASES +#define RGB_MATRIX_FRAMEBUFFER_EFFECTS +#endif + // No need for the single versions when multi performance isn't a problem =D #define DISABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE #define DISABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS #define DISABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS #define DISABLE_RGB_MATRIX_SPLASH #define DISABLE_RGB_MATRIX_SOLID_SPLASH - -// Don't like or feel to identical to other effects -#define DISABLE_RGB_MATRIX_RAINBOW_BEACON -#define DISABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS -#define DISABLE_RGB_MATRIX_DIGITAL_RAIN -#define DISABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE -#define DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS diff --git a/users/xulkal/custom_encoder.c b/users/xulkal/custom_encoder.c new file mode 100644 index 000000000..09f1cda0d --- /dev/null +++ b/users/xulkal/custom_encoder.c @@ -0,0 +1,13 @@ +#include "custom_encoder.h" + +#ifdef ENCODER_ENABLE +const uint16_t PROGMEM encoders[][2] = { + { KC_PGUP, KC_PGDN }, + { KC_DOWN, KC_UP } +} + +void encoder_update_user(uint8_t index, bool clockwise) +{ + tap_code16(pgm_read_word(&encoders[index][clockwise])); +} +#endif diff --git a/users/xulkal/custom_encoder.h b/users/xulkal/custom_encoder.h new file mode 100644 index 000000000..010d4b138 --- /dev/null +++ b/users/xulkal/custom_encoder.h @@ -0,0 +1,2 @@ +#pragma once +#include "quantum.h" diff --git a/users/xulkal/custom_keycodes.h b/users/xulkal/custom_keycodes.h new file mode 100644 index 000000000..d4ae0bd47 --- /dev/null +++ b/users/xulkal/custom_keycodes.h @@ -0,0 +1,28 @@ +#pragma once + +enum custom_keycodes { + RGBRST = SAFE_RANGE, +#ifndef TAP_DANCE_ENABLE + TD_MIN, + TD_COMM = TD_MIN, + TD_BSPC, + TD_DEL, + TD_DOT, + TD_MAX, +#endif + KEYMAP_SAFE_RANGE +}; + +#define RIS_ESC LT(_RAISE, KC_ESC) +#define RIS_CAPS LT(_RAISE, KC_CAPS) + +#define QWERTY DF(_QWERTY) + +#ifndef GAMELAYER_DISABLE +#define GAME DF(_GAME) +#else +#define GAME KC_TRANSPARENT +#endif + +#define LOWER MO(_LOWER) +#define RAISE MO(_RAISE) diff --git a/users/xulkal/custom_oled.c b/users/xulkal/custom_oled.c new file mode 100644 index 000000000..7280ef701 --- /dev/null +++ b/users/xulkal/custom_oled.c @@ -0,0 +1,190 @@ +#include "custom_oled.h" +#include "process_records.h" + +#include <stdio.h> + +#ifdef OLED_DRIVER_ENABLE + +#ifdef RGBLIGHT_ENABLE +rgblight_config_t rgblight_config; +#endif + +static void render_logo(void) +{ + static const char PROGMEM font_logo[] = { + 0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8a,0x8b,0x8c,0x8d,0x8e,0x8f,0x90,0x91,0x92,0x93,0x94, + 0xa0,0xa1,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7,0xa8,0xa9,0xaa,0xab,0xac,0xad,0xae,0xaf,0xb0,0xb1,0xb2,0xb3,0xb4, + 0xc0,0xc1,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,0xca,0xcb,0xcc,0xcd,0xce,0xcf,0xd0,0xd1,0xd2,0xd3,0xd4,0}; + oled_write_P(font_logo, false); +} + +#if defined(OLED_90ROTATION) + +// TODO: Need to define this function / extern only for helix based split common keyboards +extern uint8_t is_master; +bool is_keyboard_master(void) +{ + return is_master; +} + +static void render_layer(uint8_t layer) +{ + switch (layer) + { + case _QWERTY: + oled_write_P(PSTR("DFLT "), false); + break; +#ifndef GAMELAYER_DISABLE + case _GAME: + oled_write_P(PSTR("GAME "), false); + break; +#endif + case _LOWER: + oled_write_P(PSTR("LOWER"), false); + break; + case _RAISE: + oled_write_P(PSTR("RAISE"), false); + break; +#ifdef TRILAYER_ENABLED + case _ADJUST: + oled_write_P(PSTR("ADJST"), false); + break; +#endif + } +} + +static void render_status(void) +{ + // Render to mode icon + static const char PROGMEM mode_logo[2][4] = { + {0x97,0x98,0x0a,0}, + {0xb7,0xb8,0x0a,0} }; + + oled_write_P(mode_logo[0], false); + oled_write_P(mode_logo[1], false); + + oled_write_P(PSTR("Layer"), false); + uint8_t layer = biton(layer_state); + if (layer != _QWERTY) + render_layer(layer); + else + render_layer(biton32(default_layer_state)); + + // Host Keyboard LED Status + uint8_t led_usb_state = host_keyboard_leds(); + oled_write_P(led_usb_state & (1<<USB_LED_NUM_LOCK) ? PSTR("-----NUMLK") : PSTR("----- "), false); + oled_write_P(led_usb_state & (1<<USB_LED_CAPS_LOCK) ? PSTR("CAPLK") : PSTR(" "), false); + oled_write_P(led_usb_state & (1<<USB_LED_SCROLL_LOCK) ? PSTR("SCRLK") : PSTR(" "), false); + +#if defined(RGB_MATRIX_ENABLE) + oled_set_cursor(0, oled_max_lines() - 7); + oled_write_P(PSTR("-----"), false); + static char buffer[26] = {0}; + snprintf(buffer, sizeof(buffer), "h%3d s%3d v%3d s%3d m%3d\n", rgb_matrix_config.hsv.h, rgb_matrix_config.hsv.s, rgb_matrix_config.hsv.v, rgb_matrix_config.speed, rgb_matrix_config.mode); + oled_write(buffer, false); +#elif defined(RGBLIGHT_ENABLE) + oled_set_cursor(0, oled_max_lines() - 7); + oled_write_P(PSTR("-----"), false); + static char buffer[31] = {0}; + snprintf(buffer, sizeof(buffer), "h%3d s%3d v%3d s%3d m%3d\n", rgblight_config.hue, rgblight_config.sat, rgblight_config.val, rgblight_config.speed, rgblight_config.mode); + oled_write(buffer, false); +#endif +} + +oled_rotation_t oled_init_user(oled_rotation_t rotation) { + if (is_keyboard_master()) + return OLED_ROTATION_270; + return OLED_ROTATION_180; +} + +#else // OLED_90ROTATION + +static void render_layer(uint8_t layer) +{ + switch (layer) + { + case _QWERTY: + oled_write_P(PSTR("Default\n"), false); + break; +#ifndef GAMELAYER_DISABLE + case _GAME: + oled_write_P(PSTR("Game\n"), false); + break; +#endif + case _LOWER: + oled_write_P(PSTR("Lower\n"), false); + break; + case _RAISE: + oled_write_P(PSTR("Raise\n"), false); + break; +#ifdef TRILAYER_ENABLED + case _ADJUST: + oled_write_P(PSTR("Adjust\n"), false); + break; +#endif + } +} + +static void render_status(void) +{ + // Render to mode icon + static const char PROGMEM mode_logo[2][3] = { + {0x97,0x98,0}, + {0xb7,0xb8,0} + }; + + oled_write_P(mode_logo[0], false); + +#if defined(RGB_MATRIX_ENABLE) + static char buffer[20] = {0}; + snprintf(buffer, sizeof(buffer), " h%3d s%3d v%3d\n", rgb_matrix_config.hsv.h, rgb_matrix_config.hsv.s, rgb_matrix_config.hsv.v); + oled_write(buffer, false); +#elif defined(RGBLIGHT_ENABLE) + static char buffer[20] = {0}; + snprintf(buffer, sizeof(buffer), " h%3d s%3d v%3d\n", rgblight_config.hue, rgblight_config.sat, rgblight_config.val); + oled_write(buffer, false); +#else + oled_write_P(PSTR("\n")); +#endif + + oled_write_P(mode_logo[1], false); + +#if defined(RGB_MATRIX_ENABLE) + snprintf(buffer, sizeof(buffer), " s%3d m%3d\n", rgb_matrix_config.speed, rgb_matrix_config.mode); + oled_write(buffer, false); +#elif defined(RGBLIGHT_ENABLE) + snprintf(buffer, sizeof(buffer), " s%3d m%3d\n", rgblight_config.speed, rgblight_config.mode); + oled_write(buffer, false); +#else + oled_write_P(PSTR("\n")); +#endif + + // Define layers here, Have not worked out how to have text displayed for each layer. Copy down the number you see and add a case for it below + oled_write_P(PSTR("Layer: "), false); + uint8_t layer = biton(layer_state); + if (layer != _QWERTY) + render_layer(layer); + else + render_layer(biton32(default_layer_state)); + + // Host Keyboard LED Status + uint8_t led_usb_state = host_keyboard_leds(); + oled_write_P(led_usb_state & (1<<USB_LED_NUM_LOCK) ? PSTR("NUMLCK ") : PSTR(" "), false); + oled_write_P(led_usb_state & (1<<USB_LED_CAPS_LOCK) ? PSTR("CAPLCK ") : PSTR(" "), false); + oled_write_P(led_usb_state & (1<<USB_LED_SCROLL_LOCK) ? PSTR("SCRLCK ") : PSTR(" "), false); +} + +#endif // OLED_90ROTATION + +void oled_task_user(void) +{ + if (is_keyboard_master()) + render_status(); + else + { + render_logo(); + oled_scroll_left(); + } +} + +#endif diff --git a/users/xulkal/custom_oled.h b/users/xulkal/custom_oled.h new file mode 100644 index 000000000..010d4b138 --- /dev/null +++ b/users/xulkal/custom_oled.h @@ -0,0 +1,2 @@ +#pragma once +#include "quantum.h" diff --git a/users/xulkal/custom_tap_dance.c b/users/xulkal/custom_tap_dance.c new file mode 100644 index 000000000..7123f1be6 --- /dev/null +++ b/users/xulkal/custom_tap_dance.c @@ -0,0 +1,62 @@ +#include "custom_tap_dance.h" +#include "custom_keycodes.h" +#include "timer_utils.h" + +#ifdef TAP_DANCE_ENABLE + +//Tap Dance Definitions +qk_tap_dance_action_t tap_dance_actions[] = { + [COMM_QUOT] = ACTION_TAP_DANCE_DOUBLE(KC_COMM, KC_QUOT), + [BACKSPACE] = ACTION_TAP_DANCE_DOUBLE (KC_BSPACE, LCTL(KC_BSPACE)), + [DELETE] = ACTION_TAP_DANCE_DOUBLE (KC_DELETE, LCTL(KC_DELETE)), + [DOT] = ACTION_TAP_DANCE_DOUBLE (KC_DOT, KC_GRAVE) +}; + +#else + +static uint16_t td_keycode; +static uint16_t td_timer; + +const uint16_t PROGMEM td_keymaps[TD_MAX - TD_MIN][2] = { + [TD_COMM - TD_MIN] = { KC_COMM, KC_QUOT }, + [TD_BSPC - TD_MIN] = { KC_BSPACE, LCTL(KC_BSPACE) }, + [TD_DEL - TD_MIN] = { KC_DELETE, LCTL(KC_DELETE) }, + [TD_DOT - TD_MIN] = { KC_DOT, KC_GRAVE } +}; + +void run_tap_dance_double(uint8_t i) +{ + tap_code16(pgm_read_word(&td_keymaps[td_keycode - TD_MIN][i])); + td_keycode = KC_TRANSPARENT; + td_timer = timer_read() + TAPPING_TERM; +} + +bool process_tap_dance_double(uint16_t keycode, keyrecord_t *record) +{ + if (TD_MIN <= keycode && keycode < TD_MAX) + { + if (record->event.pressed) + { + if (td_keycode != keycode || timer_expired(td_timer)) + { + td_keycode = keycode; + td_timer = timer_read() + TAPPING_TERM; + } + else + run_tap_dance_double(1); + } + return false; + } + + if (td_keycode != KC_TRANSPARENT) + run_tap_dance_double(0); + return true; +} + +void matrix_scan_user(void) +{ + if (td_keycode != KC_TRANSPARENT && timer_expired(td_timer)) + run_tap_dance_double(0); +} + +#endif diff --git a/users/xulkal/custom_tap_dance.h b/users/xulkal/custom_tap_dance.h new file mode 100644 index 000000000..33398808d --- /dev/null +++ b/users/xulkal/custom_tap_dance.h @@ -0,0 +1,26 @@ +#pragma once +#include "quantum.h" + +#ifdef TAP_DANCE_ENABLE + +#include "process_tap_dance.h" + +//Tap Dance Declarations +enum { + COMM_QUOT = 0, + BACKSPACE, + DELETE, + DOT +}; + +#define TD_COMM TD(COMM_QUOT) +#define TD_BSPC TD(BACKSPACE) +#define TD_DEL TD(DELETE) +#define TD_DOT TD(DOT) + +#else + +void run_tap_dance_double(uint8_t i); +bool process_tap_dance_double(uint16_t keycode, keyrecord_t *record); + +#endif diff --git a/users/xulkal/layouts.h b/users/xulkal/layouts.h index 2cd309f76..65dad8c63 100644 --- a/users/xulkal/layouts.h +++ b/users/xulkal/layouts.h @@ -15,7 +15,7 @@ */ #define _________________QWERTY_L1_________________ KC_GESC, KC_1, KC_2, KC_3, KC_4, KC_5 -#define _________________QWERTY_L2_________________ TD_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T +#define _________________QWERTY_L2_________________ KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T #define _________________QWERTY_L3_________________ RIS_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G #define _________________QWERTY_L4_________________ KC_LSPO, KC_Z, KC_X, KC_C, KC_V, KC_B #define _________________QWERTY_L5_________________ KC_LCPO, KC_LGUI, LOWER, RAISE, KC_LALT, KC_SPC @@ -23,7 +23,7 @@ #define _________________QWERTY_R1_________________ KC_6, KC_7, KC_8, KC_9, KC_0, TD_BSPC #define _________________QWERTY_R2_________________ KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLS #define _________________QWERTY_R3_________________ KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_ENT -#define _________________QWERTY_R4_________________ KC_N, KC_M, TD_COMM, KC_DOT, KC_SLASH, KC_RSPC +#define _________________QWERTY_R4_________________ KC_N, KC_M, TD_COMM, TD_DOT, KC_SLASH, KC_RSPC #define _________________QWERTY_R5_________________ KC_SPC, KC_LEFT, KC_UP, KC_DOWN, KC_RIGHT, KC_RCPC @@ -50,7 +50,7 @@ * |------+------+------+------+------+------| |------+------+------+------+------+------| * | | | | | | | | | | | | | | * |------+------+------+------+------+------| |------+------+------+------+------+------| - * | | | | | | | | | PREV | VOL- | VOL+ | NEXT | PLAY | + * | | | | | | | | | PREV | VOL+ | VOL- | NEXT | PLAY | * `-----------------------------------------' `-----------------------------------------' */ @@ -64,11 +64,11 @@ #define __________________RAISE_R2_________________ _______, KC_INS, KC_HOME, KC_PGUP, KC_PSCR, _______ #define __________________RAISE_R3_________________ _______, KC_DEL, KC_END, KC_PGDN, KC_SLCK, _______ #define __________________RAISE_R4_________________ _______, _______, _______, _______, _______, _______ -#define __________________RAISE_R5_________________ _______, KC_MPRV, KC_MPRV, KC_VOLD, KC_MNXT, KC_MPLY +#define __________________RAISE_R5_________________ _______, KC_MPRV, KC_VOLU, KC_VOLD, KC_MNXT, KC_MPLY /* LOWER Layout * ,-----------------------------------------. ,-----------------------------------------. - * | | | | | | | | | | | | | | + * | |RGBMD |RGBRMD|RGBTOG| | | | | | | | | | * |------+------+------+------+------+------| |------+------+------+------+------+------| * | SPDI | SAI | VAI | HUI | RESET| | | | | 7 | 8 | 9 | | * |------+------+------+------+------+------| |------+------+------+------+------+------| @@ -80,7 +80,7 @@ * `-----------------------------------------' `-----------------------------------------' */ -#define __________________LOWER_L1_________________ _______, RGB_RMOD, RGB_MOD, _______, _______, _______ +#define __________________LOWER_L1_________________ _______, RGB_RMOD, RGB_MOD, RGB_TOG, _______, _______ #define __________________LOWER_L2_________________ RGB_SPI, RGB_SAI, RGB_VAI, RGB_HUI, RESET, _______ #define __________________LOWER_L3_________________ RGB_SPD, RGB_SAD, RGB_VAD, RGB_HUD, RGBRST, _______ #define __________________LOWER_L4_________________ _______, _______, _______, _______, _______, _______ diff --git a/users/xulkal/process_records.c b/users/xulkal/process_records.c index 531f99eb0..115623caa 100644 --- a/users/xulkal/process_records.c +++ b/users/xulkal/process_records.c @@ -1,93 +1,58 @@ #include "process_records.h" - -#ifdef TAP_DANCE_ENABLE -//Tap Dance Definitions -qk_tap_dance_action_t tap_dance_actions[] = { - [COMM_QUOT] = ACTION_TAP_DANCE_DOUBLE(KC_COMM, KC_QUOT), - [BACKSPACE] = ACTION_TAP_DANCE_DOUBLE (KC_BSPACE, LCTL(KC_BSPACE)), - [TAP_TAB] = ACTION_TAP_DANCE_DOUBLE (KC_TAB, LSFT(KC_TAB)), - [CTRL_MINUS] = ACTION_TAP_DANCE_DOUBLE (KC_LCTL, KC_MINS), - [CTRL_PLUS] = ACTION_TAP_DANCE_DOUBLE (KC_RCTL, KC_EQL) -}; -#endif +#include "custom_keycodes.h" +#include "timer_utils.h" #if defined(RGB_MATRIX_ENABLE) extern void eeconfig_update_rgb_matrix_default(void); #endif -bool process_record_user(uint16_t keycode, keyrecord_t *record) { - switch (keycode) { - case QWERTY: - if (record->event.pressed) { - set_single_persistent_default_layer(_QWERTY); - } - return false; - break; - case GAME: -#ifndef GAMELAYER_DISABLE - if (record->event.pressed) { - set_single_persistent_default_layer(_GAME); - } -#endif - return false; - break; - case LOWER: - if (record->event.pressed) { - layer_on(_LOWER); -#ifdef TRILAYER_ENABLED - update_tri_layer(_LOWER, _RAISE, _ADJUST); -#endif - } else { - layer_off(_LOWER); #ifdef TRILAYER_ENABLED - update_tri_layer(_LOWER, _RAISE, _ADJUST); -#endif - } - return false; - break; - case RAISE: - if (record->event.pressed) { - layer_on(_RAISE); -#ifdef TRILAYER_ENABLED - update_tri_layer(_LOWER, _RAISE, _ADJUST); +uint32_t layer_state_set_user(uint32_t state) +{ + return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST); +} #endif - } else { - layer_off(_RAISE); -#ifdef TRILAYER_ENABLED - update_tri_layer(_LOWER, _RAISE, _ADJUST); + +bool process_record_user(uint16_t keycode, keyrecord_t *record) +{ + static uint16_t reset_timer; + +#ifndef TAP_DANCE_ENABLE + if (!process_tap_dance_double(keycode, record)) + return false; #endif - } - return false; - break; - case RGBRST: + + switch (keycode) + { + case RGBRST: + { #if defined(RGBLIGHT_ENABLE) - if (record->event.pressed) { - eeconfig_update_rgblight_default(); - rgblight_enable(); - } + if (record->event.pressed) + { + eeconfig_update_rgblight_default(); + rgblight_enable(); + } #elif defined(RGB_MATRIX_ENABLE) - if (record->event.pressed) { - eeconfig_update_rgb_matrix_default(); - } -#endif - return false; - break; + if (record->event.pressed) + eeconfig_update_rgb_matrix_default(); +#endif + } + return false; + case RESET: + { + if (record->event.pressed) + reset_timer = timer_read() + 500; + else if (timer_expired(reset_timer)) + reset_keyboard(); + } + return false; } - return process_record_keymap(keycode, record) && -#if defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE) - process_record_rgb(keycode, record) && -#endif // RGBLIGHT_ENABLE; - true; + return process_record_keymap(keycode, record); } __attribute__ ((weak)) -bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { - return true; -} - - -__attribute__ ((weak)) -bool process_record_rgb(uint16_t keycode, keyrecord_t *record) { - return true; +bool process_record_keymap(uint16_t keycode, keyrecord_t *record) +{ + return true; } diff --git a/users/xulkal/process_records.h b/users/xulkal/process_records.h index 9e4295380..701ef7e74 100644 --- a/users/xulkal/process_records.h +++ b/users/xulkal/process_records.h @@ -1,49 +1,17 @@ #pragma once #include "quantum.h" - -#define RIS_ESC LT(_RAISE, KC_ESC) -#define RIS_CAPS LT(_RAISE, KC_CAPS) - -#ifdef TAP_DANCE_ENABLE -#include "process_tap_dance.h" - -//Tap Dance Declarations -enum { - COMM_QUOT = 0, - BACKSPACE, - TAP_TAB, - CTRL_MINUS, - CTRL_PLUS -}; - -#define TD_COMM TD(COMM_QUOT) -#define TD_BSPC TD(BACKSPACE) -#define TD_TAB TD(TAP_TAB) -#define TD_LCTL TD(CTRL_MINUS) -#define TD_RCTL TD(CTRL_PLUS) -#else -#define TD_COMM KC_COMM -#define TD_BSPC KC_BSPACE -#define TD_TAB KC_TAB -#define TD_LCTL KC_LCTL -#define TD_RCTL KC_RCTL -#endif +#include "custom_tap_dance.h" enum layer_number { _QWERTY = 0, +#ifndef GAMELAYER_DISABLE _GAME, +#endif _LOWER, _RAISE, +#ifdef TRILAYER_ENABLED _ADJUST -}; - -enum custom_keycodes { - QWERTY = SAFE_RANGE, - GAME, - LOWER, - RAISE, - RGBRST +#endif }; bool process_record_keymap(uint16_t keycode, keyrecord_t *record); -bool process_record_rgb(uint16_t keycode, keyrecord_t *record); diff --git a/users/xulkal/rules.mk b/users/xulkal/rules.mk index 6758f52f5..ab0231d7d 100644 --- a/users/xulkal/rules.mk +++ b/users/xulkal/rules.mk @@ -1,10 +1,14 @@ SRC += xulkal.c \ - process_records.c + process_records.c \ + custom_tap_dance.c \ + custom_encoder.c \ + custom_oled.c \ + timer_utils.c # Some usual defaults MOUSEKEY_ENABLE = no # Mouse keys (+4700) EXTRAKEY_ENABLE = yes # Audio control and System control (+450) -TAP_DANCE_ENABLE = yes # Enable the tap dance feature. (+1100) +TAP_DANCE_ENABLE = yes ifneq ($(strip $(DISABLE_LTO)), yes) EXTRAFLAGS += -flto diff --git a/users/xulkal/timer_utils.c b/users/xulkal/timer_utils.c new file mode 100644 index 000000000..5f5d9a1eb --- /dev/null +++ b/users/xulkal/timer_utils.c @@ -0,0 +1,12 @@ +#include "timer_utils.h" + +bool timer_expired(uint16_t last) +{ + return timer_read() - last < 0x8000; +} + +bool timer_expired32(uint32_t last) +{ + return timer_read32() - last < 0x80000000; +} + diff --git a/users/xulkal/timer_utils.h b/users/xulkal/timer_utils.h new file mode 100644 index 000000000..7e2a0b74d --- /dev/null +++ b/users/xulkal/timer_utils.h @@ -0,0 +1,6 @@ +#pragma once +#include "timer.h" +#include <stdbool.h> + +bool timer_expired(uint16_t last); +bool timer_expired32(uint32_t last); diff --git a/users/xulkal/xulkal.h b/users/xulkal/xulkal.h index ae7359923..9bc83b7de 100644 --- a/users/xulkal/xulkal.h +++ b/users/xulkal/xulkal.h @@ -2,3 +2,6 @@ #include "process_records.h" #include "layouts.h" +#include "timer_utils.h" +#include "custom_keycodes.h" +#include "custom_tap_dance.h" |