summaryrefslogtreecommitdiffstats
path: root/keyboards
diff options
context:
space:
mode:
Diffstat (limited to 'keyboards')
-rw-r--r--keyboards/dztech/dz65rgb/keymaps/yuannan/config.h43
-rw-r--r--keyboards/dztech/dz65rgb/keymaps/yuannan/keymap.c210
-rw-r--r--keyboards/dztech/dz65rgb/keymaps/yuannan/readme.md88
-rw-r--r--keyboards/dztech/dz65rgb/keymaps/yuannan/rules.mk5
4 files changed, 346 insertions, 0 deletions
diff --git a/keyboards/dztech/dz65rgb/keymaps/yuannan/config.h b/keyboards/dztech/dz65rgb/keymaps/yuannan/config.h
new file mode 100644
index 0000000000..0a005cbca3
--- /dev/null
+++ b/keyboards/dztech/dz65rgb/keymaps/yuannan/config.h
@@ -0,0 +1,43 @@
+/* Copyright 2021 DZTECH <moyi4681@live.cn>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#pragma once
+
+#undef ENABLE_RGB_MATRIX_PIXEL_FLOW
+#undef ENABLE_RGB_MATRIX_PIXEL_FRACTAL
+#undef ENABLE_RGB_MATRIX_PIXEL_RAIN
+#undef ENABLE_RGB_MATRIX_RAINDROPS
+#undef ENABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS
+
+#undef RGB_MATRIX_STARTUP_MODE
+#define RGB_MATRIX_STARTUP_MODE RGB_MATRIX_CYCLE_OUT_IN_DUAL
+
+#define RGB_MATRIX_HUE_STEP 8
+#define RGB_MATRIX_SAT_STEP 8
+#define RGB_MATRIX_VAL_STEP 8
+#define RGB_MATRIX_SPD_STEP 8
+
+//#define QMK_KEYS_PER_SCAN 12nn
+
+#define MOUSEKEY_DELAY 0
+#define MOUSEKEY_INTERVAL 1
+#define MOUSEKEY_MOVE_DELTA 1
+#define MOUSEKEY_MAX_SPEED 25
+#define MOUSEKEY_TIME_TO_MAX 255
+#define MOUSEKEY_WHEEL_DELAY 0
+#define MOUSEKEY_WHEEL_INTERVAL 100
+#define MOUSEKEY_WHEEL_MAX_SPEED 100
+#define MOUSEKEY_WHEEL_TIME_TO_MAX 100
diff --git a/keyboards/dztech/dz65rgb/keymaps/yuannan/keymap.c b/keyboards/dztech/dz65rgb/keymaps/yuannan/keymap.c
new file mode 100644
index 0000000000..5baf32a7e4
--- /dev/null
+++ b/keyboards/dztech/dz65rgb/keymaps/yuannan/keymap.c
@@ -0,0 +1,210 @@
+/* Copyright 2021 Yuannan (https://github.com/yuannan)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include QMK_KEYBOARD_H
+
+enum custom_keycodes {
+ AUTOCLICK_TOGGLE = SAFE_RANGE,
+ AUTO_BURST,
+ RAPID_BURST,
+ INC_CLICK_SPEED,
+ DEC_CLICK_SPEED,
+ DEL_LINE,
+ DEL_HOME,
+ DEL_END
+};
+
+enum my_layers {
+ _ALPHA_LAYER,
+ _VIM_EDITING_LAYER,
+ _MOUSE_LAYER,
+ _HYPER_LAYER
+};
+
+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+ [_ALPHA_LAYER] = LAYOUT_65_ansi(
+ KC_GESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINUS, KC_EQUAL, KC_BSPACE, KC_HOME,
+ KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRACKET,KC_RBRACKET, KC_BSLASH, KC_PGUP,
+ KC_LCTRL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCOLON, KC_QUOTE, KC_ENTER, KC_PGDOWN,
+ KC_LSHIFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMMA, KC_DOT, KC_SLASH, KC_RSHIFT, KC_UP, KC_END,
+ KC_CAPSLOCK,KC_LGUI,FN_MO13, KC_SPACE, FN_MO23, KC_LALT, KC_RCTRL, KC_LEFT, KC_DOWN, KC_RIGHT
+ ),
+ [_VIM_EDITING_LAYER] = LAYOUT_65_ansi(
+ KC_GRAVE, 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_DELETE, KC_INSERT,
+ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, DEL_HOME, KC_HOME, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_SCROLLLOCK,
+ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, DEL_LINE, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT, KC_TRNS, KC_TRNS, KC_MPLY, KC_PAUSE,
+ KC_TRNS, AUTOCLICK_TOGGLE, KC_TRNS, AUTO_BURST,RAPID_BURST, KC_TRNS, DEL_END, KC_END, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_VOLU, KC_PSCREEN,
+ DEC_CLICK_SPEED,INC_CLICK_SPEED, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MPRV, KC_VOLD, KC_MNXT
+ ),
+ [_MOUSE_LAYER] = LAYOUT_65_ansi(
+ KC_GRAVE, 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_TRNS, KC_TRNS,
+ KC_ACL0, KC_BTN1, KC_MS_U, KC_BTN2, KC_TRNS, KC_TRNS, KC_TRNS, KC_BTN4, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
+ KC_ACL1, KC_MS_L, KC_MS_D, KC_MS_R, KC_TRNS, KC_TRNS, KC_WH_L, KC_WH_D, KC_WH_U, KC_WH_R, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
+ KC_ACL2, AUTOCLICK_TOGGLE, KC_BTN3, AUTO_BURST, RAPID_BURST, KC_TRNS, KC_TRNS, KC_BTN5, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
+ DEC_CLICK_SPEED,INC_CLICK_SPEED,KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS
+ ),
+ [_HYPER_LAYER] = LAYOUT_65_ansi(
+ DYN_REC_STOP, DYN_REC_START1, DYN_REC_START2, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
+ KC_NO, DYN_MACRO_PLAY1, DYN_MACRO_PLAY2, KC_NO, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
+ KC_NO, KC_NO, KC_NO, KC_NO, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
+ KC_LSHIFT, KC_NO, KC_NO, RGB_HUI, RGB_SAI, RGB_VAI, RGB_SPI, RGB_MOD, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
+ KC_TRNS, KC_TRNS, KC_TRNS, RGB_TOG, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS
+ )
+};
+
+#define CLICKSPEEDS 5
+const uint16_t clickspeed_sets[CLICKSPEEDS] = {1000, 100, 50, 20, 1};
+uint16_t clickspeed_set = CLICKSPEEDS - 1;
+deferred_token autoclick_token = INVALID_DEFERRED_TOKEN;
+bool rapid = false;
+
+void decrement_click_speed(void){
+ clickspeed_set += CLICKSPEEDS - 1;
+ clickspeed_set %= CLICKSPEEDS;
+}
+
+void increment_click_speed(void){
+ clickspeed_set ++;
+ clickspeed_set %= CLICKSPEEDS;
+}
+
+uint32_t autoclick_callback(uint32_t trigger_time, void *cb_arg){
+ tap_code(KC_BTN1);
+
+ return rapid ? 1 : clickspeed_sets[clickspeed_set];
+}
+
+void start_autoclicker(void){
+ autoclick_token = defer_exec(1, autoclick_callback, NULL);
+}
+
+void stop_autoclicker(void){
+ cancel_deferred_exec(autoclick_token);
+ autoclick_token = INVALID_DEFERRED_TOKEN;
+}
+
+// Custom process key to allow for custom keycodes
+bool process_record_user(uint16_t keycode, keyrecord_t *record){
+ switch (keycode) {
+ case AUTOCLICK_TOGGLE:
+ if (record->event.pressed) {
+ if (autoclick_token == INVALID_DEFERRED_TOKEN){
+ start_autoclicker();
+ } else{
+ stop_autoclicker();
+ }
+ }
+ break;
+ case AUTO_BURST:
+ if (record->event.pressed && (autoclick_token == INVALID_DEFERRED_TOKEN)) {
+ start_autoclicker();
+ } else if (autoclick_token != INVALID_DEFERRED_TOKEN){
+ stop_autoclicker();
+ }
+ break;
+ case RAPID_BURST:
+ if (record->event.pressed){
+ rapid = true;
+ start_autoclicker();
+ } else{
+ rapid = false;
+ stop_autoclicker();
+ }
+ break;
+ case INC_CLICK_SPEED:
+ if (record->event.pressed){
+ if (get_mods() & MOD_BIT(KC_LSHIFT) || get_mods() & MOD_BIT(KC_RSHIFT)){
+ decrement_click_speed();
+ } else{
+ increment_click_speed();
+ }
+ }
+ break;
+ case DEC_CLICK_SPEED:
+ if (record->event.pressed){
+ if (get_mods() & MOD_BIT(KC_LSHIFT) || get_mods() & MOD_BIT(KC_RSHIFT)){
+ increment_click_speed();
+ } else{
+ decrement_click_speed();
+ }
+ }
+ break;
+ case DEL_LINE:
+ if(record->event.pressed){
+ SEND_STRING(SS_TAP(X_HOME) SS_LSFT(SS_TAP(X_END)) SS_TAP(X_DELETE));
+ }
+ break;
+ case DEL_HOME:
+ if(record->event.pressed){
+ SEND_STRING(SS_LSFT(SS_TAP(X_HOME)) SS_TAP(X_DELETE));
+ }
+ break;
+ case DEL_END:
+ if(record->event.pressed){
+ SEND_STRING(SS_LSFT(SS_TAP(X_END)) SS_TAP(X_DELETE));
+ }
+ break;
+ case RGB_TOG:
+ if(record->event.pressed){
+ if (!(get_mods() & MOD_BIT(KC_LSHIFT) || get_mods() & MOD_BIT(KC_RSHIFT))){
+ if(rgb_matrix_get_val() < 128){
+ rgb_matrix_sethsv(rgb_matrix_get_hue(), rgb_matrix_get_sat(), 255);
+ } else{
+ rgb_matrix_sethsv(rgb_matrix_get_hue(), rgb_matrix_get_sat(), 0);
+ }
+ return false;
+ }
+ }
+ break;
+ }
+
+ return true;
+};
+
+RGB get_inverted_RGB(void){
+ HSV current_HSV = rgb_matrix_get_hsv();
+ current_HSV.h = 255 - current_HSV.h;
+ current_HSV.s = 255;
+ current_HSV.v = 255;
+
+ return hsv_to_rgb(current_HSV);
+}
+
+// Move Caps indicator to the ctrl key where it belongs
+void rgb_matrix_indicators_user(void){
+ RGB inverted_RGB = get_inverted_RGB();
+ if (host_keyboard_led_state().caps_lock){
+ rgb_matrix_set_color(58, inverted_RGB.r, inverted_RGB.g, inverted_RGB.b);
+ }
+}
+
+// show coloured indicator for layers with a keybind
+void rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max){
+ uint8_t layer = get_highest_layer(layer_state);
+ if (layer > 0) {
+ RGB inverted_RGB = get_inverted_RGB();
+ for (uint8_t row = 0; row < MATRIX_ROWS; ++row) {
+ for (uint8_t col = 0; col < MATRIX_COLS; ++col) {
+ uint8_t index = g_led_config.matrix_co[row][col];
+
+ if (index >= led_min && index <= led_max && index != NO_LED &&
+ keymap_key_to_keycode(layer, (keypos_t){col,row}) > KC_TRNS) {
+ rgb_matrix_set_color(index, inverted_RGB.r, inverted_RGB.g, inverted_RGB.b);
+ }
+ }
+ }
+ }
+}
diff --git a/keyboards/dztech/dz65rgb/keymaps/yuannan/readme.md b/keyboards/dztech/dz65rgb/keymaps/yuannan/readme.md
new file mode 100644
index 0000000000..c6768aceec
--- /dev/null
+++ b/keyboards/dztech/dz65rgb/keymaps/yuannan/readme.md
@@ -0,0 +1,88 @@
+[DZ65RGB/v3 Yuannan's Layout Imgur Album](https://imgur.com/a/BI2RjgE)
+
+![Alpha](https://i.imgur.com/ikqvrtF.png)
+![Vim Editing Layer](https://i.imgur.com/hoBvSRR.png)
+![Mouse and Autoclicker](https://i.imgur.com/QWmWaWY.png)
+![Hyper functions and RGB Layer](https://i.imgur.com/Zm6Tf6p.png)
+
+# Yuannan's DZ65 Custom Profile. Autoclicker, Vim, and more!
+
+## Features
+
+1. Much better mouse support. Now able to:
+ - Move mouse around with 3 levels of acceleration
+ - Click and nav using mouse buttons 1-5
+ - Mouse scroll in all 4 directions, autoclick with 5 different levels of speed!
+ - Increase or Decrease the autoclick speed from the preset array of {500, 50, 20, 10, 1} clicks per second \*(Read Notes). Press Shift while using the Increase or Decrease button to do the opposite. Designed to work with other keymaps and keyboards!
+2. Ctrl and Caps swapped. The new indicator is dynamically colored and has been moved to the CTRL key to reflect the keymap.
+3. Improved navigation via Vim like keys.
+4. Dynamic Macros now enabled!
+5. Custom Editing Macros such as:
+ - Deleting entire line
+ - Deleting from cursor to start of line
+ - Deleting form cursor to end of line
+6. VIA support.
+7. Improved granularity of the RGB Matrix. Now with steps of 8/256, which is 32 steps!
+8. The default toggle for RGB now sets the matrix to be on low brightness. Why? If the matrix is completely toggled off then the indicators for Caps Locks and FN are also completely off. You can completely turn it off by pressing shift while processing the "RGB_TOG" keycode. (It is {FN1+FN2+Shift+Space} on this keymap.)
+9. Disabled some effects to free up more space.
+
+### Notes
+
+#### Note Autoclicker Speed
+
+The click events are now programmed with the new Deferred Execution API (https://docs.qmk.fm/#/custom_quantum_functions?id=deferred-execution).
+
+While it's programmed to input with a delay of 1ms (500CPS), the result will vary depending on your board and host. This is a massive improvment compared to timer based events. This new API is much faster and will work with less interference from other tasks on the board.
+
+#### Note Autoclick Linux libinput (Linux autoclicker not working)
+
+Linux's input driver (libinput) has a debounce feature. This is useful in normal usage as a person cannot feasibly click more than 20CPS. However when the keyboard tries to input 50+CPS and sometimes up to ~500CPS this is a problem.
+
+Create a file at "/etc/libinput/local-overrides.quirks" with the contents:
+
+ [Never Debounce]
+ MatchUdevType=mouse
+ ModelBouncingKeys=1
+
+This disables the debounce feature for libnput. This maybe be different if you use evdev, On Arch Linux the driver packages are {"libinput", "xf86-input-libinput"} compared to {"libevdev", "xf86-input-evdev"}. I have {"libinput", "xf86-input-libinput"} installed. In addition I have {"libevdev"} installed as a dependency of other packages. You maybe need to change the driver for your device if you have both installed. For me it was working just fine. Check what driver your xsession currently is utilizing with:
+
+ $cat /var/log/Xorg.0.log | grep libinput
+
+If it is using libinput then it will show contents. Otherwise search for "evdev".
+
+#### Still not working? (Linux)
+
+Check if the events are reaching your OS with either:
+
+ $evtest /dev/input/by-id/YOUR_KEYBOARD
+
+or
+
+ $cat /dev/input/by-id/YOUR_KEYBOARD
+
+It should end in `event-mouse`. In my case it was `/dev/input/by-id/usb-DZTECH_DZ65RGBV3-if02-event-mouse` which was a symlink to `/dev/input/event12`. It **WILL** vary on your setup.
+
+The output will appear "garbled" as it's trying to interoperate the data stream into text. The underlying data is actually a struct of the form:
+
+ struct input_event {
+ struct timeval time;
+ unsigned short type;
+ unsigned short code;
+ unsigned int value;
+ };
+
+You can read more about it here (https://www.kernel.org/doc/Documentation/input/input.txt)
+
+If it has an output when you autoclick but do not receive it in your desktop then it's a driver issue.
+
+View libinput with:
+
+ $libinput debug-events --device /dev/input/by-id/usb-DZTECH_DZ65RGBV3-if02-event-mouse --verbose
+
+If you experience "DEBOUNCE" events then it's a driver issue and should be able to be disabled with the above method, restart your display manager or just reboot afterwards.
+
+If you have any issues feel free to make bug report or pull request to me, QMK, or libinput. Please send logs along with any steps you have tried.
+
+#### ALT Position
+
+The physical Right_Alt is mapped as a Left_Alt. This is to ensure compatibility in legacy and programs which treat them differently. A key example would be the TTY system in Linux.
diff --git a/keyboards/dztech/dz65rgb/keymaps/yuannan/rules.mk b/keyboards/dztech/dz65rgb/keymaps/yuannan/rules.mk
new file mode 100644
index 0000000000..e98ba61c3a
--- /dev/null
+++ b/keyboards/dztech/dz65rgb/keymaps/yuannan/rules.mk
@@ -0,0 +1,5 @@
+VIA_ENABLE = yes
+LTO_ENABLE = yes
+DYNAMIC_MACRO_ENABLE = yes
+MOUSEKEY_ENABLE = yes
+DEFERRED_EXEC_ENABLE = yes