forked from qmk/qmk_firmware
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
416eb1d
commit 86855f4
Showing
13 changed files
with
741 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
DISABLE_LTO = yes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
SRC += muse.c | ||
|
||
ENCODER_ENABLE = no | ||
|
||
OPT_DEFS += -DTRILAYER_ENABLED | ||
OPT_DEFS += -DAUDIO_CLICKY |
Oops, something went wrong.