diff options
Diffstat (limited to 'users')
-rw-r--r-- | users/333fred/333fred.c | 38 | ||||
-rw-r--r-- | users/333fred/333fred.h | 9 | ||||
-rw-r--r-- | users/333fred/333fred_config.h | 1 | ||||
-rw-r--r-- | users/333fred/rgb.c | 12 | ||||
-rw-r--r-- | users/bcat/config.h | 31 | ||||
-rw-r--r-- | users/bcat/rules.mk | 11 | ||||
-rw-r--r-- | users/kuatsure/kuatsure.c | 140 | ||||
-rw-r--r-- | users/kuatsure/kuatsure.h | 32 | ||||
-rw-r--r-- | users/kuatsure/rules.mk | 1 | ||||
-rw-r--r-- | users/stanrc85/layer_rgb.c | 25 | ||||
-rw-r--r-- | users/stanrc85/stanrc85.h | 19 | ||||
-rw-r--r-- | users/xulkal/custom_encoder.c | 13 | ||||
-rw-r--r-- | users/xulkal/custom_encoder.h | 2 | ||||
-rw-r--r-- | users/xulkal/custom_keycodes.h | 28 | ||||
-rw-r--r-- | users/xulkal/custom_oled.c | 96 | ||||
-rw-r--r-- | users/xulkal/custom_oled.h | 2 | ||||
-rw-r--r-- | users/xulkal/custom_tap_dance.c | 61 | ||||
-rw-r--r-- | users/xulkal/custom_tap_dance.h | 26 | ||||
-rw-r--r-- | users/xulkal/layouts.h | 4 | ||||
-rw-r--r-- | users/xulkal/process_records.c | 74 | ||||
-rw-r--r-- | users/xulkal/process_records.h | 44 | ||||
-rw-r--r-- | users/xulkal/rules.mk | 7 | ||||
-rw-r--r-- | users/xulkal/timer_utils.c | 12 | ||||
-rw-r--r-- | users/xulkal/timer_utils.h | 6 | ||||
-rw-r--r-- | users/xulkal/xulkal.h | 3 |
25 files changed, 517 insertions, 180 deletions
diff --git a/users/333fred/333fred.c b/users/333fred/333fred.c index 3b2b36d020..79df8c4dea 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 0e6c6a196f..17f3779b74 100644 --- a/users/333fred/333fred.h +++ b/users/333fred/333fred.h @@ -17,6 +17,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 b158e2d5a2..c099072fc7 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/rgb.c b/users/333fred/rgb.c index a3dfd905cc..5a6d74b5ac 100644 --- a/users/333fred/rgb.c +++ b/users/333fred/rgb.c @@ -1,16 +1,11 @@ #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(255, 255, 20); break; case SYMB: // blue @@ -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 0000000000..a29aded713 --- /dev/null +++ b/users/bcat/config.h @@ -0,0 +1,31 @@ +/* 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 RGVLIGHT_HUE_STEP 8 +#define RGVLIGHT_SAT_STEP 17 +#define RGVLIGHT_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 0000000000..59f82709ad --- /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/kuatsure/kuatsure.c b/users/kuatsure/kuatsure.c index a18713626e..f935e83c74 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 23d3c617cb..8961d56213 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 f0d295aad0..ed7e929054 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/stanrc85/layer_rgb.c b/users/stanrc85/layer_rgb.c index 23eeb3b083..58f17489a1 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)) { 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.h b/users/stanrc85/stanrc85.h index b3d413fa1d..ceb7167e10 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,10 +21,12 @@ #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, diff --git a/users/xulkal/custom_encoder.c b/users/xulkal/custom_encoder.c new file mode 100644 index 0000000000..09f1cda0d1 --- /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 0000000000..010d4b1383 --- /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 0000000000..d4ae0bd477 --- /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 0000000000..77e580b956 --- /dev/null +++ b/users/xulkal/custom_oled.c @@ -0,0 +1,96 @@ +#include "custom_oled.h" +#include "process_records.h" + +#include <stdio.h> + +#ifdef OLED_DRIVER_ENABLE + +static void render_logo(void) +{ + static const char PROGMEM sol_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(sol_logo, false); +} + +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.hue, rgb_matrix_config.sat, rgb_matrix_config.val); + oled_write(buffer, false); +#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); +#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); + switch (biton32(layer_state)) + { + case _QWERTY: +#ifndef GAMELAYER_DISABLE + switch (biton32(default_layer_state)) + { + case _QWERTY: + oled_write_P(PSTR("Default\n"), false); + break; + case _GAME: + oled_write_P(PSTR("Game\n"), false); + break; + default: + oled_write_P(PSTR("Undefined\n"), false); + break; + } +#else + oled_write_P(PSTR("Default\n"), false); +#endif + break; + 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 + default: + oled_write_P(PSTR("Undefined\n"), false); + break; + } + + // 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); +} + +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 0000000000..010d4b1383 --- /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 0000000000..a1c644efd8 --- /dev/null +++ b/users/xulkal/custom_tap_dance.c @@ -0,0 +1,61 @@ +#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)) +}; + +#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 0000000000..33398808d3 --- /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 5180992a88..65dad8c63c 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 diff --git a/users/xulkal/process_records.c b/users/xulkal/process_records.c index 5ba59965fb..115623caa4 100644 --- a/users/xulkal/process_records.c +++ b/users/xulkal/process_records.c @@ -1,56 +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 #ifdef TRILAYER_ENABLED -uint32_t layer_state_set_user(uint32_t state) { - return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST); +uint32_t layer_state_set_user(uint32_t state) +{ + return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST); } #endif -bool process_record_user(uint16_t keycode, keyrecord_t *record) { - static uint16_t reset_timer; - switch (keycode) { - case RGBRST: +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 + + 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(); - } + if (record->event.pressed) + eeconfig_update_rgb_matrix_default(); #endif - return false; - case RESET: - if (record->event.pressed) { - reset_timer = timer_read(); - } else { - if (timer_elapsed(reset_timer) >= 500) { - reset_keyboard(); - } - } - return false; + } + 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); } __attribute__ ((weak)) -bool process_record_keymap(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 8a195df5cd..701ef7e74f 100644 --- a/users/xulkal/process_records.h +++ b/users/xulkal/process_records.h @@ -1,44 +1,6 @@ #pragma once #include "quantum.h" - -#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) - -#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, @@ -52,8 +14,4 @@ enum layer_number { #endif }; -enum custom_keycodes { - RGBRST = SAFE_RANGE -}; - bool process_record_keymap(uint16_t keycode, keyrecord_t *record); diff --git a/users/xulkal/rules.mk b/users/xulkal/rules.mk index 6758f52f5f..50dc75d615 100644 --- a/users/xulkal/rules.mk +++ b/users/xulkal/rules.mk @@ -1,10 +1,13 @@ 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) 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 0000000000..5f5d9a1ebf --- /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 0000000000..7e2a0b74db --- /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 ae73599239..9bc83b7de7 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" |