2018-09-03 16:57:57 -07:00
|
|
|
#include QMK_KEYBOARD_H
|
|
|
|
|
|
|
|
enum ctrl_keycodes {
|
2019-04-03 18:30:47 -07:00
|
|
|
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
|
2018-09-03 16:57:57 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|
|
|
[0] = LAYOUT(
|
2022-12-29 16:48:05 -08:00
|
|
|
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_SCRL, 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, KC_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_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_LCTL, KC_LALT, KC_LGUI, KC_SPC, KC_RGUI, MO(1), KC_APP, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT
|
2018-09-03 16:57:57 -07:00
|
|
|
),
|
|
|
|
[1] = LAYOUT(
|
2022-12-29 16:48:05 -08:00
|
|
|
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MUTE, _______, _______,
|
|
|
|
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MPLY, KC_MSTP, KC_VOLU,
|
|
|
|
_______, RGB_SPD, RGB_VAI, RGB_SPI, RGB_HUI, RGB_SAI, _______, U_T_AUTO,U_T_AGCR,_______, _______, _______, _______, _______, KC_MPRV, KC_MNXT, KC_VOLD,
|
|
|
|
_______, RGB_RMOD,RGB_VAD, RGB_MOD, RGB_HUD, RGB_SAD, _______, _______, _______, _______, _______, _______, _______,
|
|
|
|
_______, RGB_TOG, _______, _______, _______, MD_BOOT, NK_TOGG, _______, _______, _______, _______, _______, _______,
|
|
|
|
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
|
2018-09-03 16:57:57 -07:00
|
|
|
),
|
|
|
|
/*
|
|
|
|
[X] = LAYOUT(
|
2022-12-29 16:48:05 -08:00
|
|
|
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
|
|
|
|
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
|
|
|
|
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
|
|
|
|
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
|
|
|
|
_______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______,
|
|
|
|
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
|
2018-09-03 16:57:57 -07:00
|
|
|
),
|
|
|
|
*/
|
|
|
|
};
|
|
|
|
|
|
|
|
// 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) {
|
|
|
|
};
|
|
|
|
|
2022-10-16 06:14:40 -07:00
|
|
|
#define MODS_SHIFT (get_mods() & MOD_BIT(KC_LSFT) || get_mods() & MOD_BIT(KC_RSFT))
|
|
|
|
#define MODS_CTRL (get_mods() & MOD_BIT(KC_LCTL) || get_mods() & MOD_BIT(KC_RCTL))
|
2019-01-27 00:28:40 -08:00
|
|
|
#define MODS_ALT (get_mods() & MOD_BIT(KC_LALT) || get_mods() & MOD_BIT(KC_RALT))
|
2018-09-03 16:57:57 -07:00
|
|
|
|
|
|
|
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
2018-09-05 09:25:47 -07:00
|
|
|
static uint32_t key_timer;
|
|
|
|
|
2018-09-03 16:57:57 -07:00
|
|
|
switch (keycode) {
|
|
|
|
case U_T_AUTO:
|
|
|
|
if (record->event.pressed && MODS_SHIFT && MODS_CTRL) {
|
Massdrop keyboard updates for SEND_STRING, syscalls, stdio, debug prints, Auto Shift (#3973)
* Update for SEND_STRING usage
Update for SEND_STRING usage.
Sending keyboard reports (kbd, nkro) now obey the minimum polling time.
While attempting to send a keyboard report and waiting for a USB poll, other functions of the keyboard, including LED effects and power management, will continue to operate at their intended intervals.
* Updates for send string, syscalls, stdio, debug prints, auto shift
Now properly waiting for previous keys sent over USB to complete before sending new.
Added heap to linker and now compiling with syscalls support.
Removed custom string functions and now using stdio.
dprintf now works as intended through virtser device.
* CTRL and ALT keymap updates
CTRL mac keymap updated
ALT default and mac keymap updated
ALT rules.mk added Auto Shift with default no
* Code cleanup as per discussion with vomindoraan
Code cleanup as per discussion with vomindoraan
2018-09-28 18:32:15 -07:00
|
|
|
TOGGLE_FLAG_AND_PRINT(usb_extra_manual, "USB extra port manual mode");
|
2018-09-03 16:57:57 -07:00
|
|
|
}
|
|
|
|
return false;
|
|
|
|
case U_T_AGCR:
|
|
|
|
if (record->event.pressed && MODS_SHIFT && MODS_CTRL) {
|
Massdrop keyboard updates for SEND_STRING, syscalls, stdio, debug prints, Auto Shift (#3973)
* Update for SEND_STRING usage
Update for SEND_STRING usage.
Sending keyboard reports (kbd, nkro) now obey the minimum polling time.
While attempting to send a keyboard report and waiting for a USB poll, other functions of the keyboard, including LED effects and power management, will continue to operate at their intended intervals.
* Updates for send string, syscalls, stdio, debug prints, auto shift
Now properly waiting for previous keys sent over USB to complete before sending new.
Added heap to linker and now compiling with syscalls support.
Removed custom string functions and now using stdio.
dprintf now works as intended through virtser device.
* CTRL and ALT keymap updates
CTRL mac keymap updated
ALT default and mac keymap updated
ALT rules.mk added Auto Shift with default no
* Code cleanup as per discussion with vomindoraan
Code cleanup as per discussion with vomindoraan
2018-09-28 18:32:15 -07:00
|
|
|
TOGGLE_FLAG_AND_PRINT(usb_gcr_auto, "USB GCR auto mode");
|
2018-09-03 16:57:57 -07:00
|
|
|
}
|
|
|
|
return false;
|
|
|
|
case DBG_TOG:
|
|
|
|
if (record->event.pressed) {
|
Massdrop keyboard updates for SEND_STRING, syscalls, stdio, debug prints, Auto Shift (#3973)
* Update for SEND_STRING usage
Update for SEND_STRING usage.
Sending keyboard reports (kbd, nkro) now obey the minimum polling time.
While attempting to send a keyboard report and waiting for a USB poll, other functions of the keyboard, including LED effects and power management, will continue to operate at their intended intervals.
* Updates for send string, syscalls, stdio, debug prints, auto shift
Now properly waiting for previous keys sent over USB to complete before sending new.
Added heap to linker and now compiling with syscalls support.
Removed custom string functions and now using stdio.
dprintf now works as intended through virtser device.
* CTRL and ALT keymap updates
CTRL mac keymap updated
ALT default and mac keymap updated
ALT rules.mk added Auto Shift with default no
* Code cleanup as per discussion with vomindoraan
Code cleanup as per discussion with vomindoraan
2018-09-28 18:32:15 -07:00
|
|
|
TOGGLE_FLAG_AND_PRINT(debug_enable, "Debug mode");
|
2018-09-03 16:57:57 -07:00
|
|
|
}
|
|
|
|
return false;
|
|
|
|
case DBG_MTRX:
|
|
|
|
if (record->event.pressed) {
|
Massdrop keyboard updates for SEND_STRING, syscalls, stdio, debug prints, Auto Shift (#3973)
* Update for SEND_STRING usage
Update for SEND_STRING usage.
Sending keyboard reports (kbd, nkro) now obey the minimum polling time.
While attempting to send a keyboard report and waiting for a USB poll, other functions of the keyboard, including LED effects and power management, will continue to operate at their intended intervals.
* Updates for send string, syscalls, stdio, debug prints, auto shift
Now properly waiting for previous keys sent over USB to complete before sending new.
Added heap to linker and now compiling with syscalls support.
Removed custom string functions and now using stdio.
dprintf now works as intended through virtser device.
* CTRL and ALT keymap updates
CTRL mac keymap updated
ALT default and mac keymap updated
ALT rules.mk added Auto Shift with default no
* Code cleanup as per discussion with vomindoraan
Code cleanup as per discussion with vomindoraan
2018-09-28 18:32:15 -07:00
|
|
|
TOGGLE_FLAG_AND_PRINT(debug_matrix, "Debug matrix");
|
2018-09-03 16:57:57 -07:00
|
|
|
}
|
|
|
|
return false;
|
|
|
|
case DBG_KBD:
|
|
|
|
if (record->event.pressed) {
|
Massdrop keyboard updates for SEND_STRING, syscalls, stdio, debug prints, Auto Shift (#3973)
* Update for SEND_STRING usage
Update for SEND_STRING usage.
Sending keyboard reports (kbd, nkro) now obey the minimum polling time.
While attempting to send a keyboard report and waiting for a USB poll, other functions of the keyboard, including LED effects and power management, will continue to operate at their intended intervals.
* Updates for send string, syscalls, stdio, debug prints, auto shift
Now properly waiting for previous keys sent over USB to complete before sending new.
Added heap to linker and now compiling with syscalls support.
Removed custom string functions and now using stdio.
dprintf now works as intended through virtser device.
* CTRL and ALT keymap updates
CTRL mac keymap updated
ALT default and mac keymap updated
ALT rules.mk added Auto Shift with default no
* Code cleanup as per discussion with vomindoraan
Code cleanup as per discussion with vomindoraan
2018-09-28 18:32:15 -07:00
|
|
|
TOGGLE_FLAG_AND_PRINT(debug_keyboard, "Debug keyboard");
|
2018-09-03 16:57:57 -07:00
|
|
|
}
|
|
|
|
return false;
|
|
|
|
case DBG_MOU:
|
|
|
|
if (record->event.pressed) {
|
Massdrop keyboard updates for SEND_STRING, syscalls, stdio, debug prints, Auto Shift (#3973)
* Update for SEND_STRING usage
Update for SEND_STRING usage.
Sending keyboard reports (kbd, nkro) now obey the minimum polling time.
While attempting to send a keyboard report and waiting for a USB poll, other functions of the keyboard, including LED effects and power management, will continue to operate at their intended intervals.
* Updates for send string, syscalls, stdio, debug prints, auto shift
Now properly waiting for previous keys sent over USB to complete before sending new.
Added heap to linker and now compiling with syscalls support.
Removed custom string functions and now using stdio.
dprintf now works as intended through virtser device.
* CTRL and ALT keymap updates
CTRL mac keymap updated
ALT default and mac keymap updated
ALT rules.mk added Auto Shift with default no
* Code cleanup as per discussion with vomindoraan
Code cleanup as per discussion with vomindoraan
2018-09-28 18:32:15 -07:00
|
|
|
TOGGLE_FLAG_AND_PRINT(debug_mouse, "Debug mouse");
|
2018-09-03 16:57:57 -07:00
|
|
|
}
|
|
|
|
return false;
|
2018-09-05 09:25:47 -07:00
|
|
|
case MD_BOOT:
|
|
|
|
if (record->event.pressed) {
|
|
|
|
key_timer = timer_read32();
|
|
|
|
} else {
|
|
|
|
if (timer_elapsed32(key_timer) >= 500) {
|
|
|
|
reset_keyboard();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
2019-04-29 15:18:50 -07:00
|
|
|
case RGB_TOG:
|
|
|
|
if (record->event.pressed) {
|
|
|
|
switch (rgb_matrix_get_flags()) {
|
|
|
|
case LED_FLAG_ALL: {
|
2019-08-21 17:47:45 -07:00
|
|
|
rgb_matrix_set_flags(LED_FLAG_KEYLIGHT | LED_FLAG_MODIFIER);
|
2019-04-29 15:18:50 -07:00
|
|
|
rgb_matrix_set_color_all(0, 0, 0);
|
|
|
|
}
|
|
|
|
break;
|
2019-08-21 17:47:45 -07:00
|
|
|
case LED_FLAG_KEYLIGHT | LED_FLAG_MODIFIER: {
|
2019-04-29 15:18:50 -07:00
|
|
|
rgb_matrix_set_flags(LED_FLAG_UNDERGLOW);
|
|
|
|
rgb_matrix_set_color_all(0, 0, 0);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case LED_FLAG_UNDERGLOW: {
|
|
|
|
rgb_matrix_set_flags(LED_FLAG_NONE);
|
|
|
|
rgb_matrix_disable_noeeprom();
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default: {
|
|
|
|
rgb_matrix_set_flags(LED_FLAG_ALL);
|
|
|
|
rgb_matrix_enable_noeeprom();
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
2018-09-03 16:57:57 -07:00
|
|
|
default:
|
|
|
|
return true; //Process all other keycodes normally
|
|
|
|
}
|
|
|
|
}
|