From 5fa2aab41e295f05bcfd14e93745b51b15938015 Mon Sep 17 00:00:00 2001 From: HorrorTroll Date: Fri, 30 Dec 2022 07:59:55 +0700 Subject: Added support keyboard Pila87 / XM87 PRO (#18919) --- keyboards/horrortroll/readme.md | 2 +- keyboards/phage_studio/pila87/config.h | 100 +++++++++ keyboards/phage_studio/pila87/info.json | 109 ++++++++++ .../phage_studio/pila87/keymaps/default/keymap.c | 175 +++++++++++++++ .../pila87/keymaps/horrortroll/config.h | 26 +++ .../pila87/keymaps/horrortroll/keymap.c | 88 ++++++++ .../pila87/keymaps/horrortroll/keymap_stuff.h | 236 +++++++++++++++++++++ .../pila87/keymaps/horrortroll/led/cool_diagonal.c | 22 ++ .../keymaps/horrortroll/led/custom_gradient.c | 74 +++++++ .../led/flower_blooming/flower_blooming.c | 27 +++ .../led/flower_blooming/flower_blooming.h | 36 ++++ .../pila87/keymaps/horrortroll/led/kitt.c | 68 ++++++ .../horrortroll/led/random_breath_rainbow.c | 55 +++++ .../pila87/keymaps/horrortroll/readme.md | 9 + .../pila87/keymaps/horrortroll/rgb_matrix_user.inc | 15 ++ .../pila87/keymaps/horrortroll/rules.mk | 3 + keyboards/phage_studio/pila87/keymaps/via/keymap.c | 175 +++++++++++++++ keyboards/phage_studio/pila87/keymaps/via/rules.mk | 1 + keyboards/phage_studio/pila87/pila87.c | 65 ++++++ keyboards/phage_studio/pila87/pila87.h | 55 +++++ keyboards/phage_studio/pila87/readme.md | 34 +++ keyboards/phage_studio/pila87/rules.mk | 38 ++++ 22 files changed, 1412 insertions(+), 1 deletion(-) create mode 100644 keyboards/phage_studio/pila87/config.h create mode 100644 keyboards/phage_studio/pila87/info.json create mode 100644 keyboards/phage_studio/pila87/keymaps/default/keymap.c create mode 100644 keyboards/phage_studio/pila87/keymaps/horrortroll/config.h create mode 100644 keyboards/phage_studio/pila87/keymaps/horrortroll/keymap.c create mode 100644 keyboards/phage_studio/pila87/keymaps/horrortroll/keymap_stuff.h create mode 100644 keyboards/phage_studio/pila87/keymaps/horrortroll/led/cool_diagonal.c create mode 100644 keyboards/phage_studio/pila87/keymaps/horrortroll/led/custom_gradient.c create mode 100644 keyboards/phage_studio/pila87/keymaps/horrortroll/led/flower_blooming/flower_blooming.c create mode 100644 keyboards/phage_studio/pila87/keymaps/horrortroll/led/flower_blooming/flower_blooming.h create mode 100644 keyboards/phage_studio/pila87/keymaps/horrortroll/led/kitt.c create mode 100644 keyboards/phage_studio/pila87/keymaps/horrortroll/led/random_breath_rainbow.c create mode 100644 keyboards/phage_studio/pila87/keymaps/horrortroll/readme.md create mode 100644 keyboards/phage_studio/pila87/keymaps/horrortroll/rgb_matrix_user.inc create mode 100644 keyboards/phage_studio/pila87/keymaps/horrortroll/rules.mk create mode 100644 keyboards/phage_studio/pila87/keymaps/via/keymap.c create mode 100644 keyboards/phage_studio/pila87/keymaps/via/rules.mk create mode 100644 keyboards/phage_studio/pila87/pila87.c create mode 100644 keyboards/phage_studio/pila87/pila87.h create mode 100644 keyboards/phage_studio/pila87/readme.md create mode 100644 keyboards/phage_studio/pila87/rules.mk (limited to 'keyboards') diff --git a/keyboards/horrortroll/readme.md b/keyboards/horrortroll/readme.md index b6f5e8420b..67347a3c16 100644 --- a/keyboards/horrortroll/readme.md +++ b/keyboards/horrortroll/readme.md @@ -25,7 +25,7 @@ | [KB16-01 (Rev 2)](https://github.com/qmk/qmk_firmware/tree/master/keyboards/doio/kb16/rev2) | APM32F103CBT6 | TKL | 0xD010 | 0x1601 | Hotswap, RGB Matrix, 3 Encoder, OLED 128x32 | | [M63 RGB](https://github.com/qmk/qmk_firmware/blob/master/keyboards/mss_studio/m63_rgb) | STM32F072CBU6 | 60% | 0x4D4B | 0x6063 | Hotswap, RGB Matrix & Underglow | | [M64 RGB](https://github.com/qmk/qmk_firmware/blob/master/keyboards/mss_studio/m64_rgb) | STM32F072CBU6 | 60% | 0x4D4B | 0x6064 | Hotswap, RGB Matrix & Underglow | - + | [Pila87](https://github.com/qmk/qmk_firmware/blob/master/keyboards/phage_studio/pila87) | CKS32F103CBT6 | TKL | 0x5048 | 0x5887 | Hotswap, RGB Matrix & Underglow (External) | ## Contact me if you have any problem diff --git a/keyboards/phage_studio/pila87/config.h b/keyboards/phage_studio/pila87/config.h new file mode 100644 index 0000000000..819f748180 --- /dev/null +++ b/keyboards/phage_studio/pila87/config.h @@ -0,0 +1,100 @@ +/* Copyright 2022 Phage Studio + * Copyright 2022 HorrorTroll + * + * 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 . + */ + +#pragma once + +#include "config_common.h" + +/* Key matrix size */ +#define MATRIX_ROWS 6 +#define MATRIX_COLS 17 + +/* Key matrix pins */ +#define MATRIX_ROW_PINS { A1, A2, A10, A9, A8, C9 } +#define MATRIX_COL_PINS { B5, B4, B6, C0, C1, C2, C3, B7, B3, D2, C12, C11, C10, A15, C15, C13, A3 } + +/* COL2ROW or ROW2COL */ +#define DIODE_DIRECTION COL2ROW + +/* Set 0 if debouncing isn't needed */ +#define DEBOUNCE 5 + +/* Bootmagic reset */ +#define BOOTMAGIC_LITE_ROW 0 +#define BOOTMAGIC_LITE_COLUMN 0 + +/* LED Indicator */ +#define LED_CAPS_LOCK_PIN C14 +#define LED_SCROLL_LOCK_PIN A0 + +#ifdef RGB_MATRIX_ENABLE + #define RGB_MATRIX_LED_COUNT 91 + #define RGB_MATRIX_MAXIMUM_BRIGHTNESS 200 + #define RGB_MATRIX_STARTUP_VAL RGB_MATRIX_MAXIMUM_BRIGHTNESS + #define RGB_MATRIX_KEYPRESSES + #define RGB_MATRIX_FRAMEBUFFER_EFFECTS + + /* RGB Matrix config */ + #define RGB_DI_PIN A4 + + /* RGB Matrix effect */ + #define ENABLE_RGB_MATRIX_ALPHAS_MODS + #define ENABLE_RGB_MATRIX_GRADIENT_UP_DOWN + #define ENABLE_RGB_MATRIX_GRADIENT_LEFT_RIGHT + #define ENABLE_RGB_MATRIX_BREATHING + #define ENABLE_RGB_MATRIX_BAND_SAT + #define ENABLE_RGB_MATRIX_BAND_VAL + #define ENABLE_RGB_MATRIX_BAND_PINWHEEL_SAT + #define ENABLE_RGB_MATRIX_BAND_PINWHEEL_VAL + #define ENABLE_RGB_MATRIX_BAND_SPIRAL_SAT + #define ENABLE_RGB_MATRIX_BAND_SPIRAL_VAL + #define ENABLE_RGB_MATRIX_CYCLE_ALL + #define ENABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT + #define ENABLE_RGB_MATRIX_CYCLE_UP_DOWN + #define ENABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON + #define ENABLE_RGB_MATRIX_CYCLE_OUT_IN + #define ENABLE_RGB_MATRIX_CYCLE_OUT_IN_DUAL + #define ENABLE_RGB_MATRIX_CYCLE_PINWHEEL + #define ENABLE_RGB_MATRIX_CYCLE_SPIRAL + #define ENABLE_RGB_MATRIX_DUAL_BEACON + #define ENABLE_RGB_MATRIX_RAINBOW_BEACON + #define ENABLE_RGB_MATRIX_RAINBOW_PINWHEELS + #define ENABLE_RGB_MATRIX_RAINDROPS + #define ENABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS + #define ENABLE_RGB_MATRIX_HUE_BREATHING + #define ENABLE_RGB_MATRIX_HUE_PENDULUM + #define ENABLE_RGB_MATRIX_HUE_WAVE + #define ENABLE_RGB_MATRIX_PIXEL_RAIN + #define ENABLE_RGB_MATRIX_PIXEL_FLOW + #define ENABLE_RGB_MATRIX_PIXEL_FRACTAL + + #define ENABLE_RGB_MATRIX_TYPING_HEATMAP + #define ENABLE_RGB_MATRIX_DIGITAL_RAIN + + #define ENABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE + #define ENABLE_RGB_MATRIX_SOLID_REACTIVE + #define ENABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE + #define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE + #define ENABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS + #define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS + #define ENABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS + #define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS + #define ENABLE_RGB_MATRIX_SPLASH + #define ENABLE_RGB_MATRIX_MULTISPLASH + #define ENABLE_RGB_MATRIX_SOLID_SPLASH + #define ENABLE_RGB_MATRIX_SOLID_MULTISPLASH +#endif diff --git a/keyboards/phage_studio/pila87/info.json b/keyboards/phage_studio/pila87/info.json new file mode 100644 index 0000000000..920c1d8c0a --- /dev/null +++ b/keyboards/phage_studio/pila87/info.json @@ -0,0 +1,109 @@ +{ + "keyboard_name": "Pila87 / XM87 Pro", + "manufacturer": "Phage Studio", + "url": "https://item.taobao.com/item.htm?spm=a21wu.12321156-tw.0.0.22283343ytyJJv&id=649438917009", + "maintainer": "Phage Studio", + "usb": { + "vid": "0x5048", + "pid": "0x5887", + "device_version": "0.0.1" + }, + "layouts": { + "LAYOUT_tkl_ansi": { + "layout": [ + {"label":"Esc", "x":0, "y":0}, + {"label":"F1", "x":2, "y":0}, + {"label":"F2", "x":3, "y":0}, + {"label":"F3", "x":4, "y":0}, + {"label":"F4", "x":5, "y":0}, + {"label":"F5", "x":6.5, "y":0}, + {"label":"F6", "x":7.5, "y":0}, + {"label":"F7", "x":8.5, "y":0}, + {"label":"F8", "x":9.5, "y":0}, + {"label":"F9", "x":11, "y":0}, + {"label":"F10", "x":12, "y":0}, + {"label":"F11", "x":13, "y":0}, + {"label":"F12", "x":14, "y":0}, + {"label":"Print Screen", "x":15.25, "y":0}, + {"label":"Scroll Lock", "x":16.25, "y":0}, + {"label":"Pause", "x":17.25, "y":0}, + + {"label":"`~", "x":0, "y":1.5}, + {"label":"1!", "x":1, "y":1.5}, + {"label":"2@", "x":2, "y":1.5}, + {"label":"3#", "x":3, "y":1.5}, + {"label":"4$", "x":4, "y":1.5}, + {"label":"5%", "x":5, "y":1.5}, + {"label":"6^", "x":6, "y":1.5}, + {"label":"7&", "x":7, "y":1.5}, + {"label":"8*", "x":8, "y":1.5}, + {"label":"9(", "x":9, "y":1.5}, + {"label":"0)", "x":10, "y":1.5}, + {"label":"-_", "x":11, "y":1.5}, + {"label":"=+", "x":12, "y":1.5}, + {"label":"Backspace", "x":13, "y":1.5, "w":2}, + {"label":"Insert", "x":15.25, "y":1.5}, + {"label":"Home", "x":16.25, "y":1.5}, + {"label":"PgUp", "x":17.25, "y":1.5}, + + {"label":"Tab", "x":0, "y":2.5, "w":1.5}, + {"label":"Q", "x":1.5, "y":2.5}, + {"label":"W", "x":2.5, "y":2.5}, + {"label":"E", "x":3.5, "y":2.5}, + {"label":"R", "x":4.5, "y":2.5}, + {"label":"T", "x":5.5, "y":2.5}, + {"label":"Y", "x":6.5, "y":2.5}, + {"label":"U", "x":7.5, "y":2.5}, + {"label":"I", "x":8.5, "y":2.5}, + {"label":"O", "x":9.5, "y":2.5}, + {"label":"P", "x":10.5, "y":2.5}, + {"label":"[{", "x":11.5, "y":2.5}, + {"label":"]}", "x":12.5, "y":2.5}, + {"label":"\\|", "x":13.5, "y":2.5, "w":1.5}, + {"label":"Delete", "x":15.25, "y":2.5}, + {"label":"End", "x":16.25, "y":2.5}, + {"label":"PgDn", "x":17.25, "y":2.5}, + + {"label":"Caps Lock", "x":0, "y":3.5, "w":1.75}, + {"label":"A", "x":1.75, "y":3.5}, + {"label":"S", "x":2.75, "y":3.5}, + {"label":"D", "x":3.75, "y":3.5}, + {"label":"F", "x":4.75, "y":3.5}, + {"label":"G", "x":5.75, "y":3.5}, + {"label":"H", "x":6.75, "y":3.5}, + {"label":"J", "x":7.75, "y":3.5}, + {"label":"K", "x":8.75, "y":3.5}, + {"label":"L", "x":9.75, "y":3.5}, + {"label":";:", "x":10.75, "y":3.5}, + {"label":"'\"", "x":11.75, "y":3.5}, + {"label":"Enter", "x":12.75, "y":3.5, "w":2.25}, + + {"label":"Shift", "x":0, "y":4.5, "w":2.25}, + {"label":"Z", "x":2.25, "y":4.5}, + {"label":"X", "x":3.25, "y":4.5}, + {"label":"C", "x":4.25, "y":4.5}, + {"label":"V", "x":5.25, "y":4.5}, + {"label":"B", "x":6.25, "y":4.5}, + {"label":"N", "x":7.25, "y":4.5}, + {"label":"M", "x":8.25, "y":4.5}, + {"label":",<", "x":9.25, "y":4.5}, + {"label":".>", "x":10.25, "y":4.5}, + {"label":"/?", "x":11.25, "y":4.5}, + {"label":"Shift", "x":12.25, "y":4.5, "w":2.75}, + {"label":"\u2191", "x":16.25, "y":4.5}, + + {"label":"Ctrl", "x":0, "y":5.5, "w":1.25}, + {"label":"Win", "x":1.25, "y":5.5, "w":1.25}, + {"label":"Alt", "x":2.5, "y":5.5, "w":1.25}, + {"label":"Space", "x":3.75, "y":5.5, "w":6.25}, + {"label":"Alt", "x":10, "y":5.5, "w":1.25}, + {"label":"Fn", "x":11.25, "y":5.5, "w":1.25}, + {"label":"App", "x":12.5, "y":5.5, "w":1.25}, + {"label":"Ctrl", "x":13.75, "y":5.5, "w":1.25}, + {"label":"\u2190", "x":15.25, "y":5.5}, + {"label":"\u2193", "x":16.25, "y":5.5}, + {"label":"\u2192", "x":17.25, "y":5.5} + ] + } + } +} diff --git a/keyboards/phage_studio/pila87/keymaps/default/keymap.c b/keyboards/phage_studio/pila87/keymaps/default/keymap.c new file mode 100644 index 0000000000..f2de085ca6 --- /dev/null +++ b/keyboards/phage_studio/pila87/keymaps/default/keymap.c @@ -0,0 +1,175 @@ +/* Copyright 2022 Phage Studio + * Copyright 2022 HorrorTroll + * + * 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 . + */ + +#include QMK_KEYBOARD_H + +// Each layer gets a name for readability, which is then used in the keymap matrix below. +// The underscores don't mean anything - you can have a layer called STUFF or any other name. +// Layer names don't all need to be of the same length, obviously, and you can also skip them +// entirely and just use numbers. + +enum layer_names { + _BASE, + _FN1, + _FN2, + _FN3 +}; + +// enum layer_keycodes { }; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + +/* + ┌───┐ ┌───┬───┬───┬───┐ ┌───┬───┬───┬───┐ ┌───┬───┬───┬───┐ ┌───┬───┬───┐ + │Esc│ │F1 │F2 │F3 │F4 │ │F5 │F6 │F7 │F8 │ │F9 │F10│F11│F12│ │PSc│Scr│Pse│ + └───┘ └───┴───┴───┴───┘ └───┴───┴───┴───┘ └───┴───┴───┴───┘ └───┴───┴───┘ + ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ ┌───┬───┬───┐ + │ ` │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ - │ = │ Backsp│ │Ins│Hom│PgU│ + ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ ├───┼───┼───┤ + │ Tab │ q │ w │ e │ r │ t │ y │ u │ i │ o │ p │ [ │ ] │ \ │ │Del│End│PgD│ + ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┤ └───┴───┴───┘ + │ Caps │ a │ s │ d │ f │ g │ h │ j │ k │ l │ ; │ ' │ Enter │ + ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────────┤ ┌───┐ + │ LShift │ z │ x │ c │ v │ b │ n │ m │ , │ . │ / │ RShift │ │ ↑ │ + ├────┬───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ ┌───┼───┼───┐ + │LCrl│GUI │LAlt│ Space │RAlt│ Fn │ App│RCrl│ │ ← │ ↓ │ → │ + └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ └───┴───┴───┘ + ┌───┐ ┌───┬───┬───┬───┐ ┌───┬───┬───┬───┐ ┌───┬───┬───┬───┐ ┌───┬───┬───┐ + │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ + └───┘ └───┴───┴───┴───┘ └───┴───┴───┴───┘ └───┴───┴───┴───┘ └───┴───┴───┘ + ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ ┌───┬───┬───┐ + │ ~ │ ! │ @ │ # │ $ │ % │ ^ │ & │ * │ ( │ ) │ _ │ + │ │ │ │ │ │ + ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ ├───┼───┼───┤ + │ │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │ { │ } │ | │ │ │ │ │ + ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┤ └───┴───┴───┘ + │ Caps │ A │ S │ D │ F │ G │ H │ J │ K │ L │ : │ " │ │ + ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────────┤ ┌───┐ + │ LShift │ Z │ X │ C │ V │ B │ N │ M │ < │ > │ ? │ RShift │ │ │ + ├────┬───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ ┌───┼───┼───┐ + │ │ │ │ │ │ │ │ │ │ │ │ │ + └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ └───┴───┴───┘ +*/ + /* Row: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 */ + [_BASE] = LAYOUT_tkl_ansi( + 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_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(_FN1), KC_APP, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT + ), + +/* + ┌───┐ ┌───┬───┬───┬───┐ ┌───┬───┬───┬───┐ ┌───┬───┬───┬───┐ ┌───┬───┬───┐ + │Rst│ │Tog│Mod│Hui│Hud│ │Sai│Sad│Vai│Vad│ │Spi│Spd│Est│NKO│ │ │ │ │ + └───┘ └───┴───┴───┴───┘ └───┴───┴───┴───┘ └───┴───┴───┴───┘ └───┴───┴───┘ + ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ ┌───┬───┬───┐ + │ │F1 │F2 │F3 │F4 │F5 │F6 │F7 │F8 │F9 │F10│F11│F12│ │ │ │ │ │ + ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ ├───┼───┼───┤ + │ │ │Bks│ │ │ │ │ │ ↑ │ │ │ │ │ │ │ │ │ │ + ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┤ └───┴───┴───┘ + │ │Ins│Del│Hom│End│PgU│PgD│ ← │ ↓ │ → │ │ │ │ + ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────────┤ ┌───┐ + │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ + ├────┬───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ ┌───┼───┼───┐ + │ │ │ │ │ │ Fn │ │ │ │ │ │ │ + └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ └───┴───┴───┘ +*/ + /* Row: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 */ + [_FN1] = LAYOUT_tkl_ansi( + QK_BOOT, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, RGB_SPI, RGB_SPD, _______, NK_TOGG, _______, _______, _______, + _______, 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_BSPC, _______, _______, _______, _______, _______, KC_UP, _______, _______, _______, _______, _______, _______, _______, _______, + _______, KC_INS, KC_DEL, KC_HOME, KC_END, KC_PGUP, KC_PGDN, KC_LEFT, KC_DOWN, KC_RGHT, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ + ), + +/* + ┌───┐ ┌───┬───┬───┬───┐ ┌───┬───┬───┬───┐ ┌───┬───┬───┬───┐ ┌───┬───┬───┐ + │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ + └───┘ └───┴───┴───┴───┘ └───┴───┴───┴───┘ └───┴───┴───┴───┘ └───┴───┴───┘ + ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ ┌───┬───┬───┐ + │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ + ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ ├───┼───┼───┤ + │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ + ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┤ └───┴───┴───┘ + │ │ │ │ │ │ │ │ │ │ │ │ │ │ + ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────────┤ ┌───┐ + │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ + ├────┬───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ ┌───┼───┼───┐ + │ │ │ │ │ │ │ │ │ │ │ │ │ + └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ └───┴───┴───┘ +*/ + /* Row: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 */ + [_FN2] = LAYOUT_tkl_ansi( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ + ), + +/* + ┌───┐ ┌───┬───┬───┬───┐ ┌───┬───┬───┬───┐ ┌───┬───┬───┬───┐ ┌───┬───┬───┐ + │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ + └───┘ └───┴───┴───┴───┘ └───┴───┴───┴───┘ └───┴───┴───┴───┘ └───┴───┴───┘ + ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ ┌───┬───┬───┐ + │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ + ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ ├───┼───┼───┤ + │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ + ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┤ └───┴───┴───┘ + │ │ │ │ │ │ │ │ │ │ │ │ │ │ + ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────────┤ ┌───┐ + │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ + ├────┬───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ ┌───┼───┼───┐ + │ │ │ │ │ │ │ │ │ │ │ │ │ + └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ └───┴───┴───┘ +*/ + /* Row: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 */ + [_FN3] = LAYOUT_tkl_ansi( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ + ), +}; + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case RGB_TOG: + if (record->event.pressed) { + switch (rgb_matrix_get_flags()) { + case LED_FLAG_ALL: { + rgb_matrix_set_flags(LED_FLAG_NONE); + rgb_matrix_set_color_all(0, 0, 0); + } + break; + default: { + rgb_matrix_set_flags(LED_FLAG_ALL); + rgb_matrix_enable_noeeprom(); + } + break; + } + } + return false; + } + return true; +} diff --git a/keyboards/phage_studio/pila87/keymaps/horrortroll/config.h b/keyboards/phage_studio/pila87/keymaps/horrortroll/config.h new file mode 100644 index 0000000000..04ddd591a5 --- /dev/null +++ b/keyboards/phage_studio/pila87/keymaps/horrortroll/config.h @@ -0,0 +1,26 @@ +/* Copyright 2022 HorrorTroll + * + * 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 . + */ + +#pragma once + +/* Forcing to use NKRO instead 6KRO */ +#define FORCE_NKRO + +#define DYNAMIC_KEYMAP_LAYER_COUNT 2 + +#ifdef RGB_MATRIX_ENABLE + #define RGB_MATRIX_SOLID_REACTIVE_GRADIENT_MODE +#endif diff --git a/keyboards/phage_studio/pila87/keymaps/horrortroll/keymap.c b/keyboards/phage_studio/pila87/keymaps/horrortroll/keymap.c new file mode 100644 index 0000000000..5528e28055 --- /dev/null +++ b/keyboards/phage_studio/pila87/keymaps/horrortroll/keymap.c @@ -0,0 +1,88 @@ +/* Copyright 2022 HorrorTroll + * + * 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 . + */ + +#include QMK_KEYBOARD_H + +#include "keymap_stuff.h" + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + +/* + ┌───┐ ┌───┬───┬───┬───┐ ┌───┬───┬───┬───┐ ┌───┬───┬───┬───┐ ┌───┬───┬───┐ + │Esc│ │F1 │F2 │F3 │F4 │ │F5 │F6 │F7 │F8 │ │F9 │F10│F11│F12│ │PSc│Scr│Pse│ + └───┘ └───┴───┴───┴───┘ └───┴───┴───┴───┘ └───┴───┴───┴───┘ └───┴───┴───┘ + ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ ┌───┬───┬───┐ + │ ` │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ - │ = │ Backsp│ │Ins│Hom│PgU│ + ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ ├───┼───┼───┤ + │ Tab │ q │ w │ e │ r │ t │ y │ u │ i │ o │ p │ [ │ ] │ \ │ │Del│End│PgD│ + ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┤ └───┴───┴───┘ + │ Caps │ a │ s │ d │ f │ g │ h │ j │ k │ l │ ; │ ' │ Enter │ + ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────────┤ ┌───┐ + │ LShift │ z │ x │ c │ v │ b │ n │ m │ , │ . │ / │ RShift │ │ ↑ │ + ├────┬───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ ┌───┼───┼───┐ + │LCrl│GUI │LAlt│ Space │RAlt│ Fn │ App│RCrl│ │ ← │ ↓ │ → │ + └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ └───┴───┴───┘ + ┌───┐ ┌───┬───┬───┬───┐ ┌───┬───┬───┬───┐ ┌───┬───┬───┬───┐ ┌───┬───┬───┐ + │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ + └───┘ └───┴───┴───┴───┘ └───┴───┴───┴───┘ └───┴───┴───┴───┘ └───┴───┴───┘ + ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ ┌───┬───┬───┐ + │ ~ │ ! │ @ │ # │ $ │ % │ ^ │ & │ * │ ( │ ) │ _ │ + │ │ │ │ │ │ + ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ ├───┼───┼───┤ + │ │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │ { │ } │ | │ │ │ │ │ + ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┤ └───┴───┴───┘ + │ Caps │ A │ S │ D │ F │ G │ H │ J │ K │ L │ : │ " │ │ + ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────────┤ ┌───┐ + │ LShift │ Z │ X │ C │ V │ B │ N │ M │ < │ > │ ? │ RShift │ │ │ + ├────┬───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ ┌───┼───┼───┐ + │ │ │ │ │ │ │ │ │ │ │ │ │ + └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ └───┴───┴───┘ +*/ + /* Row: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 */ + [_BASE] = LAYOUT_tkl_ansi( + 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_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(_FN), KC_APP, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT + ), + +/* + ┌───┐ ┌───┬───┬───┬───┐ ┌───┬───┬───┬───┐ ┌───┬───┬───┬───┐ ┌───┬───┬───┐ + │Rst│ │MeP│VoD│VoU│Mut│ │Stp│Prv│Ply│Nxt│ │Mai│Hom│Cal│Sch│ │Rod│Mod│Tog│ + └───┘ └───┴───┴───┴───┘ └───┴───┴───┴───┘ └───┴───┴───┴───┘ └───┴───┴───┘ + ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ ┌───┬───┬───┐ + │ │ │ │ │ │ │ │ │ │ │ │Spd│Spi│ │ │C_E│ │ │ + ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ ├───┼───┼───┤ + │ │1Hd│1Hi│1Sd│1Si│1Vd│1Vi│ │ │ │ │ │ │ │ │ │ │Wve│ + ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┤ └───┴───┴───┘ + │ │2Hd│2Hi│2Sd│2Si│2Vd│2Vi│ │ │ │ │ │ │ + ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────────┤ ┌───┐ + │ │ │Pre│Ref│Flp│ │ │ │ │ │ │ │ │Vai│ + ├────┬───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ ┌───┼───┼───┐ + │ │ │ │ │ │ Fn │ │ │ │Hud│Vad│Hui│ + └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ └───┴───┴───┘ +*/ + /* Row: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 */ + [_FN] = LAYOUT_tkl_ansi( + QK_BOOT, KC_MSEL, KC_VOLD, KC_VOLU, KC_MUTE, KC_MSTP, KC_MPRV, KC_MPLY, KC_MNXT, KC_MAIL, KC_WHOM, KC_CALC, KC_WSCH, RGB_RMOD, RGB_MOD, RGB_TOG, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_SPD, RGB_SPI, _______, RGB_C_E, _______, _______, + _______, G1_HUD, G1_HUI, G1_SAD, G1_SAI, G1_VAD, G1_VAI, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, G2_HUD, G2_HUI, G2_SAD, G2_SAI, G2_VAD, G2_VAI, _______, _______, _______, _______, _______, _______, + _______, G_PRE, REF_G, G_FLIP, _______, _______, _______, _______, _______, _______, _______, _______, RGB_VAI, + _______, _______, _______, _______, _______, _______, _______, _______, RGB_HUD, RGB_VAD, RGB_HUI + ), +}; diff --git a/keyboards/phage_studio/pila87/keymaps/horrortroll/keymap_stuff.h b/keyboards/phage_studio/pila87/keymaps/horrortroll/keymap_stuff.h new file mode 100644 index 0000000000..e850ccfc2e --- /dev/null +++ b/keyboards/phage_studio/pila87/keymaps/horrortroll/keymap_stuff.h @@ -0,0 +1,236 @@ +/* Copyright 2022 HorrorTroll + * + * 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 . + */ + +#include +#include +#include + +// Each layer gets a name for readability, which is then used in the keymap matrix below. +// The underscores don't mean anything - you can have a layer called STUFF or any other name. +// Layer names don't all need to be of the same length, obviously, and you can also skip them +// entirely and just use numbers. + +enum layer_names { + _BASE, + _FN, +}; + +// For CUSTOM_GRADIENT +HSV gradient_0 = {205, 250, 255}; +HSV gradient_100 = {140, 215, 125}; +bool reflected_gradient = false; +uint8_t gp_i = 0; + +typedef struct { + HSV gradient_0; + HSV gradient_1; + bool reflected; +} CUSTOM_PRESETS; + +enum layer_keycodes { + //Custom Gradient control keycode + G1_HUI = SAFE_RANGE, //Custom gradient color 1 hue increase + G1_HUD, //Custom gradient color 1 hue decrease + G1_SAI, //Custom gradient color 1 saturation increase + G1_SAD, //Custom gradient color 1 saturation decrease + G1_VAI, //Custom gradient color 1 value increase + G1_VAD, //Custom gradient color 1 value decrease + G2_HUI, //Custom gradient color 2 hue increase + G2_HUD, //Custom gradient color 2 hue decrease + G2_SAI, //Custom gradient color 2 saturation increase + G2_SAD, //Custom gradient color 2 saturation decrease + G2_VAI, //Custom gradient color 2 value increase + G2_VAD, //Custom gradient color 2 value decrease + G_PRE, //Gradient presets + REF_G, //Toggle between linear and reflected gradient + G_FLIP, //Flip the gradient colors + + //Custom led effect keycode + RGB_C_E, //Cycle user effect +}; + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + uint8_t color_adj_step = 5; + + CUSTOM_PRESETS gradient_presets[] = { + {{41 , 255, 255}, {233, 245, 255}, false }, + {{45 , 245, 155}, {160, 255, 80}, false }, + {{173, 245, 40}, {41 , 255, 205}, true }, + {{32 , 255, 165}, {217, 185, 70}, false }, + {{240, 255, 145}, {115, 255, 245}, true }, + {{118, 255, 255}, {242, 255, 255}, false }, + {{212, 0 , 0}, {223, 235, 165}, true }, + {{205, 250, 255}, {140, 215, 125}, false }, + }; + + uint8_t gp_length = sizeof(gradient_presets)/sizeof(gradient_presets[0]); + + switch (keycode) { + case G1_HUI: + if (record->event.pressed) { + gradient_0.h += color_adj_step; + dprintf("Gradient 0 HSV: %d, %d, %d\n", gradient_0.h, gradient_0.s, gradient_0.v); + } + return false; + case G1_HUD: + if (record->event.pressed) { + gradient_0.h -= color_adj_step; + dprintf("Gradient 0 HSV: %d, %d, %d\n", gradient_0.h, gradient_0.s, gradient_0.v); + } + return false; + case G1_SAI: + if (record->event.pressed) { + gradient_0.s = (gradient_0.s + color_adj_step * 2 <= 255) ? gradient_0.s + color_adj_step * 2 : 255; + dprintf("Gradient 0 HSV: %d, %d, %d\n", gradient_0.h, gradient_0.s, gradient_0.v); + } + return false; + case G1_SAD: + if (record->event.pressed) { + gradient_0.s = (gradient_0.s - color_adj_step * 2 >= 0) ? gradient_0.s - color_adj_step * 2 : 0; + dprintf("Gradient 0 HSV: %d, %d, %d\n", gradient_0.h, gradient_0.s, gradient_0.v); + } + return false; + case G1_VAI: + if (record->event.pressed) { + gradient_0.v = (gradient_0.v + color_adj_step * 2 <= 255) ? gradient_0.v + color_adj_step * 2 : 255; + dprintf("Gradient 0 HSV: %d, %d, %d\n", gradient_0.h, gradient_0.s, gradient_0.v); + } + return false; + case G1_VAD: + if (record->event.pressed) { + gradient_0.v = (gradient_0.v - color_adj_step * 2 >= 0) ? gradient_0.v - color_adj_step * 2 : 0; + dprintf("Gradient 0 HSV: %d, %d, %d\n", gradient_0.h, gradient_0.s, gradient_0.v); + } + return false; + case G2_HUI: + if (record->event.pressed) { + gradient_100.h += color_adj_step; + dprintf("Gradient 100 HSV: %d, %d, %d\n", gradient_100.h, gradient_100.s, gradient_100.v); + } + return false; + case G2_HUD: + if (record->event.pressed) { + gradient_100.h -= color_adj_step; + dprintf("Gradient 100 HSV: %d, %d, %d\n", gradient_100.h, gradient_100.s, gradient_100.v); + } + return false; + case G2_SAI: + if (record->event.pressed) { + gradient_100.s = (gradient_100.s + color_adj_step * 2 <= 255) ? gradient_100.s + color_adj_step * 2 : 255; + dprintf("Gradient 100 HSV: %d, %d, %d\n", gradient_100.h, gradient_100.s, gradient_100.v); + } + return false; + case G2_SAD: + if (record->event.pressed) { + gradient_100.s = (gradient_100.s - color_adj_step * 2 >= 0) ? gradient_100.s - color_adj_step * 2 : 0; + dprintf("Gradient 100 HSV: %d, %d, %d\n", gradient_100.h, gradient_100.s, gradient_100.v); + } + return false; + case G2_VAI: + if (record->event.pressed) { + gradient_100.v = (gradient_100.v + color_adj_step * 2 <= 255) ? gradient_100.v + color_adj_step * 2 : 255; + dprintf("Gradient 100 HSV: %d, %d, %d\n", gradient_100.h, gradient_100.s, gradient_100.v); + } + return false; + case G2_VAD: + if (record->event.pressed) { + gradient_100.v = (gradient_100.v - color_adj_step * 2 >= 0) ? gradient_100.v - color_adj_step * 2 : 0; + dprintf("Gradient 100 HSV: %d, %d, %d\n", gradient_100.h, gradient_100.s, gradient_100.v); + } + return false; + case G_PRE: + if (record->event.pressed) { + gp_i = (gp_i + gp_length ) % gp_length; + + gradient_0 = gradient_presets[gp_i].gradient_0; + gradient_100 = gradient_presets[gp_i].gradient_1; + reflected_gradient = gradient_presets[gp_i].reflected; + + gp_i += 1; + } + return false; + case REF_G: + if (record->event.pressed) { + reflected_gradient = !reflected_gradient; + } + return false; + case G_FLIP: + if (record->event.pressed) { + HSV temp_color = gradient_0; + gradient_0 = gradient_100; + gradient_100 = temp_color; + } + return false; + case RGB_C_E: + if (record->event.pressed) { + switch (rgb_matrix_get_mode()) { + case RGB_MATRIX_CUSTOM_CUSTOM_GRADIENT: + rgb_matrix_mode(RGB_MATRIX_CUSTOM_COOL_DIAGONAL); + return false; + case RGB_MATRIX_CUSTOM_COOL_DIAGONAL: + rgb_matrix_mode(RGB_MATRIX_CUSTOM_FLOWER_BLOOMING); + return false; + case RGB_MATRIX_CUSTOM_FLOWER_BLOOMING: + rgb_matrix_mode(RGB_MATRIX_CUSTOM_KITT); + return false; + case RGB_MATRIX_CUSTOM_KITT: + rgb_matrix_mode(RGB_MATRIX_CUSTOM_RANDOM_BREATH_RAINBOW); + return false; + default: + rgb_matrix_mode(RGB_MATRIX_CUSTOM_CUSTOM_GRADIENT); + return false; + } + } + return false; + case RGB_TOG: + if (record->event.pressed) { + switch (rgb_matrix_get_flags()) { + case LED_FLAG_ALL: { + rgb_matrix_set_flags(LED_FLAG_NONE); + rgb_matrix_set_color_all(0, 0, 0); + } + break; + default: { + rgb_matrix_set_flags(LED_FLAG_ALL); + rgb_matrix_enable_noeeprom(); + } + break; + } + } + return false; + } + return true; +} + +bool rgb_matrix_indicators_user(void) { + HSV hsv = rgb_matrix_config.hsv; + uint8_t time = scale16by8(g_rgb_timer, qadd8(32, 1)); + hsv.h = time; + RGB rgb = hsv_to_rgb(hsv); + + if (host_keyboard_led_state().caps_lock) { + rgb_matrix_set_color(40, rgb.r, rgb.g, rgb.b); + } else if (!(rgb_matrix_get_flags() & LED_FLAG_INDICATOR)) { + rgb_matrix_set_color(40, 0, 0, 0); + } + + if (host_keyboard_led_state().scroll_lock) { + rgb_matrix_set_color(89, rgb.r, rgb.g, rgb.b); + } else if (!(rgb_matrix_get_flags() & LED_FLAG_INDICATOR)) { + rgb_matrix_set_color(89, 0, 0, 0); + } + return false; +} diff --git a/keyboards/phage_studio/pila87/keymaps/horrortroll/led/cool_diagonal.c b/keyboards/phage_studio/pila87/keymaps/horrortroll/led/cool_diagonal.c new file mode 100644 index 0000000000..900130aba5 --- /dev/null +++ b/keyboards/phage_studio/pila87/keymaps/horrortroll/led/cool_diagonal.c @@ -0,0 +1,22 @@ +/* Copyright 2022 HorrorTroll + * + * 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 . + */ + +static HSV COOL_DIAGONAL_math(HSV hsv, uint8_t i, uint8_t time) { + hsv.h = (g_led_config.point[i].x / 4) - g_led_config.point[i].y - time; + return hsv; +} + +bool COOL_DIAGONAL(effect_params_t* params) { return effect_runner_i(params, &COOL_DIAGONAL_math); } diff --git a/keyboards/phage_studio/pila87/keymaps/horrortroll/led/custom_gradient.c b/keyboards/phage_studio/pila87/keymaps/horrortroll/led/custom_gradient.c new file mode 100644 index 0000000000..af6173d250 --- /dev/null +++ b/keyboards/phage_studio/pila87/keymaps/horrortroll/led/custom_gradient.c @@ -0,0 +1,74 @@ +/* Copyright 2022 HorrorTroll + * + * 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 . + */ + +extern HSV gradient_0; +extern HSV gradient_100; +extern bool reflected_gradient; + +static HSV INTERPOLATE_HSV(float step, HSV gradient_0, HSV gradient_100) { + uint8_t cw, ccw; + HSV color; + + cw = (gradient_0.h >= gradient_100.h) ? 255 + gradient_100.h - gradient_0.h : gradient_100.h - gradient_0.h; // Hue range is 0 to 255. + ccw = (gradient_0.h >= gradient_100.h) ? gradient_0.h - gradient_100.h : 255 + gradient_0.h - gradient_100.h; + + if( cw < ccw ) { // going clockwise + color.h = gradient_0.h + (uint8_t)(step * cw); + } else { // Going counter clockwise + color.h = gradient_0.h - (uint8_t)(step * ccw); + } + + color.s = gradient_0.s + step * (gradient_100.s - gradient_0.s); + + // Scale V with global RGB Matrix's V, so users can still control overall brightness with RGB_VAI & RGB_VAD0 + color.v = round((gradient_0.v + step * (gradient_100.v - gradient_0.v)) * ((float)rgb_matrix_config.hsv.v / 255)); + + return color; +} + +static HSV CUSTOM_GRADIENT_math(uint8_t led_x, uint8_t min_x, uint8_t max_x) { + float step = (float)led_x / (max_x - min_x); + float mid_gradient_pos = 0.5; + + if( reflected_gradient ) { + if( step <= mid_gradient_pos ) { + return INTERPOLATE_HSV(step * (1/mid_gradient_pos), gradient_0, gradient_100); + } else { + return INTERPOLATE_HSV((step - mid_gradient_pos) * (1/(1-mid_gradient_pos)), gradient_100, gradient_0); + } + + } else { + return INTERPOLATE_HSV(step, gradient_0, gradient_100); + } +} + +static bool CUSTOM_GRADIENT(effect_params_t* params) { + RGB_MATRIX_USE_LIMITS(led_min, led_max); + + uint8_t min_x = 0; // X coordinate of the left-most LED + uint8_t max_x = 224; // X coordinate of the right-most LED + + for (uint8_t i = led_min; i < led_max; i++) { + RGB_MATRIX_TEST_LED_FLAGS(); + + HSV hsv_orig = CUSTOM_GRADIENT_math(g_led_config.point[i].x, min_x, max_x); + RGB rgb = hsv_to_rgb(hsv_orig); + + rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); + } + + return led_max < RGB_MATRIX_LED_COUNT; +} diff --git a/keyboards/phage_studio/pila87/keymaps/horrortroll/led/flower_blooming/flower_blooming.c b/keyboards/phage_studio/pila87/keymaps/horrortroll/led/flower_blooming/flower_blooming.c new file mode 100644 index 0000000000..add83149cc --- /dev/null +++ b/keyboards/phage_studio/pila87/keymaps/horrortroll/led/flower_blooming/flower_blooming.c @@ -0,0 +1,27 @@ +/* Copyright 2022 HorrorTroll + * + * 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 . + */ + +#include "led/flower_blooming/flower_blooming.h" + +static HSV FLOWER_BLOOMING_math(HSV hsv, uint8_t i, uint8_t time) { + if (g_led_config.point[i].y > k_rgb_matrix_center.y) + hsv.h = g_led_config.point[i].x * 3 - g_led_config.point[i].y * 3 + time; + else + hsv.h = g_led_config.point[i].x * 3 - g_led_config.point[i].y * 3 - time; + return hsv; +} + +bool FLOWER_BLOOMING(effect_params_t* params) { return effect_runner_bloom(params, &FLOWER_BLOOMING_math); } diff --git a/keyboards/phage_studio/pila87/keymaps/horrortroll/led/flower_blooming/flower_blooming.h b/keyboards/phage_studio/pila87/keymaps/horrortroll/led/flower_blooming/flower_blooming.h new file mode 100644 index 0000000000..ccdaa70d97 --- /dev/null +++ b/keyboards/phage_studio/pila87/keymaps/horrortroll/led/flower_blooming/flower_blooming.h @@ -0,0 +1,36 @@ +/* Copyright 2022 HorrorTroll + * + * 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 . + */ + +#pragma once + +typedef HSV (*flower_blooming_f)(HSV hsv, uint8_t i, uint8_t time); + +bool effect_runner_bloom(effect_params_t* params, flower_blooming_f effect_func) { + RGB_MATRIX_USE_LIMITS(led_min, led_max); + + uint8_t time = scale16by8(g_rgb_timer, qadd8(rgb_matrix_config.speed / 10, 1)); + for (uint8_t i = led_min; i < led_max; i++) { + RGB_MATRIX_TEST_LED_FLAGS(); + if (g_led_config.point[i].y > k_rgb_matrix_center.y) { + RGB bgr = rgb_matrix_hsv_to_rgb(effect_func(rgb_matrix_config.hsv, i, time)); + rgb_matrix_set_color(i, bgr.b, bgr.g, bgr.r); + } else { + RGB rgb = rgb_matrix_hsv_to_rgb(effect_func(rgb_matrix_config.hsv, i, time)); + rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); + } + } + return rgb_matrix_check_finished_leds(led_max); +} diff --git a/keyboards/phage_studio/pila87/keymaps/horrortroll/led/kitt.c b/keyboards/phage_studio/pila87/keymaps/horrortroll/led/kitt.c new file mode 100644 index 0000000000..432eb117f2 --- /dev/null +++ b/keyboards/phage_studio/pila87/keymaps/horrortroll/led/kitt.c @@ -0,0 +1,68 @@ +/* Copyright 2022 HorrorTroll + * + * 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 . + */ + +// variable for startup animation +bool BASE_EFFECT_NOT_STARTED_YET = true; +uint8_t base_effect_startup_counter = 255; + +uint8_t led_count = 11; +uint8_t led_first = 29; + +static uint8_t time_to_led(uint8_t time,