qmk

Unnamed repository; edit this file 'description' to name the repository.
git clone git://git.z3bra.org/qmk.git
Log | Files | Refs | Submodules | LICENSE

commit 86855f4417a3793b1e33a8288f2755b782ef3228
parent 416eb1dee7163ae7456e5b2288a2b67790b997c3
Author: Ryan Caltabiano <rcalt2vt@gmail.com>
Date:   Thu, 28 Feb 2019 21:20:26 -0600

Xulkal Keymaps

Diffstat:
keyboards/massdrop/ctrl/keymaps/xulkal/keymap.c | 105+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
keyboards/massdrop/ctrl/keymaps/xulkal/rules.mk | 1+
keyboards/preonic/keymaps/xulkal/keymap.c | 148+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
keyboards/preonic/keymaps/xulkal/rules.mk | 6++++++
keyboards/sol/keymaps/xulkal/keymap.c | 155+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
keyboards/sol/keymaps/xulkal/rules.mk | 42++++++++++++++++++++++++++++++++++++++++++
users/xulkal/config.h | 13+++++++++++++
users/xulkal/layouts.h | 119+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
users/xulkal/process_records.c | 85+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
users/xulkal/process_records.h | 49+++++++++++++++++++++++++++++++++++++++++++++++++
users/xulkal/rules.mk | 13+++++++++++++
users/xulkal/xulkal.c | 1+
users/xulkal/xulkal.h | 4++++
13 files changed, 741 insertions(+), 0 deletions(-)

