aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorasdfire1 <45483619+asdfire1@users.noreply.github.com>2022-01-14 05:38:25 +0100
committerGitHub <noreply@github.com>2022-01-13 20:38:25 -0800
commit0f110737dba362596fcdbebd6c2bd4cc574f344b (patch)
treea16fb1339b9ccd28da91244fb8060d29504e0088
parent851cb7e406ec775462b9eb9975f1b0f34445b48f (diff)
downloadqmk_firmware-0f110737dba362596fcdbebd6c2bd4cc574f344b.tar.gz
qmk_firmware-0f110737dba362596fcdbebd6c2bd4cc574f344b.zip
[Keyboard] Add VIA support for the Drop Alt (#15857)
-rw-r--r--keyboards/massdrop/alt/keymaps/via/keymap.c128
-rw-r--r--keyboards/massdrop/alt/keymaps/via/rules.mk1
2 files changed, 129 insertions, 0 deletions
diff --git a/keyboards/massdrop/alt/keymaps/via/keymap.c b/keyboards/massdrop/alt/keymaps/via/keymap.c
new file mode 100644
index 000000000..fd1bf3c0b
--- /dev/null
+++ b/keyboards/massdrop/alt/keymaps/via/keymap.c
@@ -0,0 +1,128 @@
1/* Copyright 2021 Asdfire (@asdfire1)
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16#include QMK_KEYBOARD_H
17
18enum alt_keycodes {
19 U_T_AUTO = SAFE_RANGE, //USB Extra Port Toggle Auto Detect / Always Active
20 U_T_AGCR, //USB Toggle Automatic GCR control
21 DBG_TOG, //DEBUG Toggle On / Off
22 DBG_MTRX, //DEBUG Toggle Matrix Prints
23 DBG_KBD, //DEBUG Toggle Keyboard Prints
24 DBG_MOU, //DEBUG Toggle Mouse Prints
25 MD_BOOT, //Restart into bootloader after hold timeout
26};
27
28const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
29 [0] = LAYOUT_65_ansi_blocker(
30 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,
31 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,
32 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,
33 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,
34 KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(1), KC_LEFT, KC_DOWN, KC_RGHT
35 ),
36 [1] = LAYOUT_65_ansi_blocker(
37 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,
38 _______, RGB_SPD, RGB_VAI, RGB_SPI, RGB_HUI, RGB_SAI, _______, U_T_AUTO,U_T_AGCR,_______, KC_PSCR, KC_SLCK, KC_PAUS, _______, KC_END,
39 _______, RGB_RMOD,RGB_VAD, RGB_MOD, RGB_HUD, RGB_SAD, _______, _______, _______, _______, _______, _______, _______, KC_VOLU,
40 _______, RGB_TOG, _______, _______, _______, MD_BOOT, NK_TOGG, DBG_TOG, _______, _______, _______, _______, KC_PGUP, KC_VOLD,
41 _______, _______, _______, _______, _______, _______, KC_HOME, KC_PGDN, KC_END
42 ),
43 [2] = LAYOUT_65_ansi_blocker(
44 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,
45 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,
46 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,
47 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,
48 KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(1), KC_LEFT, KC_DOWN, KC_RGHT
49 ),
50};
51
52#define MODS_SHIFT (get_mods() & MOD_BIT(KC_LSHIFT) || get_mods() & MOD_BIT(KC_RSHIFT))
53#define MODS_CTRL (get_mods() & MOD_BIT(KC_LCTL) || get_mods() & MOD_BIT(KC_RCTRL))
54#define MODS_ALT (get_mods() & MOD_BIT(KC_LALT) || get_mods() & MOD_BIT(KC_RALT))
55
56bool process_record_user(uint16_t keycode, keyrecord_t *record) {
57 static uint32_t key_timer;
58
59 switch (keycode) {
60 case U_T_AUTO:
61 if (record->event.pressed && MODS_SHIFT && MODS_CTRL) {
62 TOGGLE_FLAG_AND_PRINT(usb_extra_manual, "USB extra port manual mode");
63 }
64 return false;
65 case U_T_AGCR:
66 if (record->event.pressed && MODS_SHIFT && MODS_CTRL) {
67 TOGGLE_FLAG_AND_PRINT(usb_gcr_auto, "USB GCR auto mode");
68 }
69 return false;
70 case DBG_TOG:
71 if (record->event.pressed) {
72 TOGGLE_FLAG_AND_PRINT(debug_enable, "Debug mode");
73 }
74 return false;
75 case DBG_MTRX:
76 if (record->event.pressed) {
77 TOGGLE_FLAG_AND_PRINT(debug_matrix, "Debug matrix");
78 }
79 return false;
80 case DBG_KBD:
81 if (record->event.pressed) {
82 TOGGLE_FLAG_AND_PRINT(debug_keyboard, "Debug keyboard");
83 }
84 return false;
85 case DBG_MOU:
86 if (record->event.pressed) {
87 TOGGLE_FLAG_AND_PRINT(debug_mouse, "Debug mouse");
88 }
89 return false;
90 case MD_BOOT:
91 if (record->event.pressed) {
92 key_timer = timer_read32();
93 } else {
94 if (timer_elapsed32(key_timer) >= 500) {
95 reset_keyboard();
96 }
97 }
98 return false;
99 case RGB_TOG:
100 if (record->event.pressed) {
101 switch (rgb_matrix_get_flags()) {
102 case LED_FLAG_ALL: {
103 rgb_matrix_set_flags(LED_FLAG_KEYLIGHT | LED_FLAG_MODIFIER | LED_FLAG_INDICATOR);
104 rgb_matrix_set_color_all(0, 0, 0);
105 }
106 break;
107 case (LED_FLAG_KEYLIGHT | LED_FLAG_MODIFIER | LED_FLAG_INDICATOR): {
108 rgb_matrix_set_flags(LED_FLAG_UNDERGLOW);
109 rgb_matrix_set_color_all(0, 0, 0);
110 }
111 break;
112 case LED_FLAG_UNDERGLOW: {
113 rgb_matrix_set_flags(LED_FLAG_NONE);
114 rgb_matrix_disable_noeeprom();
115 }
116 break;
117 default: {
118 rgb_matrix_set_flags(LED_FLAG_ALL);
119 rgb_matrix_enable_noeeprom();
120 }
121 break;
122 }
123 }
124 return false;
125 default:
126 return true; //Process all other keycodes normally
127 }
128}
diff --git a/keyboards/massdrop/alt/keymaps/via/rules.mk b/keyboards/massdrop/alt/keymaps/via/rules.mk
new file mode 100644
index 000000000..036bd6d1c
--- /dev/null
+++ b/keyboards/massdrop/alt/keymaps/via/rules.mk
@@ -0,0 +1 @@
VIA_ENABLE = yes \ No newline at end of file