1 #include QMK_KEYBOARD_H
4 U_T_AUTO = SAFE_RANGE, //USB Extra Port Toggle Auto Detect / Always Active
5 U_T_AGCR, //USB Toggle Automatic GCR control
6 DBG_TOG, //DEBUG Toggle On / Off
7 DBG_MTRX, //DEBUG Toggle Matrix Prints
8 DBG_KBD, //DEBUG Toggle Keyboard Prints
9 DBG_MOU, //DEBUG Toggle Mouse Prints
10 MD_BOOT, //Restart into bootloader after hold timeout
13 #define TG_NKRO MAGIC_TOGGLE_NKRO //Toggle 6KRO / NKRO mode
15 keymap_config_t keymap_config;
17 const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
19 KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_DEL, \
20 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_HOME, \
21 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_PGUP, \
22 KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_PGDN, \
23 KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(1), KC_LEFT, KC_DOWN, KC_RGHT \
26 KC_GRV, 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_MUTE, \
27 _______, RGB_SPD, RGB_VAI, RGB_SPI, RGB_HUI, RGB_SAI, _______, U_T_AUTO,U_T_AGCR,_______, KC_PSCR, KC_SLCK, KC_PAUS, _______, KC_END, \
28 _______, RGB_RMOD,RGB_VAD, RGB_MOD, RGB_HUD, RGB_SAD, _______, _______, _______, _______, _______, _______, _______, KC_VOLU, \
29 _______, RGB_TOG, _______, _______, _______, MD_BOOT, TG_NKRO, DBG_TOG, _______, _______, _______, _______, KC_PGUP, KC_VOLD, \
30 _______, _______, _______, _______, _______, _______, KC_HOME, KC_PGDN, KC_END \
34 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \
35 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \
36 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \
37 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \
38 _______, _______, _______, _______, _______, _______, _______, _______, _______ \
43 // Runs just one time when the keyboard initializes.
44 void matrix_init_user(void) {
47 // Runs constantly in the background, in a loop.
48 void matrix_scan_user(void) {
51 #define MODS_SHIFT (get_mods() & MOD_BIT(KC_LSHIFT) || get_mods() & MOD_BIT(KC_RSHIFT))
52 #define MODS_CTRL (get_mods() & MOD_BIT(KC_LCTL) || get_mods() & MOD_BIT(KC_RCTRL))
53 #define MODS_ALT (get_mods() & MOD_BIT(KC_LALT) || get_mods() & MOD_BIT(KC_RALT))
55 bool process_record_user(uint16_t keycode, keyrecord_t *record) {
56 static uint32_t key_timer;
60 if (record->event.pressed && MODS_SHIFT && MODS_CTRL) {
61 TOGGLE_FLAG_AND_PRINT(usb_extra_manual, "USB extra port manual mode");
65 if (record->event.pressed && MODS_SHIFT && MODS_CTRL) {
66 TOGGLE_FLAG_AND_PRINT(usb_gcr_auto, "USB GCR auto mode");
70 if (record->event.pressed) {
71 TOGGLE_FLAG_AND_PRINT(debug_enable, "Debug mode");
75 if (record->event.pressed) {
76 TOGGLE_FLAG_AND_PRINT(debug_matrix, "Debug matrix");
80 if (record->event.pressed) {
81 TOGGLE_FLAG_AND_PRINT(debug_keyboard, "Debug keyboard");
85 if (record->event.pressed) {
86 TOGGLE_FLAG_AND_PRINT(debug_mouse, "Debug mouse");
90 if (record->event.pressed) {
91 key_timer = timer_read32();
93 if (timer_elapsed32(key_timer) >= 500) {
99 if (record->event.pressed) {
100 switch (rgb_matrix_get_flags()) {
102 rgb_matrix_set_flags(LED_FLAG_KEYLIGHT);
103 rgb_matrix_set_color_all(0, 0, 0);
106 case LED_FLAG_KEYLIGHT: {
107 rgb_matrix_set_flags(LED_FLAG_UNDERGLOW);
108 rgb_matrix_set_color_all(0, 0, 0);
111 case LED_FLAG_UNDERGLOW: {
112 rgb_matrix_set_flags(LED_FLAG_NONE);
113 rgb_matrix_disable_noeeprom();
117 rgb_matrix_set_flags(LED_FLAG_ALL);
118 rgb_matrix_enable_noeeprom();
125 return true; //Process all other keycodes normally