diff --git a/keyboards/massdrop/ctrl/keymaps/xulkal/keymap.c b/keyboards/massdrop/ctrl/keymaps/xulkal/keymap.c @@ -0,0 +1,105 @@ +#include QMK_KEYBOARD_H +#include "xulkal.h" + +enum ctrl_keycodes { + U_T_AUTO = SAFE_RANGE, //USB Extra Port Toggle Auto Detect / Always Active + U_T_AGCR, //USB Toggle Automatic GCR control + DBG_TOG, //DEBUG Toggle On / Off + DBG_MTRX, //DEBUG Toggle Matrix Prints + DBG_KBD, //DEBUG Toggle Keyboard Prints + DBG_MOU, //DEBUG Toggle Mouse Prints + MD_BOOT, //Restart into bootloader after hold timeout +}; + +#define TG_NKRO MAGIC_TOGGLE_NKRO //Toggle 6KRO / NKRO mode + +keymap_config_t keymap_config; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [0] = LAYOUT( + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, KC_SLCK, KC_PAUS, \ + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, TD_BSPC, KC_INS, KC_HOME, KC_PGUP, \ + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN, \ + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, \ + KC_LSPO, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, TD_COMM, KC_DOT, KC_SLSH, KC_RSPC, KC_UP, \ + KC_LCPO, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(1), KC_APP, KC_RCPC, KC_LEFT, KC_DOWN, KC_RGHT \ + ), + [1] = LAYOUT( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MUTE, _______, _______, \ + _______, RGB_RMOD, RGB_MOD,_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MPLY, KC_MSTP, KC_VOLU, \ + RGB_SPI, RGB_SAI, RGB_VAI, RGB_HUI, MD_BOOT, _______, _______, U_T_AUTO,U_T_AGCR,_______, _______, _______, _______, _______, KC_MPRV, KC_MNXT, KC_VOLD, \ + RGB_SPD, RGB_SAD, RGB_VAD, RGB_HUD, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + _______, RGB_TOG, _______, _______, _______, _______, TG_NKRO, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ \ + ), + /* + [X] = LAYOUT( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, TG_NKRO, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ \ + ), + */ +}; + +// Runs just one time when the keyboard initializes. +void matrix_init_user(void) { +}; + +// Runs constantly in the background, in a loop. +void matrix_scan_user(void) { +}; + +#define MODS_SHIFT (get_mods() & MOD_BIT(KC_LSHIFT) || get_mods() & MOD_BIT(KC_RSHIFT)) +#define MODS_CTRL (get_mods() & MOD_BIT(KC_LCTL) || get_mods() & MOD_BIT(KC_RCTRL)) +#define MODS_ALT (get_mods() & MOD_BIT(KC_LALT) || get_mods() & MOD_BIT(KC_RALT)) + +bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { + static uint32_t key_timer; + + switch (keycode) { + case U_T_AUTO: + if (record->event.pressed && MODS_SHIFT && MODS_CTRL) { + TOGGLE_FLAG_AND_PRINT(usb_extra_manual, "USB extra port manual mode"); + } + return false; + case U_T_AGCR: + if (record->event.pressed && MODS_SHIFT && MODS_CTRL) { + TOGGLE_FLAG_AND_PRINT(usb_gcr_auto, "USB GCR auto mode"); + } + return false; + case DBG_TOG: + if (record->event.pressed) { + TOGGLE_FLAG_AND_PRINT(debug_enable, "Debug mode"); + } + return false; + case DBG_MTRX: + if (record->event.pressed) { + TOGGLE_FLAG_AND_PRINT(debug_matrix, "Debug matrix"); + } + return false; + case DBG_KBD: + if (record->event.pressed) { + TOGGLE_FLAG_AND_PRINT(debug_keyboard, "Debug keyboard"); + } + return false; + case DBG_MOU: + if (record->event.pressed) { + TOGGLE_FLAG_AND_PRINT(debug_mouse, "Debug mouse"); + } + return false; + case MD_BOOT: + if (record->event.pressed) { + key_timer = timer_read32(); + } else { + if (timer_elapsed32(key_timer) >= 500) { + reset_keyboard(); + } + } + return false; + default: + return true; //Process all other keycodes normally + } +} diff --git a/keyboards/massdrop/ctrl/keymaps/xulkal/rules.mk b/keyboards/massdrop/ctrl/keymaps/xulkal/rules.mk @@ -0,0 +1 @@ +DISABLE_LTO = yes diff --git a/keyboards/preonic/keymaps/xulkal/keymap.c b/keyboards/preonic/keymaps/xulkal/keymap.c @@ -0,0 +1,148 @@ +#include QMK_KEYBOARD_H +#include "xulkal.h" + +#include "muse.h" + +#define EXPAND_LAYOUT(...) LAYOUT_preonic_grid(__VA_ARGS__) + +// Define your non-alpha grouping in this define's LAYOUT, and all your BASE_LAYERS will share the same mod/macro columns + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + /* Qwerty Layout + * ,------------------------------------------------. ,------------------------------------------------. + * | GESC | 1 | 2 | 3 | 4 | 5 | - | | = | 6 | 7 | 8 | 9 | 0 | BkSp | + * |------+------+------+------+------+------|------| |------|------+------+------+------+------+------| + * | Tab | Q | W | E | R | T | [ | | ] | Y | U | I | O | P | \ | + * |------+------+------+------+------+------|------| |------|------+------+------+------+------+------| + * |FN(CAPS)| A | S | D | F | G | ` | | ' | H | J | K | L | ; | Enter| + * |------+------+------+------+------+------+------| |------+------+------+------+------+------+------| + * | Sft[ | Z | X | C | V | B | RGB | |RGBRST| N | M | , | . | / | Sft] | + * |------+------+------+------+------+------+------| |------+------+------+------+------+------+------| + * | Ctrl | Win | LOWER| RAISE| Alt | Space|RGBRMOD| |RGBMOD| Space| Left | Up | Down | Right| Ctrl | + * |------+------+------+------+------+------+------| |------+------+------+------+------+------+------' + * | Space| DEL | | Enter| Space| + * `-------------' `-------------' + */ + [_QWERTY] = EXPAND_LAYOUT( \ + _________________QWERTY_L1_________________, _________________QWERTY_R1_________________, \ + _________________QWERTY_L2_________________, _________________QWERTY_R2_________________, \ + _________________QWERTY_L3_________________, _________________QWERTY_R3_________________, \ + _________________QWERTY_L4_________________, _________________QWERTY_R4_________________, \ + _________________QWERTY_L5_________________, _________________QWERTY_R5_________________ \ + ), + +#ifndef GAMELAYER_DISABLE + [_GAME] = EXPAND_LAYOUT( \ + ___________________GAME_L1_________________, ___________________GAME_R1_________________, \ + ___________________GAME_L2_________________, ___________________GAME_R2_________________, \ + ___________________GAME_L3_________________, ___________________GAME_R3_________________, \ + ___________________GAME_L4_________________, ___________________GAME_R4_________________, \ + ___________________GAME_L5_________________, ___________________GAME_R5_________________ \ + ), +#endif + + [_LOWER] = EXPAND_LAYOUT( \ + __________________LOWER_L1_________________, __________________LOWER_R1_________________, \ + __________________LOWER_L2_________________, __________________LOWER_R2_________________, \ + __________________LOWER_L3_________________, __________________LOWER_R3_________________, \ + __________________LOWER_L4_________________, __________________LOWER_R4_________________, \ + __________________LOWER_L5_________________, __________________LOWER_R5_________________ \ + ), + + [_RAISE] = EXPAND_LAYOUT( \ + __________________RAISE_L1_________________, __________________RAISE_R1_________________, \ + __________________RAISE_L2_________________, __________________RAISE_R2_________________, \ + __________________RAISE_L3_________________, __________________RAISE_R3_________________, \ + __________________RAISE_L4_________________, __________________RAISE_R4_________________, \ + __________________RAISE_L5_________________, __________________RAISE_R5_________________ \ + ), + +#ifdef TRILAYER_ENABLED + [_ADJUST] = EXPAND_LAYOUT( \ + _________________ADJUST_L1_________________, _________________ADJUST_R1_________________, \ + _________________ADJUST_L2_________________, _________________ADJUST_R2_________________, \ + _________________ADJUST_L3_________________, _________________ADJUST_R3_________________, \ + _________________ADJUST_L4_________________, _________________ADJUST_R4_________________, \ + _________________ADJUST_L5_________________, _________________ADJUST_R5_________________ \ + ), +#endif +}; + +bool muse_mode = false; +uint8_t last_muse_note = 0; +uint16_t muse_counter = 0; +uint8_t muse_offset = 70; +uint16_t muse_tempo = 50; + +void encoder_update_user(uint8_t index, bool clockwise) { + if (muse_mode) { + if (IS_LAYER_ON(_RAISE)) { + if (clockwise) { + muse_offset++; + } else { + muse_offset--; + } + } else { + if (clockwise) { + muse_tempo+=1; + } else { + muse_tempo-=1; + } + } + } else { + if (clockwise) { + register_code(KC_PGDN); + unregister_code(KC_PGDN); + } else { + register_code(KC_PGUP); + unregister_code(KC_PGUP); + } + } +} + +void dip_update(uint8_t index, bool active) { + switch (index) { + case 0: + if (active) { + layer_on(_ADJUST); + } else { + layer_off(_ADJUST); + } + break; + case 1: + if (active) { + muse_mode = true; + } else { + muse_mode = false; + #ifdef AUDIO_ENABLE + stop_all_notes(); + #endif + } + } +} + +void matrix_scan_user(void) { + #ifdef AUDIO_ENABLE + if (muse_mode) { + if (muse_counter == 0) { + uint8_t muse_note = muse_offset + SCALE[muse_clock_pulse()]; + if (muse_note != last_muse_note) { + stop_note(compute_freq_for_midi_note(last_muse_note)); + play_note(compute_freq_for_midi_note(muse_note), 0xF); + last_muse_note = muse_note; + } + } + muse_counter = (muse_counter + 1) % muse_tempo; + } + #endif +} + +bool music_mask_user(uint16_t keycode) { + switch (keycode) { + case RAISE: + case LOWER: + return false; + default: + return true; + } +} diff --git a/keyboards/preonic/keymaps/xulkal/rules.mk b/keyboards/preonic/keymaps/xulkal/rules.mk @@ -0,0 +1,6 @@ +SRC += muse.c + +ENCODER_ENABLE = no + +OPT_DEFS += -DTRILAYER_ENABLED +OPT_DEFS += -DAUDIO_CLICKY diff --git a/keyboards/sol/keymaps/xulkal/keymap.c b/keyboards/sol/keymaps/xulkal/keymap.c @@ -0,0 +1,155 @@ +#include QMK_KEYBOARD_H +#include "xulkal.h" + +#ifdef PROTOCOL_LUFA +#include "lufa.h" +#include "split_util.h" +#endif + +#ifdef OLED_DRIVER_ENABLE + #include "oled_driver.h" +#endif + +#define EXPAND_LAYOUT(...) LAYOUT(__VA_ARGS__) + +// Define your non-alpha grouping in this define's LAYOUT, and all your BASE_LAYERS will share the same mod/macro columns + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + /* Qwerty Layout + * ,------------------------------------------------. ,------------------------------------------------. + * | GESC | 1 | 2 | 3 | 4 | 5 | - | | = | 6 | 7 | 8 | 9 | 0 | BkSp | + * |------+------+------+------+------+------|------| |------|------+------+------+------+------+------| + * | Tab | Q | W | E | R | T | [ | | ] | Y | U | I | O | P | \ | + * |------+------+------+------+------+------|------| |------|------+------+------+------+------+------| + * |FN(CAPS)| A | S | D | F | G | ` | | ' | H | J | K | L | ; | Enter| + * |------+------+------+------+------+------+------| |------+------+------+------+------+------+------| + * | Sft[ | Z | X | C | V | B | RGB | |RGBRST| N | M | , | . | / | Sft] | + * |------+------+------+------+------+------+------| |------+------+------+------+------+------+------| + * | Ctrl | Win | LOWER| RAISE| Alt | Space|RGBRMOD| |RGBMOD| Space| Left | Up | Down | Right| Ctrl | + * |------+------+------+------+------+------+------| |------+------+------+------+------+------+------' + * | Space| DEL | | Enter| Space| + * `-------------' `-------------' + */ + [_QWERTY] = EXPAND_LAYOUT( \ + _________________QWERTY_L1_________________, KC_MINS, KC_EQL, _________________QWERTY_R1_________________, \ + _________________QWERTY_L2_________________, KC_LBRC, KC_RBRC, _________________QWERTY_R2_________________, \ + _________________QWERTY_L3_________________, KC_GRV, KC_QUOT, _________________QWERTY_R3_________________, \ + _________________QWERTY_L4_________________, RGB_TOG, RGBRST, _________________QWERTY_R4_________________, \ + _________________QWERTY_L5_________________, RGB_RMOD, RGB_MOD, _________________QWERTY_R5_________________, \ + KC_VOLU, KC_VOLD, KC_SPC, KC_DEL, KC_ENT, KC_SPC, KC_VOLU, KC_VOLD \ + ), + +#ifndef GAMELAYER_DISABLE + [_GAME] = EXPAND_LAYOUT( \ + ___________________GAME_L1_________________, KC_MINS, KC_EQL, ___________________GAME_R1_________________, \ + ___________________GAME_L2_________________, KC_LBRC, KC_RBRC, ___________________GAME_R2_________________, \ + ___________________GAME_L3_________________, KC_GRV, KC_QUOT, ___________________GAME_R3_________________, \ + ___________________GAME_L4_________________, RGB_TOG, RGBRST, ___________________GAME_R4_________________, \ + ___________________GAME_L5_________________, RGB_RMOD, RGB_MOD, ___________________GAME_R5_________________, \ + KC_VOLU, KC_VOLD, KC_SPC, KC_DEL, KC_ENT, KC_SPC, KC_VOLU, KC_VOLD \ + ), +#endif + + [_LOWER] = EXPAND_LAYOUT( \ + __________________LOWER_L1_________________, KC_PMNS, KC_PPLS, __________________LOWER_R1_________________, \ + __________________LOWER_L2_________________, _______, _______, __________________LOWER_R2_________________, \ + __________________LOWER_L3_________________, _______, _______, __________________LOWER_R3_________________, \ + __________________LOWER_L4_________________, _______, _______, __________________LOWER_R4_________________, \ + __________________LOWER_L5_________________, _______, _______, __________________LOWER_R5_________________, \ + _______, _______, _______, _______, _______, _______, _______, _______ \ + ), + + [_RAISE] = EXPAND_LAYOUT( \ + __________________RAISE_L1_________________, _______, _______, __________________RAISE_R1_________________, \ + __________________RAISE_L2_________________, _______, _______, __________________RAISE_R2_________________, \ + __________________RAISE_L3_________________, _______, _______, __________________RAISE_R3_________________, \ + __________________RAISE_L4_________________, _______, _______, __________________RAISE_R4_________________, \ + __________________RAISE_L5_________________, _______, _______, __________________RAISE_R5_________________, \ + _______, _______, _______, _______, _______, _______, _______, _______ \ + ), + +#ifdef TRILAYER_ENABLED + [_RAISE] = EXPAND_LAYOUT( \ + _________________ADJUST_L1_________________, _______, _______, _________________ADJUST_R1_________________, \ + _________________ADJUST_L2_________________, _______, _______, _________________ADJUST_R2_________________, \ + _________________ADJUST_L3_________________, _______, _______, _________________ADJUST_R3_________________, \ + _________________ADJUST_L4_________________, _______, _______, _________________ADJUST_R4_________________, \ + _________________ADJUST_L5_________________, _______, _______, _________________ADJUST_R5_________________, \ + _______, _______, _______, _______, _______, _______, _______, _______ \ + ), +#endif +}; + +//SSD1306 OLED update loop, make sure to add #define SSD1306OLED in config.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][4] = { + {0x97,0x98,0x0a,0}, + {0xb7,0xb8,0x0a,0} }; + + oled_write_P(mode_logo[0], false); + oled_write_P(mode_logo[1], false); + + // 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); + } + + // 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 (has_usb()) { + render_status(); + } else { + render_logo(); + oled_scroll_left(); + } +} + +#endif diff --git a/keyboards/sol/keymaps/xulkal/rules.mk b/keyboards/sol/keymaps/xulkal/rules.mk @@ -0,0 +1,42 @@ +# Build Options +# change to "no" to disable the options, or define them in the Makefile in +# the appropriate keymap folder that will get included automatically +# +BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) +MOUSEKEY_ENABLE = no # Mouse keys(+4700) +EXTRAKEY_ENABLE = yes # Audio control and System control(+450) +CONSOLE_ENABLE = no # Console for debug(+400) +COMMAND_ENABLE = no # Commands for debug and configuration +NKRO_ENABLE = no # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +RGBLIGHT_ENABLE = no # Enable global lighting effects. Do not enable with RGB Matrix +RGBLIGHT_ANIMATIONS = no # LED animations +LED_MIRRORED = no # Mirror LEDs across halves (enable DIP 1 on slave, and DIP 2 and 3 on master) +RGB_MATRIX_ENABLE = WS2812 # Enable per-key coordinate based RGB effects. Do not enable with RGBlight (+8500) +RGB_MATRIX_KEYPRESSES = yes # Enable reactive per-key effects. Can be very laggy (+1500) +RGBLIGHT_FULL_POWER = no # Allow maximum RGB brightness. Otherwise, limited to a safe level for a normal USB-A port +UNICODE_ENABLE = no # Unicode +SWAP_HANDS_ENABLE = no # Enable one-hand typing +ENCODER_ENABLE_CUSTOM = no # Enable rotary encoder (+90) +OLED_DRIVER_ENABLE = yes # Enable the OLED Driver (+5000) +IOS_DEVICE_ENABLE = no # Limit max brightness to connect to IOS device (iPad,iPhone) + +# Do not edit past here + +ifeq ($(strip $(ENCODER_ENABLE_CUSTOM)), yes) + OPT_DEFS += -DENCODER_ENABLE_CUSTOM + SRC += common/knob_v2.c +endif + +ifeq ($(strip $(IOS_DEVICE_ENABLE)), yes) + OPT_DEFS += -DIOS_DEVICE_ENABLE +else ifeq ($(strip $(RGBLIGHT_FULL_POWER)), yes) + OPT_DEFS += -DRGBLIGHT_FULL_POWER +endif + +ifeq ($(strip $(RGB_MATRIX_KEYPRESSES)), yes) + OPT_DEFS += -DRGB_MATRIX_KEYPRESSES +endif + +ifeq ($(strip $(LED_MIRRORED)), yes) + OPT_DEFS += -DLED_MIRRORED +endif diff --git a/users/xulkal/config.h b/users/xulkal/config.h @@ -0,0 +1,13 @@ +#pragma once + +#ifndef TAPPING_FORCE_HOLD +#define TAPPING_FORCE_HOLD +#endif // TAPPING_FORCE_HOLD + +#undef TAPPING_TERM +#define TAPPING_TERM 175 + +#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 RCPO_KEYS KC_RCTL, KC_TRNS, KC_EQL diff --git a/users/xulkal/layouts.h b/users/xulkal/layouts.h @@ -0,0 +1,119 @@ +#pragma once + + /* Qwerty Layout + * ,-----------------------------------------. ,-----------------------------------------. + * | GESC | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | BkSp | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | Tab | Q | W | E | R | T | | Y | U | I | O | P | \ | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * |FN(CAPS)| A | S | D | F | G | | H | J | K | L | ; | Enter| + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | Sft[ | Z | X | C | V | B | | N | M | , | . | / | Sft] | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | Ctrl | Win | ADJ | FN | Alt | Space| | Space| Left | Up | Down | Right| Ctrl | + * `-----------------------------------------' `-----------------------------------------' + */ + +#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_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 + +#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_R5_________________ KC_SPC, KC_LEFT, KC_UP, KC_DOWN, KC_RIGHT, KC_RCPC + + +#define ___________________GAME_L1_________________ KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5 +#define ___________________GAME_L2_________________ KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T +#define ___________________GAME_L3_________________ KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G +#define ___________________GAME_L4_________________ KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B +#define ___________________GAME_L5_________________ KC_LCTL, KC_LGUI, LOWER, RAISE, KC_LALT, KC_SPC + +#define ___________________GAME_R1_________________ KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC +#define ___________________GAME_R2_________________ KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLS +#define ___________________GAME_R3_________________ KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_ENT +#define ___________________GAME_R4_________________ KC_N, KC_M, KC_COMM, KC_DOT, KC_SLASH, KC_RSFT +#define ___________________GAME_R5_________________ KC_SPC, KC_LEFT, KC_UP, KC_DOWN, KC_RIGHT, KC_RCTL + + + /* RAISE Layout + * ,-----------------------------------------. ,-----------------------------------------. + * | F12 | F1 | F2 | F3 | F4 | F5 | | F6 | F7 | F8 | F9 | F10 | F11 | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | | PGDN | UP | PGUP | |QWERTY| | | INS | HOME | PGUP | PRINT| | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | | LEFT | DOWN | RIGHT| | GAME | | | DEL | END | PGDN |SCRLCK| | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | | | | | | | | | | | | | | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | | | | | | | | | PREV | VOL- | VOL+ | NEXT | PLAY | + * `-----------------------------------------' `-----------------------------------------' + */ + +#define __________________RAISE_L1_________________ KC_F12, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5 +#define __________________RAISE_L2_________________ _______, KC_PGDN, KC_UP, KC_PGUP, _______, QWERTY +#define __________________RAISE_L3_________________ _______, KC_LEFT, KC_DOWN, KC_RGHT, _______, GAME +#define __________________RAISE_L4_________________ _______, _______, _______, _______, _______, _______ +#define __________________RAISE_L5_________________ _______, _______, _______, _______, _______, _______ + +#define __________________RAISE_R1_________________ KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11 +#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 + + /* LOWER Layout + * ,-----------------------------------------. ,-----------------------------------------. + * | | | | | | | | | | | | | | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | SPDI | SAI | VAI | HUI | RESET| | | | | 7 | 8 | 9 | | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | SPDD | SAD | VAD | HUD |RGBRST| | | | | 4 | 5 | 6 | | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | | | | | | | | | | 1 | 2 | 3 | | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | | | | | | | | | | | 0 | . | | + * `-----------------------------------------' `-----------------------------------------' + */ + +#define __________________LOWER_L1_________________ _______, RGB_RMOD, RGB_MOD, _______, _______, _______ +#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_________________ _______, _______, _______, _______, _______, _______ +#define __________________LOWER_L5_________________ _______, _______, _______, _______, _______, _______ + +#define __________________LOWER_R1_________________ _______, _______, _______, _______, _______, KC_DEL +#define __________________LOWER_R2_________________ _______, _______, KC_KP_7, KC_KP_8, KC_KP_9, _______ +#define __________________LOWER_R3_________________ _______, _______, KC_KP_4, KC_KP_5, KC_KP_6, _______ +#define __________________LOWER_R4_________________ _______, _______, KC_KP_1, KC_KP_2, KC_KP_3, _______ +#define __________________LOWER_R5_________________ _______, _______, _______, KC_KP_0, KC_PDOT, _______ + + /* ADJUST Layout + * ,-----------------------------------------. ,-----------------------------------------. + * | | | | | | | | | | | | | | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | | RESET| DEBUG| | | | | |TERM_ON|TERM_OFF| | | | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | | |MusMod|Aud on|AudOff|AGnorm| |AGswap|ClkUp |ClkDwn| | | | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | |Voice-|Voice+|Mus on|MusOff|MidiOn| |MidOff|ClkOn |ClkOff| | | | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | | | | | | | | | | | | | | + * `-----------------------------------------' `-----------------------------------------' + */ + +#define _________________ADJUST_L1_________________ _______, _______, _______, _______, _______, _______ +#define _________________ADJUST_L2_________________ _______, RESET, DEBUG, _______, _______, _______ +#define _________________ADJUST_L3_________________ _______, _______, MU_MOD, AU_ON, AU_OFF, AG_NORM +#define _________________ADJUST_L4_________________ _______, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON +#define _________________ADJUST_L5_________________ _______, _______, _______, _______, _______, _______ + +#define _________________ADJUST_R1_________________ _______, _______, _______, _______, _______, _______ +#define _________________ADJUST_R2_________________ _______, TERM_ON, TERM_OFF, _______, _______, _______ +#define _________________ADJUST_R3_________________ AG_SWAP, CK_UP, CK_DOWN, _______, _______, _______ +#define _________________ADJUST_R4_________________ MI_OFF, CK_ON, CK_OFF, _______, _______, _______ +#define _________________ADJUST_R5_________________ _______, _______, _______, _______, _______, _______ diff --git a/users/xulkal/process_records.c b/users/xulkal/process_records.c @@ -0,0 +1,85 @@ +#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 + +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); +#endif + } else { + layer_off(_RAISE); +#ifdef TRILAYER_ENABLED + update_tri_layer(_LOWER, _RAISE, _ADJUST); +#endif + } + return false; + break; + case RGBRST: + #ifdef RGBLIGHT_ENABLE + if (record->event.pressed) { + eeconfig_update_rgblight_default(); + rgblight_enable(); + } + #endif + return false; + break; + } + + return process_record_keymap(keycode, record) && +#if defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE) + process_record_rgb(keycode, record) && +#endif // RGBLIGHT_ENABLE; + true; +} + +__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; +} diff --git a/users/xulkal/process_records.h b/users/xulkal/process_records.h @@ -0,0 +1,49 @@ +#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 + +enum layer_number { + _QWERTY = 0, + _GAME, + _LOWER, + _RAISE, + _ADJUST +}; + +enum custom_keycodes { + QWERTY = SAFE_RANGE, + GAME, + LOWER, + RAISE, + RGBRST +}; + +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 @@ -0,0 +1,13 @@ +SRC += xulkal.c \ + process_records.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 + OPT_DEFS += -DNO_ACTION_MACRO + OPT_DEFS += -DNO_ACTION_FUNCTION +endif diff --git a/users/xulkal/xulkal.c b/users/xulkal/xulkal.c @@ -0,0 +1 @@ +#include "xulkal.h" diff --git a/users/xulkal/xulkal.h b/users/xulkal/xulkal.h @@ -0,0 +1,4 @@ +#pragma once + +#include "process_records.h" +#include "layouts.h"