From 411638bbba488bc08f4abf296fab99eb21ebfa5b Mon Sep 17 00:00:00 2001 From: Adophoxia Date: Wed, 28 Aug 2024 12:35:45 -0700 Subject: [PATCH] Make huge-a** overhaul --- .github/workflows/build_binaries.yaml | 4 +- keyboards/.keep | 0 .../q0/base/keymaps/adophoxia/base.json | 135 ++++++++ .../q0/base/keymaps/adophoxia/keymap.c | 64 ++++ .../keymaps/adophoxia/ansi_encoder.json | 298 ++++++++++++++++++ .../ansi_encoder/keymaps/adophoxia/config.h | 23 ++ .../ansi_encoder/keymaps/adophoxia/halconf.h | 9 + .../ansi_encoder/keymaps/adophoxia/keymap.c | 71 +++++ .../ansi_encoder/keymaps/adophoxia/rules.mk | 2 + qmk.json | 7 +- users/adophoxia/adophoxia.c | 139 ++++++++ users/adophoxia/adophoxia.mk | 5 + users/adophoxia/common.c | 38 +++ users/adophoxia/config.h | 71 +++++ users/adophoxia/indicators.c | 243 ++++++++++++++ users/adophoxia/indicators.h | 30 ++ 16 files changed, 1135 insertions(+), 4 deletions(-) delete mode 100644 keyboards/.keep create mode 100644 keyboards/keychron/q0/base/keymaps/adophoxia/base.json create mode 100644 keyboards/keychron/q0/base/keymaps/adophoxia/keymap.c create mode 100644 keyboards/keychron/q2/ansi_encoder/keymaps/adophoxia/ansi_encoder.json create mode 100644 keyboards/keychron/q2/ansi_encoder/keymaps/adophoxia/config.h create mode 100644 keyboards/keychron/q2/ansi_encoder/keymaps/adophoxia/halconf.h create mode 100644 keyboards/keychron/q2/ansi_encoder/keymaps/adophoxia/keymap.c create mode 100644 keyboards/keychron/q2/ansi_encoder/keymaps/adophoxia/rules.mk create mode 100644 users/adophoxia/adophoxia.c create mode 100644 users/adophoxia/adophoxia.mk create mode 100644 users/adophoxia/common.c create mode 100644 users/adophoxia/config.h create mode 100644 users/adophoxia/indicators.c create mode 100644 users/adophoxia/indicators.h diff --git a/.github/workflows/build_binaries.yaml b/.github/workflows/build_binaries.yaml index f7908fadb88..532fbf649b9 100755 --- a/.github/workflows/build_binaries.yaml +++ b/.github/workflows/build_binaries.yaml @@ -10,8 +10,8 @@ jobs: name: 'QMK Userspace Build' uses: qmk/.github/.github/workflows/qmk_userspace_build.yml@main with: - qmk_repo: qmk/qmk_firmware - qmk_ref: master + qmk_repo: adophoxia/qmk_firmware + qmk_ref: personal publish: name: 'QMK Userspace Publish' diff --git a/keyboards/.keep b/keyboards/.keep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/keyboards/keychron/q0/base/keymaps/adophoxia/base.json b/keyboards/keychron/q0/base/keymaps/adophoxia/base.json new file mode 100644 index 00000000000..85d8ed25657 --- /dev/null +++ b/keyboards/keychron/q0/base/keymaps/adophoxia/base.json @@ -0,0 +1,135 @@ +{ + "name": "Keychron Q0 Base", + "vendorId": "0x3434", + "productId": "0x0130", + "keycodes": ["qmk_lighting"], + "menus": [ + { + "label": "Lighting", + "content": [ + { + "label": "Backlight", + "content": [ + { + "label": "Brightness", + "type": "range", + "options": [0, 255], + "content": ["id_qmk_rgb_matrix_brightness", 3, 1] + }, + { + "label": "Effect", + "type": "dropdown", + "content": ["id_qmk_rgb_matrix_effect", 3, 2], + "options": [ + ["00. None", 0], + ["01. SOLID_COLOR", 1], + ["02. BREATHING", 2], + ["03. BAND_SPIRAL_VAL", 3], + ["04. CYCLE_ALL", 4], + ["05. CYCLE_LEFT_RIGHT", 5], + ["06. CYCLE_UP_DOWN", 6], + ["07. RAINBOW_MOVING_CHEVRON", 7], + ["08. CYCLE_OUT_IN", 8], + ["09. CYCLE_OUT_IN_DUAL", 9], + ["10. CYCLE_PINWHEEL", 10], + ["11. CYCLE_SPIRAL", 11], + ["12. DUAL_BEACON", 12], + ["13. RAINBOW_BEACON", 13], + ["14. JELLYBEAN_RAINDROPS", 14], + ["15. PIXEL_RAIN", 15], + ["16. TYPING_HEATMAP", 16], + ["17. DIGITAL_RAIN", 17], + ["18. REACTIVE_SIMPLE", 18], + ["19. REACTIVE_MULTIWIDE", 19], + ["20. REACTIVE_MULTINEXUS", 20], + ["21. SPLASH", 21], + ["22. SOLID_SPLASH", 22] + ] + }, + { + "showIf": "{id_qmk_rgb_matrix_effect} > 1", + "label": "Effect Speed", + "type": "range", + "options": [0, 255], + "content": ["id_qmk_rgb_matrix_effect_speed", 3, 3] + }, + { + "showIf": "{id_qmk_rgb_matrix_effect} != 0", + "label": "Color", + "type": "color", + "content": ["id_qmk_rgb_matrix_color", 3, 4] + } + ] + } + ] + } + ], + "customKeycodes": [ + { + "name": "Mission Control", + "title": "Mission Control in macOS", + "shortName": "MCtrl" + }, + { + "name": "Launch Pad", + "title": "Launch Pad in macOS", + "shortName": "LPad" + }, + { + "name": "Left Option", + "title": "Left Option in macOS", + "shortName": "LOpt" + }, + { + "name": "Right Option", + "title": "Right Option in macOS", + "shortName": "ROpt" + }, + { + "name": "Left Cmd", + "title": "Left Command in macOS", + "shortName": "LCmd" + }, + { + "name": "Right Cmd", + "title": "Right Command in macOS", + "shortName": "RCmd" + }, + { + "name": "Siri", + "title": "Siri in macOS", + "shortName": "Siri" + }, + { + "name": "Task View", + "title": "Task View in windows", + "shortName": "Task" + }, + { + "name": "File Explorer", + "title": "File Explorer in windows", + "shortName": "File" + }, + { + "name": "Screen Shot", + "title": "Screenshot in macOS", + "shortName": "SShot" + }, + { + "name": "Cortana", + "title": "Cortana in windows", + "shortName": "Cortana" + } + ], + "matrix": {"rows": 6, "cols": 4}, + "layouts": { + "keymap": [ + ["0,0", "0,1", "0,2", "0,3"], + ["1,0", "1,1", "1,2", "1,3"], + ["2,0", "2,1", "2,2"], + ["3,0", "3,1", "3,2", {"h": 2, "y": -1}, "2,3"], + [{"y": 1}, "4,0", "4,1", "4,2"], + [{"w": 2}, "5,0", "5,2", {"h": 2, "y": -1}, "4,3"] + ] + } +} diff --git a/keyboards/keychron/q0/base/keymaps/adophoxia/keymap.c b/keyboards/keychron/q0/base/keymaps/adophoxia/keymap.c new file mode 100644 index 00000000000..ab7dd46f58d --- /dev/null +++ b/keyboards/keychron/q0/base/keymaps/adophoxia/keymap.c @@ -0,0 +1,64 @@ +/* Copyright 2022 @ Keychron (https://www.keychron.com) + * + * 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 + +/* + * ┌───┬───┬───┬───┐ + * │TG1│Esc│Bsp│Tab│ + * ├───┼───┼───┼───┤ + * │Num│ / │ * │ - │ + * ├───┼───┼───┼───┤ + * │ 7 │ 8 │ 9 │ │ + * ├───┼───┼───┤ + │ + * │ 4 │ 5 │ 6 │ │ + * ├───┼───┼───┼───┤ + * │ 1 │ 2 │ 3 │ │ + * ├───┴───┼───┤Ent│ + * │ 0 │ . │ │ + * └───────┴───┴───┘ +*/ + +enum layers { _BASE, _FN1, _FN2}; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [_BASE] = LAYOUT_numpad_6x4( + TG(_FN1), KC_ESC, KC_BSPC, KC_TAB, + KC_NUM, KC_PSLS, KC_PAST, KC_PMNS, + KC_P7, KC_P8, KC_P9, + KC_P4, KC_P5, KC_P6, KC_PPLS, + KC_P1, KC_P2, KC_P3, + KC_P0, KC_PDOT, KC_PENT + ), + + [_FN1] = LAYOUT_numpad_6x4( + TG(_FN2), KC_LCTL, KC_LGUI, KC_LALT, + KC_F10, KC_F11, KC_F12, _______, + KC_F7, KC_F8, KC_F9, + KC_F4, KC_F5, KC_F6, _______, + KC_F1, KC_F2, KC_F3, + _______, _______, _______ + ), + + [_FN2] = LAYOUT_numpad_6x4( + TO(_BASE), KC_MUTE, KC_VOLD, KC_VOLU, + RGB_MOD, RGB_VAI, RGB_HUI, KC_DEL, + RGB_RMOD, RGB_VAD, RGB_HUD, + RGB_SAI, RGB_SPI, KC_MPRV, _______, + RGB_SAD, RGB_SPD, KC_MPLY, + RGB_TOG, KC_MNXT, _______ + ) +}; \ No newline at end of file diff --git a/keyboards/keychron/q2/ansi_encoder/keymaps/adophoxia/ansi_encoder.json b/keyboards/keychron/q2/ansi_encoder/keymaps/adophoxia/ansi_encoder.json new file mode 100644 index 00000000000..d294c1243b1 --- /dev/null +++ b/keyboards/keychron/q2/ansi_encoder/keymaps/adophoxia/ansi_encoder.json @@ -0,0 +1,298 @@ +{ + "name": "Keychron Q2 ANSI Knob", + "vendorId": "0x3434", + "productId": "0x0111", + "keycodes": ["qmk_lighting"], + "menus": [ + { + "label": "Lighting", + "content": [ + { + "label": "Backlight", + "content": [ + { + "label": "Brightness", + "type": "range", + "options": [0, 255], + "content": ["id_qmk_rgb_matrix_brightness", 3, 1] + }, + { + "label": "Effect", + "type": "dropdown", + "content": ["id_qmk_rgb_matrix_effect", 3, 2], + "options": [ + ["00. None", 0], + ["01. SOLID_COLOR", 1], + ["02. BREATHING", 2], + ["03. BAND_SPIRAL_VAL", 3], + ["04. CYCLE_ALL", 4], + ["05. CYCLE_LEFT_RIGHT", 5], + ["06. CYCLE_UP_DOWN", 6], + ["07. RAINBOW_MOVING_CHEVRON", 7], + ["08. CYCLE_OUT_IN", 8], + ["09. CYCLE_OUT_IN_DUAL", 9], + ["10. CYCLE_PINWHEEL", 10], + ["11. CYCLE_SPIRAL", 11], + ["12. DUAL_BEACON", 12], + ["13. RAINBOW_BEACON", 13], + ["14. JELLYBEAN_RAINDROPS", 14], + ["15. PIXEL_RAIN", 15], + ["16. TYPING_HEATMAP", 16], + ["17. DIGITAL_RAIN", 17], + ["18. REACTIVE_SIMPLE", 18], + ["19. REACTIVE_MULTIWIDE", 19], + ["20. REACTIVE_MULTINEXUS", 20], + ["21. SPLASH", 21], + ["22. SOLID_SPLASH", 22] + ] + }, + { + "showIf": "{id_qmk_rgb_matrix_effect} > 1", + "label": "Effect Speed", + "type": "range", + "options": [0, 255], + "content": ["id_qmk_rgb_matrix_effect_speed", 3, 3] + }, + { + "showIf": "{id_qmk_rgb_matrix_effect} != 0", + "label": "Color", + "type": "color", + "content": ["id_qmk_rgb_matrix_color", 3, 4] + } + ] + } + ] + } + ], + "matrix": {"rows": 5, "cols": 15}, + "customKeycodes": [ + { + "name": "Mission Control", + "title": "Mission Control in macOS", + "shortName": "MCtrl" + }, + { + "name": "Launch Pad", + "title": "Launch Pad in macOS", + "shortName": "LPad" + }, + { + "name": "Left Option", + "title": "Left Option in macOS", + "shortName": "LOpt" + }, + { + "name": "Right Option", + "title": "Right Option in macOS", + "shortName": "ROpt" + }, + { + "name": "Left Cmd", + "title": "Left Command in macOS", + "shortName": "LCmd" + }, + { + "name": "Right Cmd", + "title": "Right Command in macOS", + "shortName": "RCmd" + }, + { + "name": "Siri", + "title": "Siri in macOS", + "shortName": "Siri" + }, + { + "name": "Task View", + "title": "Task View in windows", + "shortName": "Task" + }, + { + "name": "File Explorer", + "title": "File Explorer in windows", + "shortName": "File" + }, + { + "name": "Screen Shot", + "title": "Screenshot in macOS", + "shortName": "SShot" + }, + { + "name": "Cortana", + "title": "Cortana in windows", + "shortName": "Cortana" + } + ], + "layouts": { + "keymap": [ + [ + { + "x": 15.25, + "c": "#aaaaaa" + }, + "0,14\n\n\n\n\n\n\n\n\ne0" + ], + [ + { + "y": -0.75, + "c": "#777777" + }, + "0,0\nESC", + { + "c": "#cccccc" + }, + "0,1", + "0,2", + "0,3", + "0,4", + { + "c": "#aaaaaa" + }, + "0,5", + "0,6", + "0,7", + "0,8", + { + "c": "#cccccc" + }, + "0,9", + "0,10", + "0,11", + "0,12", + { + "c": "#aaaaaa", + "w": 2 + }, + "0,13" + ], + [ + { + "w": 1.5 + }, + "1,0", + { + "c": "#cccccc" + }, + "1,1", + "1,2", + "1,3", + "1,4", + "1,5", + "1,6", + "1,7", + "1,8", + "1,9", + "1,10", + "1,11", + "1,12", + { + "w": 1.5 + }, + "1,13", + { + "x": 0.25, + "c": "#aaaaaa" + }, + "1,14" + ], + [ + { + "w": 1.75 + }, + "2,0", + { + "c": "#cccccc" + }, + "2,1", + "2,2", + "2,3", + "2,4", + "2,5", + "2,6", + "2,7", + "2,8", + "2,9", + "2,10", + "2,11", + { + "c": "#777777", + "w": 2.25 + }, + "2,13", + { + "x": 0.25, + "c": "#aaaaaa" + }, + "2,14" + ], + [ + { + "w": 2.25 + }, + "3,0", + { + "c": "#cccccc" + }, + "3,2", + "3,3", + "3,4", + "3,5", + "3,6", + "3,7", + "3,8", + "3,9", + "3,10", + "3,11", + { + "c": "#aaaaaa", + "w": 1.75 + }, + "3,13" + ], + [ + { + "y": -0.75, + "x": 14.25, + "c": "#777777" + }, + "3,14" + ], + [ + { + "y": -0.25, + "c": "#aaaaaa", + "w": 1.24 + }, + "4,0", + { + "w": 1.25 + }, + "4,1", + { + "w": 1.25 + }, + "4,2", + { + "c": "#cccccc", + "w": 6.25 + }, + "4,6", + { + "c": "#aaaaaa" + }, + "4,10", + "4,11", + "4,12" + ], + [ + { + "y": -0.75, + "x": 13.25, + "c": "#777777" + }, + "4,13", + "2,12", + "4,14" + ] + ] + } +} diff --git a/keyboards/keychron/q2/ansi_encoder/keymaps/adophoxia/config.h b/keyboards/keychron/q2/ansi_encoder/keymaps/adophoxia/config.h new file mode 100644 index 00000000000..f3e16fa71e9 --- /dev/null +++ b/keyboards/keychron/q2/ansi_encoder/keymaps/adophoxia/config.h @@ -0,0 +1,23 @@ +/* Copyright 2024 @Adophoxia + +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 + +/* Use 3 dynamic keymap layers */ +/*#ifdef DYNAMIC_KEYMAP_LAYER_COUNT + #undef DYNAMIC_KEYMAP_LAYER_COUNT +#endif +#define DYNAMIC_KEYMAP_LAYER_COUNT 3*/ \ No newline at end of file diff --git a/keyboards/keychron/q2/ansi_encoder/keymaps/adophoxia/halconf.h b/keyboards/keychron/q2/ansi_encoder/keymaps/adophoxia/halconf.h new file mode 100644 index 00000000000..8120567df21 --- /dev/null +++ b/keyboards/keychron/q2/ansi_encoder/keymaps/adophoxia/halconf.h @@ -0,0 +1,9 @@ +// Copyright 2020 QMK +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#define HAL_USE_I2C TRUE +#define PAL_USE_CALLBACKS TRUE + +#include_next \ No newline at end of file diff --git a/keyboards/keychron/q2/ansi_encoder/keymaps/adophoxia/keymap.c b/keyboards/keychron/q2/ansi_encoder/keymaps/adophoxia/keymap.c new file mode 100644 index 00000000000..2927d48db7d --- /dev/null +++ b/keyboards/keychron/q2/ansi_encoder/keymaps/adophoxia/keymap.c @@ -0,0 +1,71 @@ +/* Copyright 2021 @ Keychron (https://www.keychron.com) + * + * 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 "indicators.h" + +enum custom_keycodes { + KC_WLCK = SAFE_RANGE, + ENC_LFT, + ENC_RGT, + ENC_PRS +}; + +enum layers{ + WIN_BASE, + WIN_FN, + WIN_MM +}; + + +#define KC_TASK LGUI(KC_TAB) +#define KC_FLXP LGUI(KC_E) + +#define TSK_EXP C(S(KC_ESC)) +#define KC_WLCK QK_MAGIC_TOGGLE_GUI +#define LAYER1 MO(WIN_FN) +#define LAYER2 MO(WIN_MM) + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [WIN_BASE] = LAYOUT_ansi_67( + 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, ENC_PRS, + 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_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_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_LCTL, KC_LWIN, KC_LALT, KC_SPC, KC_RALT, LAYER1, LAYER2, KC_LEFT, KC_DOWN, KC_RGHT), + + [WIN_FN] = LAYOUT_ansi_67( + 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_DEL, ENC_PRS, + RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______, KC_HOME, + TSK_EXP, RGB_RMOD,RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, KC_END, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, KC_WLCK, _______, _______, _______, KC_TRNS, KC_TRNS, _______, _______, _______), + + [WIN_MM] = LAYOUT_ansi_67( + KC_TILD, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, ENC_PRS, + RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, RGB_RMOD,RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, KC_TRNS, KC_TRNS, _______, _______, _______) +}; + +#if defined(ENCODER_MAP_ENABLE) +const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = { + [WIN_BASE] = { ENCODER_CCW_CW(ENC_LFT, ENC_RGT) }, + [WIN_FN] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU) }, + [WIN_MM] = { ENCODER_CCW_CW(ENC_LFT, ENC_RGT) }, +}; +#endif \ No newline at end of file diff --git a/keyboards/keychron/q2/ansi_encoder/keymaps/adophoxia/rules.mk b/keyboards/keychron/q2/ansi_encoder/keymaps/adophoxia/rules.mk new file mode 100644 index 00000000000..618b4ff6f98 --- /dev/null +++ b/keyboards/keychron/q2/ansi_encoder/keymaps/adophoxia/rules.mk @@ -0,0 +1,2 @@ +ENCODER_MAP_ENABLE = yes +DIP_SWITCH_ENABLE = no \ No newline at end of file diff --git a/qmk.json b/qmk.json index 3afc389f424..30f20a11efd 100644 --- a/qmk.json +++ b/qmk.json @@ -1,4 +1,7 @@ { - "userspace_version": "1.0", - "build_targets": [] + "userspace_version": "1.1", + "build_targets": [ + ["keychron/q2/ansi_encoder", "adophoxia"], + ["keychron/q0/base", "adophoxia"] + ] } \ No newline at end of file diff --git a/users/adophoxia/adophoxia.c b/users/adophoxia/adophoxia.c new file mode 100644 index 00000000000..0872712aac1 --- /dev/null +++ b/users/adophoxia/adophoxia.c @@ -0,0 +1,139 @@ +/* Copyright 2024 @Adophoxia + +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 + +bool tab_pressed = false; // ADD this near the beginning of keymap.c +bool ctrl_pressed = false; +bool l_shift_pressed = false; +bool r_shift_pressed = false; +bool l_alt_pressed = false; +bool r_alt_pressed = false; + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + //uint8_t mods_state = get_mods() | get_weak_mods(); + switch (keycode) { + /* Modifier callbacks */ + case KC_LCTL: + ctrl_pressed = record->event.pressed; + break; + case KC_LSFT: + l_shift_pressed = record->event.pressed; + break; + case KC_RSFT: + r_shift_pressed = record->event.pressed; + break; + case KC_LALT: + l_alt_pressed = record->event.pressed; + break; + case KC_RALT: + r_alt_pressed = record->event.pressed; + break; + case KC_TAB: + tab_pressed = record->event.pressed; + break; + /* Encoder Actions */ + case ENC_PRS: + if (record->event.pressed) { + switch(get_highest_layer(layer_state)) { + case WIN_BASE: + if (r_alt_pressed) { // If R_Alt is held, Mute + tap_code(KC_MUTE); + } else { // Else, Play/Pause + tap_code(KC_MPLY); + } + break; + case WIN_FN: //Reset EEPROM + soft_reset_keyboard(); + break; + case WIN_MM: //Enter bootloader; Also resets EEPROM if BOOTMAGIC is enabled + reset_keyboard(); + break; + default: + break; + } + } + return false; + case ENC_LFT: + if (record->event.pressed) { + switch(get_highest_layer(layer_state)) { + case WIN_BASE: + if (l_alt_pressed) { // If you are holding L Alt, Page Dn + tap_code(KC_PGDN); + } else if (r_alt_pressed) { // if holding R Alt, Media Prev track + tap_code(KC_MPRV); + } else if (ctrl_pressed) { // If holding L Ctrl, move between words + if (tab_pressed) { + tap_code16(C(KC_LEFT)); + } + } else { + tap_code16_delay(KC_VOLD, 2); // Otherwise, decrease volume + } + break; + case WIN_MM: //RGB Control + if (l_shift_pressed) { // If you are holding L Shift, decrease speed + rgb_matrix_decrease_speed(); + } else if (l_alt_pressed) { // if holding L Alt, cycle back effect + rgb_matrix_step_reverse_noeeprom(); + } else if (ctrl_pressed){ // If holding L Ctrl, decrease hue of effect + rgb_matrix_decrease_hue_noeeprom(); + } else if (ctrl_pressed && l_shift_pressed) { // If holding both, L Ctrl and L Shift, decrease saturation + rgb_matrix_decrease_sat_noeeprom(); + } else { + rgb_matrix_decrease_val_noeeprom(); // Otherwise, decrease brightness of effect + } + break; + default: + break; + } + } + return false; + case ENC_RGT: + if (record->event.pressed) { + switch(get_highest_layer(layer_state)) { + case WIN_BASE: //Default Layer + if (l_alt_pressed) { // If you are holding L Alt, Page Up + tap_code(KC_PGUP); + } else if (r_alt_pressed) { // if holding R Alt, Media Next track + tap_code(KC_MNXT); + } else if (ctrl_pressed) { // If holding L Ctrl, move between words + tap_code16(C(KC_RIGHT)); + } else { + tap_code16_delay(KC_VOLU, 2); // Otherwise, increase volume + } + break; + case WIN_MM: //RGB Control + if (l_shift_pressed) { // If you are holding L Shift, increase speed + rgb_matrix_increase_speed_noeeprom(); + } else if (l_alt_pressed) { // if holding L Alt, cycle forward effect + rgb_matrix_step_noeeprom(); + } else if (ctrl_pressed){ // If holding L Ctrl, increase hue of effect + rgb_matrix_increase_hue_noeeprom(); + } else if (ctrl_pressed && l_shift_pressed) { // If holding both, L Ctrl and L Shift, decrease saturation + rgb_matrix_increase_sat_noeeprom(); + } else { + rgb_matrix_increase_val_noeeprom(); // Otherwise, decrease brightness of effect + } + break; + default: + break; + } + } + return false; + } + return true; +} \ No newline at end of file diff --git a/users/adophoxia/adophoxia.mk b/users/adophoxia/adophoxia.mk new file mode 100644 index 00000000000..73c0dcc730c --- /dev/null +++ b/users/adophoxia/adophoxia.mk @@ -0,0 +1,5 @@ +SRC += common.c \ +indicators.c + +VIA_ENABLE = yes +CONSOLE_ENABLE = yes \ No newline at end of file diff --git a/users/adophoxia/common.c b/users/adophoxia/common.c new file mode 100644 index 00000000000..e65a8293762 --- /dev/null +++ b/users/adophoxia/common.c @@ -0,0 +1,38 @@ +/* Copyright 2024 @Adophoxia + +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 + +void keyboard_post_init_user(void) { + // Customise these values to desired behaviour + debug_enable=true; + debug_matrix=true; + //debug_keyboard=true; + //debug_mouse=true; +} + +bool shutdown_user(bool jump_to_bootloader) { + if (jump_to_bootloader) { + // turn off LEDs for bootloader + rgb_matrix_set_color_all(RGB_OFF); + } + void rgb_matrix_update_pwm_buffers(void); + // force flushing -- otherwise will never happen + rgb_matrix_update_pwm_buffers(); + // false to not process kb level + return false; +} diff --git a/users/adophoxia/config.h b/users/adophoxia/config.h new file mode 100644 index 00000000000..5d6847eb8c4 --- /dev/null +++ b/users/adophoxia/config.h @@ -0,0 +1,71 @@ +/* Copyright 2024 @Adophoxia + +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 + +// RGB Matrix Animation modes. Explicitly enabled +// For full list of effects, see: +// https://docs.qmk.fm/#/feature_rgb_matrix?id=rgb-matrix-effects +// #undef ENABLE_RGB_MATRIX_ALPHAS_MODS +// #undef ENABLE_RGB_MATRIX_GRADIENT_UP_DOWN +// #undef ENABLE_RGB_MATRIX_GRADIENT_LEFT_RIGHT +#define ENABLE_RGB_MATRIX_BREATHING +// #undef ENABLE_RGB_MATRIX_BAND_SAT +// #undef ENABLE_RGB_MATRIX_BAND_VAL +// #undef ENABLE_RGB_MATRIX_BAND_PINWHEEL_SAT +// #undef ENABLE_RGB_MATRIX_BAND_PINWHEEL_VAL +// #undef ENABLE_RGB_MATRIX_BAND_SPIRAL_SAT +#undef ENABLE_RGB_MATRIX_BAND_SPIRAL_VAL +#undef ENABLE_RGB_MATRIX_CYCLE_ALL +#undef ENABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT +#undef ENABLE_RGB_MATRIX_CYCLE_UP_DOWN +#undef ENABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON +#undef ENABLE_RGB_MATRIX_CYCLE_OUT_IN +#undef ENABLE_RGB_MATRIX_CYCLE_OUT_IN_DUAL +#undef ENABLE_RGB_MATRIX_CYCLE_PINWHEEL +#undef ENABLE_RGB_MATRIX_CYCLE_SPIRAL +#undef ENABLE_RGB_MATRIX_DUAL_BEACON +#undef ENABLE_RGB_MATRIX_RAINBOW_BEACON +// #undef ENABLE_RGB_MATRIX_RAINBOW_PINWHEELS +// #undef ENABLE_RGB_MATRIX_RAINDROPS +#undef ENABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS +// #undef ENABLE_RGB_MATRIX_HUE_BREATHING +// #undef ENABLE_RGB_MATRIX_HUE_PENDULUM +#define ENABLE_RGB_MATRIX_HUE_WAVE +#undef ENABLE_RGB_MATRIX_PIXEL_RAIN +// #undef ENABLE_RGB_MATRIX_PIXEL_FLOW +// #undef ENABLE_RGB_MATRIX_PIXEL_FRACTAL +// enabled only if RGB_MATRIX_FRAMEBUFFER_EFFECTS is defined +#undef ENABLE_RGB_MATRIX_TYPING_HEATMAP +#undef ENABLE_RGB_MATRIX_DIGITAL_RAIN +// enabled only of RGB_MATRIX_KEYPRESSES or RGB_MATRIX_KEYRELEASES is defined +#undef ENABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE +#define ENABLE_RGB_MATRIX_SOLID_REACTIVE +// #undef ENABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE +#define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE +// #undef ENABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS +#define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS +// #undef ENABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS +#define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS +#undef ENABLE_RGB_MATRIX_SPLASH +#define ENABLE_RGB_MATRIX_MULTISPLASH +#undef ENABLE_RGB_MATRIX_SOLID_SPLASH +#define ENABLE_RGB_MATRIX_SOLID_MULTISPLASH + +#define RGB_MATRIX_DEFAULT_MODE RGB_MATRIX_BREATHING +#define RGB_MATRIX_DEFAULT_HUE 160 + +#define DEBUG_MATRIX_SCAN_RATE \ No newline at end of file diff --git a/users/adophoxia/indicators.c b/users/adophoxia/indicators.c new file mode 100644 index 00000000000..f38e1fa170e --- /dev/null +++ b/users/adophoxia/indicators.c @@ -0,0 +1,243 @@ +/* Copyright 2024 @Adophoxia + +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 "indicators.h" +#include "lib/lib8tion/lib8tion.h" + +#define ARRAYSIZE(arr) sizeof(arr)/sizeof(arr[0]) + +//Reference LED Indexes +/* +__attribute__ ((weak)) led_config_t g_led_config = { + { + { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 }, + { 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29 }, + { 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 65, 42, 43 }, + { 44, NO_LED, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, NO_LED, 55, 56 }, + { 57, 58, 59, NO_LED, NO_LED, NO_LED, 60, NO_LED, NO_LED, NO_LED, 61, 62, 63, 64, 66 }, + }, + { + // LED Index to Physical Position + {0,0}, {15,0}, {29,0}, {44,0}, {59,0}, {73,0}, {88,0}, {103,0}, {118,0}, {132,0}, {147,0}, {162,0}, {176,0}, {198,0}, {224,0}, + {4,15}, {22,15}, {37,15}, {51,15}, {66,15}, {81,15}, {95,15}, {110,15}, {125,15}, {140,15}, {154,15}, {169,15}, {184,15}, {202,15}, {224,15}, + {6,30}, {26,30}, {40,30}, {55,30}, {70,30}, {84,30}, {99,30}, {114,30}, {129,30}, {143,30}, {158,30}, {173,30}, {196,30}, {224,30}, + {9,45}, {33,45}, {48,45}, {62,45}, {77,45}, {92,45}, {106,45}, {121,45}, {136,45}, {151,45}, {165,45}, {185,45}, {209,49}, + {2,60}, {20,60}, {39,60}, {94,60}, {147,60}, {162,60}, {176,60}, {195,64}, {209,64}, {224,64} + }, + { + // RGB LED Index to Flag + 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, + 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, + 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, + 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, + 1, 1, 1, 4, 1, 1, 1, 1, 1, 1 + } +}; +*/ + +/* + { 0, 1, 2, 3 }, + { 4, 5, 6, 7 }, + { 8, 9, 10, 14 }, + { 11, 12, 13, __ }, + { 15, 16, 17, 20 }, + { 18, __, 19, __ } +*/ + +uint8_t alphabets[] = { + 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, + 31, 32, 33, 34, 35, 36, 37, 38, 39, + 45, 46, 47, 48, 49, 50, 51, +}; + +uint8_t alphas[] = { + 26, 27, 28, + 40, 41, + 52, 53, 54, +}; + +uint8_t multimedia_f_row[] = { + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, +}; + +uint8_t numlock_arrows[] = { + 9, 11, 13, 16 +}; + +uint8_t fn_keys[] = { + 4, 5, 6, + 8, 9, 10, + 11, 12, 13, + 15, 16, 17 +}; + +uint8_t fn2_modifiers_keys[] = { + 1, 2, 3 +}; + +void numlock_arrows_indicators() { + if (!host_keyboard_led_state().num_lock) { + for (uint8_t i = 0; i < ARRAYSIZE(numlock_arrows); i++) { + rgb_matrix_set_color(numlock_arrows[i], RGB_BLUE); + } + rgb_matrix_set_color(NUM_LOCK_LED_INDEX, RGB_WHITE); + } else { + if (!rgb_matrix_get_flags()) { + rgb_matrix_set_color(NUM_LOCK_LED_INDEX, RGB_BLACK); + } + } +} + +void fn_keys_indicators() { + for (uint8_t i = 0; i < ARRAYSIZE(fn_keys); i++) { + rgb_matrix_set_color(fn_keys[i], RGB_PURPLE); + } +} + +void fn2_modifiers() { + for (uint8_t i = 0; i < ARRAYSIZE(fn2_modifiers_keys); i++) { + rgb_matrix_set_color(fn2_modifiers_keys[i], RGB_PINK); + } +} + +bool rgb_matrix_indicators_user(void) { + switch (get_highest_layer(layer_state)) { + case _BASE: + numlock_arrows_indicators(); + rgb_matrix_set_color(0, RGB_RED); + break; + case _FN1: + fn_keys_indicators(); + fn2_modifiers(); + rgb_matrix_set_color(0, RGB_GREEN); + break; + case _FN2: + rgb_matrix_set_color(0, RGB_BLUE); + break; + } + return false; +} + +void f_row_leds() { + for (uint8_t i = 0; i < ARRAYSIZE(multimedia_f_row); i++) { + rgb_matrix_set_color(multimedia_f_row[0], RGB_RED); + rgb_matrix_set_color(multimedia_f_row[1], RGB_RED); + + rgb_matrix_set_color(multimedia_f_row[2], RGB_ORANGE); + rgb_matrix_set_color(multimedia_f_row[3], RGB_ORANGE); + + rgb_matrix_set_color(multimedia_f_row[4], RGB_YELLOW); + rgb_matrix_set_color(multimedia_f_row[5], RGB_YELLOW); + + rgb_matrix_set_color(multimedia_f_row[6], RGB_GREEN); + rgb_matrix_set_color(multimedia_f_row[7], RGB_GREEN); + rgb_matrix_set_color(multimedia_f_row[8], RGB_GREEN); + + rgb_matrix_set_color(multimedia_f_row[9], RGB_BLUE); + rgb_matrix_set_color(multimedia_f_row[10], RGB_BLUE); + rgb_matrix_set_color(multimedia_f_row[11], RGB_BLUE); + } +} + +// Lights up certain areas of the keyboard when L_SFT/R_SFT is held +void shift_indicators(){ + if (get_mods() & MOD_BIT(KC_LSFT)){ + uint8_t i; + for (i = 0; i < ARRAYSIZE(alphabets); i++){ // Lights up KC_A - KC_Z as PINK + rgb_matrix_set_color(alphabets[i], RGB_PINK); + } + for (i = 0; i < ARRAYSIZE(multimedia_f_row); i++){ // Lights up KC_1 - KC_EQL as CYAN + if (get_highest_layer(layer_state) == WIN_FN){ // Switches CYAN to RED if either SFT is press while in _FN3 + rgb_matrix_set_color(multimedia_f_row[i], RGB_RED); + } else { // "break;" for color switch + rgb_matrix_set_color(multimedia_f_row[i], RGB_CYAN); + } + } + for (uint8_t i = 0; i < ARRAYSIZE(alphas); i++){ // Lights up keys like [], ;, ', etc., as GREEN + rgb_matrix_set_color(alphas[i], RGB_GREEN); + } + } +}; + +void caps_lock_alphabets() { + if (host_keyboard_led_state().caps_lock) { // Sets a breathing LED effect on caps locks and KC_A - KC_Z + //RGB const rgb = hsv_to_rgb_glow((HSV){HSV_WHITE}); + for (uint8_t i = 0; i < ARRAYSIZE(alphabets); i++) { + //rgb_matrix_set_color(alphabets[i], rgb.r, rgb.g, rgb.b); + rgb_matrix_set_color(alphabets[i], 255, 255, 255); + } + rgb_matrix_set_color(30, RGB_WHITE); + } +} + +bool mediatrack_navpage_indicators(void) { + if (get_mods() & MOD_BIT(KC_LALT)){ + rgb_matrix_set_color(64, RGB_WHITE); + rgb_matrix_set_color(66, RGB_WHITE); + } else if (get_mods() & MOD_BIT(KC_LSFT)) { + rgb_matrix_set_color(56, RGB_RED); + rgb_matrix_set_color(65, RGB_RED); + } + return false; +} + +static inline RGB hsv_to_rgb_glow(HSV hsv) { + hsv.v = scale8(abs8(sin8(scale16by8(g_rgb_timer, rgb_matrix_config.speed / 8)) - 128) * 2, hsv.v); + return hsv_to_rgb(hsv); +} + +bool rgb_matrix_indicators_user(void) { + switch(get_highest_layer(layer_state|default_layer_state)) { + case _BASE: + numlock_arrows_indicators(); + rgb_matrix_set_color(0, RGB_RED); + break; + case _FN1: + fn_keys_indicators(); + fn2_modifiers(); + rgb_matrix_set_color(0, RGB_GREEN); + break; + case _FN2: + rgb_matrix_set_color(0, RGB_BLUE); + break; + case WIN_MM: + f_row_leds(); + rgb_matrix_set_color(index, RGB_BLUE); + break; + case WIN_FN: + if (keycode <= KC_1 && keycode >= KC_0 && keycode == KC_MINS && keycode == KC_EQL) { + rgb_matrix_set_color(index, RGB_RED); + } + rgb_matrix_set_color(index, RGB_YELLOW); + break; + case WIN_BASE: + if (keymap_config.no_gui){ // Sets a breathing LED effect on Win Key + RGB const rgb = hsv_to_rgb_glow((HSV){HSV_RED}); + rgb_matrix_set_color(58, rgb.r, rgb.g, rgb.b); + } + //if (rgb_matrix_get_flags() == LED_FLAG_NONE) { + caps_lock_alphabets(); + //} + shift_indicators(); + mediatrack_navpage_indicators(); + break; + default: + break; + } + } + return false; +} \ No newline at end of file diff --git a/users/adophoxia/indicators.h b/users/adophoxia/indicators.h new file mode 100644 index 00000000000..9ff8b62f105 --- /dev/null +++ b/users/adophoxia/indicators.h @@ -0,0 +1,30 @@ +/* Copyright 2024 @Adophoxia + +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 +//Q2 +void breathing_win_lock(void); +void shift_indicators(void); +void breathing_caps_lock(void); +void f_row_leds(void); +void caps_lock_alphabets(void); +void knob_leds(void); +bool mediatrack_navpage_indicators(void); + +//Q0 +void numlock_arrows_indicators(void); +void fn_keys_indicators(void); +void fn2_modifiers(void); \ No newline at end of file