diff options
author | Felix Springer <39434424+jumper149@users.noreply.github.com> | 2021-03-17 18:02:00 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-17 10:02:00 -0700 |
commit | 6e79767f5aa0bad763639846d44c69d3990c7cbe (patch) | |
tree | 46f1991d3c4f51df981c0aa9881208068017e42f /keyboards/dztech/dz65rgb/keymaps/jumper149 | |
parent | 3bc7f46412e6e6c829aaff6d0f15c4cf36011948 (diff) |
[Keymap] jumper149 keymap for the dztech/dz65rgb (#12142)
Diffstat (limited to 'keyboards/dztech/dz65rgb/keymaps/jumper149')
5 files changed, 908 insertions, 0 deletions
diff --git a/keyboards/dztech/dz65rgb/keymaps/jumper149/config.h b/keyboards/dztech/dz65rgb/keymaps/jumper149/config.h new file mode 100644 index 0000000000..d9d295dfa8 --- /dev/null +++ b/keyboards/dztech/dz65rgb/keymaps/jumper149/config.h @@ -0,0 +1,63 @@ +/* Copyright 2021 Felix Springer + * + * 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 + +#define FORCE_NKRO + +#ifdef RGB_MATRIX_ENABLE + +#define DISABLE_RGB_MATRIX_ALPHAS_MODS +#define DISABLE_RGB_MATRIX_GRADIENT_UP_DOWN +#define DISABLE_RGB_MATRIX_BREATHING +#define DISABLE_RGB_MATRIX_BAND_SAT +#define DISABLE_RGB_MATRIX_BAND_VAL +#define DISABLE_RGB_MATRIX_BAND_PINWHEEL_SAT +#define DISABLE_RGB_MATRIX_BAND_PINWHEEL_VAL +#define DISABLE_RGB_MATRIX_BAND_SPIRAL_SAT +#define DISABLE_RGB_MATRIX_BAND_SPIRAL_VAL +#define DISABLE_RGB_MATRIX_CYCLE_ALL +#define DISABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT +#define DISABLE_RGB_MATRIX_CYCLE_UP_DOWN +#define DISABLE_RGB_MATRIX_CYCLE_OUT_IN +#define DISABLE_RGB_MATRIX_CYCLE_OUT_IN_DUAL +#define DISABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON +#define DISABLE_RGB_MATRIX_DUAL_BEACON +#define DISABLE_RGB_MATRIX_CYCLE_PINWHEEL +#define DISABLE_RGB_MATRIX_CYCLE_SPIRAL +#define DISABLE_RGB_MATRIX_RAINBOW_BEACON +#define DISABLE_RGB_MATRIX_RAINBOW_PINWHEELS +#define DISABLE_RGB_MATRIX_RAINDROPS +#define DISABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS +#define DISABLE_RGB_MATRIX_TYPING_HEATMAP +#define DISABLE_RGB_MATRIX_DIGITAL_RAIN +#define DISABLE_RGB_MATRIX_SOLID_REACTIVE +#define DISABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE +#define DISABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE +#define DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE +#define DISABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS +#define DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS +#define DISABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS +#define DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS +#define DISABLE_RGB_MATRIX_SPLASH +#define DISABLE_RGB_MATRIX_MULTISPLASH +#define DISABLE_RGB_MATRIX_SOLID_SPLASH +#define DISABLE_RGB_MATRIX_SOLID_MULTISPLASH + +// Fix RGB_MATRIX_STARTUP, because RGB_MATRIX_CYCLE_ALL is disabled. +// The actual handling of RGB_EFFECTs is done in keymap.c +#undef RGB_MATRIX_STARTUP_MODE + +#endif diff --git a/keyboards/dztech/dz65rgb/keymaps/jumper149/keymap.c b/keyboards/dztech/dz65rgb/keymaps/jumper149/keymap.c new file mode 100644 index 0000000000..b166a5629d --- /dev/null +++ b/keyboards/dztech/dz65rgb/keymaps/jumper149/keymap.c @@ -0,0 +1,120 @@ +/* Copyright 2021 Felix Springer + * + * 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 layers_user { + _QWERTY, + _AD, + _VI, + _FN, + _KB +}; + +enum keycodes_user { + _BASEEF = SAFE_RANGE, + _KITTEF +}; + +int selected_mode_user = RGB_MATRIX_CUSTOM_base_effect; // for layer_state_set_user() +bool process_record_user(uint16_t keycode, keyrecord_t * record) { + switch (keycode) { + case _BASEEF: + if (record->event.pressed) { + selected_mode_user = RGB_MATRIX_CUSTOM_base_effect; + } + return false; + case _KITTEF: + if (record->event.pressed) { + selected_mode_user = RGB_MATRIX_CUSTOM_kitt_effect; + } + return false; + default: + return true; + } +} + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [_QWERTY] = LAYOUT_65_ansi( + KC_GRAVE, 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_HOME, + 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_PGUP, + KC_ESC, 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_PGDN, + 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_END, + KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(_FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT + ), + [_AD] = LAYOUT_65_ansi( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_DEL, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_INS, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_HOME, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_END, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ + ), + [_VI] = LAYOUT_65_ansi( + KC_ESC, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_PGUP, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + KC_ESC, XXXXXXX, XXXXXXX, KC_PGDN, XXXXXXX, XXXXXXX, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, XXXXXXX, XXXXXXX, _______, XXXXXXX, + _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_FIND, _______, _______, XXXXXXX, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ + ), + [_FN] = LAYOUT_65_ansi( + XXXXXXX, 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_DEL, KC_INS, + XXXXXXX, KC_MUTE, KC_VOLU, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_PSCR, KC_SLCK, KC_PAUS, XXXXXXX, KC_PSTE, + CTL_T(KC_CAPS), KC_BRID, KC_VOLD, KC_BRIU, XXXXXXX, XXXXXXX, TG(_AD), TG(_VI), XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_COPY, + KC_LSFT, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_APP, XXXXXXX, XXXXXXX, XXXXXXX, KC_RSFT, KC_MSTP, KC_CUT, + KC_LCTL, KC_LGUI, KC_LALT, XXXXXXX, MO(_KB), XXXXXXX, KC_RCTL, KC_MPRV, KC_MPLY, KC_MNXT + ), + [_KB] = LAYOUT_65_ansi( + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, RGB_SPI, RGB_SPD, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, RESET, XXXXXXX, + XXXXXXX, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + XXXXXXX, XXXXXXX, RGB_SAI, RGB_SAD, XXXXXXX, XXXXXXX, _BASEEF, _KITTEF, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, EEP_RST, XXXXXXX, + KC_LSFT, RGB_VAI, RGB_VAD, XXXXXXX, XXXXXXX, XXXXXXX, NK_TOGG, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_RSFT, XXXXXXX, XXXXXXX, + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX + ) + /* + [_LEDS] = LAYOUT_65_ansi( + 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14 , + 15 , 16 Q, 17 W, 18 E, 19 R, 20 T, 21 Y, 22 U, 23 I, 24 O, 25 P, 26 , 27 , 28 , 29 , + 30 , 31 A, 32 S, 33 D, 34 F, 35 G, 36 H, 37 J, 38 K, 39 L, 40 , 41 , 42 , 43 , + 44 , 45 Z, 46 X, 47 C, 48 V, 49 B, 50 N, 51 M, 52 , 53 , 54 , 55 , 56 , 57 , + 58 , 59 , 60 , 61 , 62 , 63 , 64 , 65 , 66 , 67 + ) + */ +}; + +layer_state_t layer_state_set_user(layer_state_t state) { + switch (get_highest_layer(state)) { + case _QWERTY: + rgb_matrix_mode(selected_mode_user); + break; + case _AD: + if (selected_mode_user == RGB_MATRIX_CUSTOM_base_effect) { + rgb_matrix_mode(RGB_MATRIX_CUSTOM_base_ad_effect); + } else { + rgb_matrix_mode(selected_mode_user); + } + break; + case _VI: + rgb_matrix_mode(RGB_MATRIX_CUSTOM_vi_effect); + break; + case _FN: + rgb_matrix_mode(RGB_MATRIX_CUSTOM_fn_indicator); + break; + case _KB: + rgb_matrix_mode(RGB_MATRIX_CUSTOM_kb_indicator); + break; + } + + return state; +} diff --git a/keyboards/dztech/dz65rgb/keymaps/jumper149/readme.md b/keyboards/dztech/dz65rgb/keymaps/jumper149/readme.md new file mode 100644 index 0000000000..d872587317 --- /dev/null +++ b/keyboards/dztech/dz65rgb/keymaps/jumper149/readme.md @@ -0,0 +1,24 @@ +# jumper149's DZ65RGB v2 + +Run commands in the root directory of this repository. + +``` +./bin/qmk compile && sudo dfu-programmer atmega32u4 erase && sudo dfu-programmer atmega32u4 flash ./dztech_dz65rgb_v2_jumper149.hex && sudo dfu-programmer atmega32u4 reset +``` + +## build + +``` +./bin/qmk compile +``` + +## flash + +Use `qmk flash` or if it is broken (unknown reason) you can try this workaround. +I personally had some problems on ArchLinux, that I didn't debug any further though. + +``` +sudo dfu-programmer atmega32u4 erase +sudo dfu-programmer atmega32u4 flash ./dztech_dz65rgb_v2_jumper149.hex +sudo dfu-programmer atmega32u4 reset +``` diff --git a/keyboards/dztech/dz65rgb/keymaps/jumper149/rgb_matrix_user.inc b/keyboards/dztech/dz65rgb/keymaps/jumper149/rgb_matrix_user.inc new file mode 100644 index 0000000000..8d99ff9481 --- /dev/null +++ b/keyboards/dztech/dz65rgb/keymaps/jumper149/rgb_matrix_user.inc @@ -0,0 +1,700 @@ +/* Copyright 2021 Felix Springer + * + * 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/>. + */ +RGB_MATRIX_EFFECT(base_effect) +RGB_MATRIX_EFFECT(base_ad_effect) +RGB_MATRIX_EFFECT(vi_effect) +RGB_MATRIX_EFFECT(fn_indicator) +RGB_MATRIX_EFFECT(kb_indicator) +RGB_MATRIX_EFFECT(kitt_effect) + +#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS + +/* +[_LEDS] = LAYOUT_65_ansi( + 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14 , + 15 , 16 Q, 17 W, 18 E, 19 R, 20 T, 21 Y, 22 U, 23 I, 24 O, 25 P, 26 , 27 , 28 , 29 , + 30 , 31 A, 32 S, 33 D, 34 F, 35 G, 36 H, 37 J, 38 K, 39 L, 40 , 41 , 42 , 43 , + 44 , 45 Z, 46 X, 47 C, 48 V, 49 B, 50 N, 51 M, 52 , 53 , 54 , 55 , 56 , 57 , + 58 , 59 , 60 , 61 , 62 , 63 , 64 , 65 , 66 , 67 +) +*/ + +// variable for startup animation +bool BASE_EFFECT_NOT_STARTED_YET = true; +uint8_t base_effect_startup_counter = 255; + +static HSV base_effect_math(HSV hsv, uint8_t i, uint8_t time) { + + if (BASE_EFFECT_NOT_STARTED_YET) { + base_effect_startup_counter = 0; + BASE_EFFECT_NOT_STARTED_YET = false; + } + + // startup animation + if (base_effect_startup_counter < 255) { + + // jump to correct indices for alpha keys + if (i == 0) { // only run for one key (key 0 is an arbitrary choice) + if (base_effect_startup_counter == 0) { + base_effect_startup_counter = 1; + } else if (base_effect_startup_counter == 1) { + base_effect_startup_counter = 17; + } else if (base_effect_startup_counter == 26) { + base_effect_startup_counter = 31; + } else if (base_effect_startup_counter == 40) { + base_effect_startup_counter = 45; + } else if (base_effect_startup_counter == 52) { + base_effect_startup_counter = 100; + } else if (base_effect_startup_counter == 120) { + base_effect_startup_counter = 255; + } else { + base_effect_startup_counter++; + } + } + + // overwrite some highlit keys + if (3 + 39 - i < base_effect_startup_counter - 100 && i >= 36 && i <= 39) { + hsv.s = hsv.s; + } else if (3 + 39 - i < base_effect_startup_counter - 100 && i >= 31 && i <= 34) { + hsv.s = hsv.s; + // light up alpha keys + } else if (i < base_effect_startup_counter && i >= 16 && i <= 25) { + hsv.s = 0; + } else if (31 + 39 - i < base_effect_startup_counter && i >= 31 && i <= 39) { + hsv.s = 0; + } else if (i < base_effect_startup_counter && i >= 45 && i <= 51) { + hsv.s = 0; + // light up number row + } else if (12 + 1 - i < base_effect_startup_counter - 100 && i == 2) { + hsv.s = 0; + hsv.v = 1 * (hsv.v / 8); + } else if (12 + 1 - i < base_effect_startup_counter - 100 && i == 3) { + hsv.s = 0; + hsv.v = 2 * (hsv.v / 8); + } else if (12 + 1 - i < base_effect_startup_counter - 100 && i == 4) { + hsv.s = 0; + hsv.v = 3 * (hsv.v / 8); + } else if (12 + 1 - i < base_effect_startup_counter - 100 && i >= 5 && i <= 8) { + hsv.v = hsv.v; + } else if (12 + 1 - i < base_effect_startup_counter - 100 && i == 9) { + hsv.s = 0; + hsv.v = 3 * (hsv.v / 8); + } else if (12 + 1 - i < base_effect_startup_counter - 100 && i == 10) { + hsv.s = 0; + hsv.v = 2 * (hsv.v / 8); + } else if (12 + 1 - i < base_effect_startup_counter - 100 && i == 11) { + hsv.s = 0; + hsv.v = 1 * (hsv.v / 8); + // light up punctuation keys + } else if (27 + 1 - i < base_effect_startup_counter - 100 && i >= 26 && i <= 27) { + hsv.s = 0; + hsv.v = hsv.v / 8; + } else if (41 + 2 - i < base_effect_startup_counter - 100 && i >= 40 && i <= 41) { + hsv.s = 0; + hsv.v = hsv.v / 8; + } else if (54 + 3 - i < base_effect_startup_counter - 100 && i >= 52 && i <= 54) { + hsv.s = 0; + hsv.v = hsv.v / 8; + // rest + } else { + hsv.v = 0; + } + + } else { + + switch (i) { + + // number row + case 0: + hsv.v = 0; + break; + case 1: + hsv.v = 0; + break; + case 2: + hsv.s = 0; + hsv.v = 1 * (hsv.v / 8); + break; + case 3: + hsv.s = 0; + hsv.v = 2 * (hsv.v / 8); + break; + case 4: + hsv.s = 0; + hsv.v = 3 * (hsv.v / 8); + break; + case 5: + hsv.v = hsv.v; + break; + case 6: + hsv.v = hsv.v; + break; + case 7: + hsv.v = hsv.v; + break; + case 8: + hsv.v = hsv.v; + break; + case 9: + hsv.s = 0; + hsv.v = 3 * (hsv.v / 8); + break; + case 10: + hsv.s = 0; + hsv.v = 2 * (hsv.v / 8); + break; + case 11: + hsv.s = 0; + hsv.v = 1 * (hsv.v / 8); + break; + case 12: + hsv.v = 0; + break; + + // punctuation keys + case 26: + hsv.s = 0; + hsv.v = hsv.v / 8; + break; + case 27: + hsv.s = 0; + hsv.v = hsv.v / 8; + break; + case 40: + hsv.s = 0; + hsv.v = hsv.v / 8; + break; + case 41: + hsv.s = 0; + hsv.v = hsv.v / 8; + break; + case 52: + hsv.s = 0; + hsv.v = hsv.v / 8; + break; + case 53: + hsv.s = 0; + hsv.v = hsv.v / 8; + break; + case 54: + hsv.s = 0; + hsv.v = hsv.v / 8; + break; + + default: + if ( + (i > 15 && i <= 25) || + (i > 30 && i <= 39) || + (i > 44 && i <= 51) + ) { + if (i > 35 && i <= 39) { + hsv.s = hsv.s; + } else if (i > 30 && i <= 34) { + hsv.s = hsv.s; + } else { + hsv.s = 0; + } + } else { + hsv.v = 0; + } + break; + + } + + } + + return hsv; +} + +bool base_effect(effect_params_t* params) { + return effect_runner_i(params, &base_effect_math); +} + +static HSV base_ad_effect_math(HSV hsv, uint8_t i, uint8_t time) { + + // no startup animation + if (BASE_EFFECT_NOT_STARTED_YET) { + base_effect_startup_counter = 255; // act like startup is already completed + BASE_EFFECT_NOT_STARTED_YET = false; + } + + switch (i) { + + // delete + case 14: + hsv.h = 0; + hsv.s = 255; + break; + + // insert + case 29: + hsv.h = 255/3; + hsv.s = 255; + break; + + // home + case 43: + hsv.s = 0; + break; + + // end + case 57: + hsv.s = 255; + break; + + default: + hsv = base_effect_math(hsv, i, time); + break; + + } + + return hsv; +} + +bool base_ad_effect(effect_params_t* params) { + return effect_runner_i(params, &base_ad_effect_math); +} + +static HSV vi_effect_math(HSV hsv, uint8_t i, uint8_t time) { + + // no startup animation + if (BASE_EFFECT_NOT_STARTED_YET) { + base_effect_startup_counter = 255; // act like startup is already completed + BASE_EFFECT_NOT_STARTED_YET = false; + } + + switch (i) { + + // hjkl + case 36: + break; + case 37: + break; + case 38: + break; + case 39: + break; + + // page up + case 22: + hsv.s = 0; + break; + + // page down + case 33: + hsv.s = 0; + break; + + // find + case 54: + hsv.s = 0; + break; + + default: + hsv.v = 0; + break; + + } + + return hsv; +} + +bool vi_effect(effect_params_t* params) { + return effect_runner_i(params, &vi_effect_math); +} + +static HSV fn_indicator_math(HSV hsv, uint8_t i, uint8_t time) { + + // cancel base effect startup + base_effect_startup_counter = 255; + + switch (i) { + + // F1 - F12 + case 1: + hsv.h = 0 * 255 / 3; + hsv.s = 255; + break; + case 2: + hsv.h = 0 * 255 / 3; + hsv.s = 255; + break; + case 3: + hsv.h = 0 * 255 / 3; + hsv.s = 255; + break; + case 4: + hsv.h = 0 * 255 / 3; + hsv.s = 255; + break; + case 5: + hsv.h = 1 * 255 / 3; + hsv.s = 255; + break; + case 6: + hsv.h = 1 * 255 / 3; + hsv.s = 255; + break; + case 7: + hsv.h = 1 * 255 / 3; + hsv.s = 255; + break; + case 8: + hsv.h = 1 * 255 / 3; + hsv.s = 255; + break; + case 9: + hsv.h = 2 * 255 / 3; + hsv.s = 255; + break; + case 10: + hsv.h = 2 * 255 / 3; + hsv.s = 255; + break; + case 11: + hsv.h = 2 * 255 / 3; + hsv.s = 255; + break; + case 12: + hsv.h = 2 * 255 / 3; + hsv.s = 255; + break; + + // delete/insert + case 13: + hsv.h = 0; + hsv.s = 255; + break; + case 14: + hsv.h = 1 * (255 / 3); + hsv.s = 255; + break; + + // paste/copy/cut + case 29: + hsv.s = 0; + break; + case 43: + hsv.h = 200; + hsv.s = 255; + break; + case 57: + hsv.h = 0; + hsv.s = 255; + break; + + // print/scroll/pause + case 25: + hsv.s = 0; + break; + case 26: + hsv.s = 0; + break; + case 27: + hsv.s = 0; + break; + + // caps lock + case 30: + hsv.s = 0; + break; + + // modifier + case 44: + hsv.s = 0; + hsv.v = hsv.v / 2; + break; + case 55: + hsv.s = 0; + hsv.v = hsv.v / 2; + break; + case 58: + hsv.s = 0; + hsv.v = hsv.v / 2; + break; + case 59: + hsv.s = 0; + hsv.v = hsv.v / 2; + break; + case 60: + hsv.s = 0; + hsv.v = hsv.v / 2; + break; + case 64: + hsv.s = 0; + hsv.v = hsv.v / 2; + break; + + // volume + case 18: // mute + hsv.h = 0; + break; + case 17: // increase + hsv.s = 255; + break; + case 32: // decrease + hsv.s = 0; + break; + + // brightness + case 33: // increase + hsv.s = 255; + break; + case 31: // decrease + hsv.s = 0; + break; + + // media + case 65: // previous + hsv.s = 0; + break; + case 67: // next + hsv.s = 0; + break; + case 56: // stop + hsv.h = 0; + break; + case 66: // play/pause + hsv.h = 255/3; + break; + + // menu + case 51: + hsv.s = 0; + break; + + // toggle AD layer + case 36: + hsv.h = 0; + break; + + // toggle VI layer + case 37: + hsv.h = 255/3; + break; + + // KB layer + case 62: + hsv.h = time; + hsv.s = 255; + break; + + // no function + default: + hsv.v = 0; + break; + + } + + return hsv; +} + +bool fn_indicator(effect_params_t* params) { + return effect_runner_i(params, &fn_indicator_math); +} + +static HSV kb_indicator_math(HSV hsv, uint8_t i, uint8_t time) { + + // cancel base effect startup + base_effect_startup_counter = 255; + + switch (i) { + + // test HSV + case 14: + break; + case 29: + break; + case 43: + break; + case 57: + break; + case 67: + break; + + // toggle RGB + case 16: + hsv.s = 0; + if (time < (255 / 2)) { + hsv.v = 255; + } else { + hsv.v = 0; + } + break; + + // cycle effect + case 17: + hsv.s = 255; + hsv.v = 255; + if (time < (255 / 3)) { + hsv.h = 0; + } else if (time < (2 * 255 / 3)) { + hsv.h = 255 / 3; + } else { + hsv.h = 2 * 255 / 3; + } + break; + + // adjust hue + case 18: + hsv.h = time; + hsv.s = 255; + hsv.v = 255; + break; + case 19: + hsv.h = 255 - time; + hsv.s = 255; + hsv.v = 255; + break; + + // adjust saturation + case 32: + hsv.s = 255; + hsv.v = 255; + break; + case 33: + hsv.s = 0; + hsv.v = 255; + break; + + // adjust value + case 45: + hsv.v = 255; + break; + case 46: + hsv.v = 63; + break; + + // adjust speed + case 4: + if (((time / 8) % 2) == 0) { + hsv.v = 255; + } else { + hsv.v = 63; + } + break; + case 5: + if (((time / 16) % 2) == 0) { + hsv.v = 63; + } else { + hsv.v = 255; + } + break; + + // set main effect + case 36: // BASE + hsv.s = 0; + break; + case 37: // KITT + hsv.h = 0; + hsv.s = 255; + if (time < 128) { + hsv.v = time; + } else { + hsv.v = 255 - time; + } + break; + + // reset (for flashing) + case 13: + hsv.s = 0; + if (time < 16) { + hsv.v = 255 - time * 128 / 16; + } else { + hsv.v = 127; + } + break; + + // reset (reinitialize EEPROM) + case 42: + hsv.s = 0; + hsv.v = 127; + break; + + // shift + case 44: + hsv.s = 0; + hsv.v = 63; + break; + case 55: + hsv.s = 0; + hsv.v = 63; + break; + + // no function + default: + hsv.v = 0; + + } + + return hsv; +} + +bool kb_indicator(effect_params_t* params) { + return effect_runner_i(params, &kb_indicator_math); +} + +uint8_t led_count = 7; +uint8_t led_first = 33; +static uint8_t time_to_led(uint8_t time, uint8_t led_behind) { + uint16_t led_time = led_count * time; + uint16_t step = ((2 * led_count + (led_time / 128)) - led_behind) % (2 * led_count); + uint8_t led; + if (step < led_count) { + led = step; + } else { + led = led_count - 1 - (step - led_count); + } + return led; +} + +static HSV kitt_effect_math(HSV hsv, uint8_t i, uint8_t time) { + + // reset base effect startup + if (i == 0) { + BASE_EFFECT_NOT_STARTED_YET = true; + } + + hsv.h = 0; + hsv.s = 255; + + if (i >= led_first && i < led_first + led_count) { + uint8_t j = i - led_first; + if (j == time_to_led(time, 0)) { + hsv.v = hsv.v; + } else if (j == time_to_led(time, 1)) { + hsv.v = hsv.v/2; + } else if (j == time_to_led(time, 2)) { + hsv.v = hsv.v/4; + } else if (j == time_to_led(time, 3)) { + hsv.v = hsv.v/8; + } else { + hsv.v = 0; + } + } else { + hsv.v = 0; + } + + return hsv; +} + +bool kitt_effect(effect_params_t* params) { + return effect_runner_i(params, &kitt_effect_math); +} + +#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS + +// vim: syntax=c diff --git a/keyboards/dztech/dz65rgb/keymaps/jumper149/rules.mk b/keyboards/dztech/dz65rgb/keymaps/jumper149/rules.mk new file mode 100644 index 0000000000..6245023e80 --- /dev/null +++ b/keyboards/dztech/dz65rgb/keymaps/jumper149/rules.mk @@ -0,0 +1 @@ +RGB_MATRIX_CUSTOM_USER = yes |