From 86855f4417a3793b1e33a8288f2755b782ef3228 Mon Sep 17 00:00:00 2001 From: Ryan Caltabiano Date: Thu, 28 Feb 2019 21:20:26 -0600 Subject: Xulkal Keymaps --- 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 +++++++ 6 files changed, 457 insertions(+) create mode 100644 keyboards/massdrop/ctrl/keymaps/xulkal/keymap.c create mode 100644 keyboards/massdrop/ctrl/keymaps/xulkal/rules.mk create mode 100644 keyboards/preonic/keymaps/xulkal/keymap.c create mode 100644 keyboards/preonic/keymaps/xulkal/rules.mk create mode 100644 keyboards/sol/keymaps/xulkal/keymap.c create mode 100644 keyboards/sol/keymaps/xulkal/rules.mk (limited to 'keyboards') diff --git a/keyboards/massdrop/ctrl/keymaps/xulkal/keymap.c b/keyboards/massdrop/ctrl/keymaps/xulkal/keymap.c new file mode 100644 index 0000000000..1e50b4a53c --- /dev/null +++ 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 new file mode 100644 index 0000000000..f78fb3237b --- /dev/null +++ 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 new file mode 100644 index 0000000000..967cd5a0ab --- /dev/null +++ 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 new file mode 100644 index 0000000000..f7e76252cd --- /dev/null +++ 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 new file mode 100644 index 0000000000..be64d9e7c3 --- /dev/null +++ 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<