This commit is contained in:
MichaelDavidGK
2022-09-11 01:00:26 +01:00
parent a082fcc933
commit ac93f79f63
18 changed files with 537 additions and 11 deletions
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
+9
View File
@@ -614,6 +614,15 @@ ifeq ($(strip $(VIA_ENABLE)), yes)
OPT_DEFS += -DVIA_ENABLE
endif
ifeq ($(strip $(OPENRGB_ENABLE)), yes)
ifeq ($(strip $(VIA_ENABLE)), yes)
$(error OPENRGB_ENABLE and VIA_ENABLE cannot currently be enabled simultaneously)
endif
RAW_ENABLE := yes
SRC += $(QUANTUM_DIR)/openrgb.c
OPT_DEFS += -DOPENRGB_ENABLE
endif
VALID_MAGIC_TYPES := yes
BOOTMAGIC_ENABLE ?= no
ifneq ($(strip $(BOOTMAGIC_ENABLE)), no)
+2 -1
View File
@@ -10,7 +10,8 @@ BUILD_OPTION_NAMES = \
SPLIT_KEYBOARD \
DYNAMIC_KEYMAP_ENABLE \
USB_HID_ENABLE \
VIA_ENABLE
VIA_ENABLE \
OPENRGB_ENABLE
HARDWARE_OPTION_NAMES = \
SLEEP_LED_ENABLE \
@@ -0,0 +1 @@
{"version": 1, "notes": "", "documentation": "\"This file is a QMK Configurator export. You can import this at <https://config.qmk.fm>. It can also be used directly with QMK's source code.\n\nTo setup your QMK environment check out the tutorial: <https://docs.qmk.fm/#/newbs>\n\nYou can convert this file to a keymap.c using this command: `qmk json2c {keymap}`\n\nYou can compile this keymap using this command: `qmk compile {keymap}`\"\n", "keyboard": "dztech/dz60rgb/v2_1", "keymap": "dztech_dz60rgb_v2_1_layout_mine", "layout": "LAYOUT", "layers": [["KC_ESC", "KC_1", "KC_2", "KC_3", "KC_4", "KC_5", "KC_6", "KC_7", "KC_8", "KC_9", "KC_0", "KC_MINS", "KC_EQL", "KC_BSPC", "KC_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", "TT(1)", "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", "RSFT_T(KC_SLSH)", "KC_UP", "KC_DEL", "KC_LCTL", "KC_LGUI", "KC_LALT", "KC_SPC", "KC_RALT", "KC_RCTL", "KC_LEFT", "KC_DOWN", "KC_RGHT"], ["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", "TG(2)", "KC_F13", "KC_F14", "KC_F15", "KC_F16", "KC_F17", "KC_F18", "KC_F19", "KC_F20", "KC_F21", "KC_F22", "KC_F23", "KC_F24", "QK_BOOT", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_CALC", "KC_PSCR", "KC_PAUS", "KC_HOME", "KC_PGUP", "EE_CLR", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "NK_TOGG", "KC_PWR", "KC_SLEP", "KC_END", "KC_PGDN", "KC_VOLU", "KC_INS", "KC_TRNS", "TG(3)", "KC_TRNS", "KC_TRNS", "KC_MUTE", "KC_MPLY", "KC_MPRV", "KC_VOLD", "KC_MNXT"], ["KC_TRNS", "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", "TG(2)", "RGB_TOG", "RGB_MOD", "RGB_RMOD", "RGB_M_P", "RGB_M_B", "RGB_M_R", "RGB_M_SW", "RGB_M_SN", "RGB_M_K", "RGB_M_X", "RGB_M_G", "RGB_M_T", "QK_BOOT", "KC_TRNS", "RGB_HUI", "RGB_HUD", "RGB_SAI", "RGB_SAD", "RGB_VAI", "RGB_VAD", "RGB_SPI", "RGB_SPD", "KC_TRNS", "KC_TRNS", "KC_TRNS", "EE_CLR", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS"], ["KC_NUM", "KC_PSLS", "KC_PAST", "KC_PMNS", "KC_PPLS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_PMNS", "KC_PPLS", "KC_TRNS", "KC_TRNS", "KC_P7", "KC_P8", "KC_P9", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_P7", "KC_P8", "KC_P9", "KC_PSLS", "KC_PAST", "KC_TRNS", "KC_P4", "KC_P5", "KC_P6", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_P4", "KC_P5", "KC_P6", "KC_PENT", "KC_TRNS", "KC_P1", "KC_P2", "KC_P3", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_TRNS", "KC_P1", "KC_P2", "KC_P3", "KC_TRNS", "KC_TRNS", "TG(3)", "KC_P0", "KC_PDOT", "KC_PENT", "KC_P0", "KC_PDOT", "KC_PCMM", "KC_TRNS", "KC_TRNS"]]}
+4 -4
View File
@@ -79,11 +79,11 @@ led_config_t g_led_config = {
{ 53, 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42, NO_LED, 41 },
{ 62, 61, 60, NO_LED, NO_LED, 59, NO_LED, NO_LED, 58, 57, 56, 55, NO_LED, 54 }
}, {
{ 216, 0 }, { 192, 0 }, { 176, 0 }, { 160, 0 }, { 144, 0 }, { 128, 0 }, { 112, 0 }, { 96, 0 }, { 80, 0 }, { 64, 0 }, { 48, 0 }, { 32, 0 }, { 16, 0 }, { 0, 0 },
{ 220, 16 }, { 200, 16 }, { 184, 16 }, { 168, 16 }, { 152, 16 }, { 136, 16 }, { 120, 16 }, { 104, 16 }, { 88, 16 }, { 72, 16 }, { 56, 16 }, { 40, 16 }, { 24, 16 }, { 4, 16 },
{ 224, 0 }, { 192, 0 }, { 176, 0 }, { 160, 0 }, { 144, 0 }, { 128, 0 }, { 112, 0 }, { 96, 0 }, { 80, 0 }, { 64, 0 }, { 48, 0 }, { 32, 0 }, { 16, 0 }, { 0, 0 },
{ 4, 16 }, { 24, 16 }, { 40, 16 }, { 56, 16 }, { 72, 16 }, { 88, 16 }, { 104, 16 }, { 120, 16 }, { 136, 16 }, { 152, 16 }, { 168, 16 }, { 184, 16 }, { 200, 16 }, { 220, 16 },
{ 214, 32 }, { 188, 32 }, { 172, 32 }, { 156, 32 }, { 140, 32 }, { 124, 32 }, { 108, 32 }, { 92, 32 }, { 76, 32 }, { 60, 32 }, { 44, 32 }, { 28, 32 }, { 6, 32 },
{ 224, 48 }, { 208, 48 }, { 186, 48 }, { 164, 48 }, { 148, 48 }, { 132, 48 }, { 116, 48 }, { 100, 48 }, { 84, 48 }, { 68, 48 }, { 52, 48 }, { 36, 48 }, { 9, 48 },
{ 224, 64 }, { 208, 64 }, { 192, 64 }, { 176, 64 }, { 160, 64 }, { 102, 64 }, { 42, 64 }, { 22, 64 }, { 2, 64 }
{ 9, 48 }, { 36, 48 }, { 52, 48 }, { 68, 48 }, { 84, 48 }, { 100, 48 }, { 116, 48 }, { 132, 48 }, { 148, 48 }, { 164, 48 }, { 186, 48 }, { 208, 48 }, { 224, 48 },
{ 2, 64 }, { 22, 64 }, { 42, 64 }, { 102, 64 }, { 160, 64 }, { 176, 64 }, { 192, 64 }, { 208, 64 }, { 224, 64 }
}, {
1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1,
@@ -0,0 +1,53 @@
#include QMK_KEYBOARD_H
enum custom_layer {
_LAYER0,
_LAYER1,
_LAYER2,
_LAYER3,
};
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_LAYER0] = LAYOUT(
KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC,
KC_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,
TT(1), 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, RSFT_T(KC_SLSH), KC_UP, KC_DEL,
KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT
),
[_LAYER1] = LAYOUT(
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,
TG(2), KC_F13, KC_F14, KC_F15, KC_F16, KC_F17, KC_F18, KC_F19, KC_F20, KC_F21, KC_F22, KC_F23, KC_F24, QK_BOOT,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_CALC, KC_PSCR, KC_PAUS, KC_HOME, KC_PGUP, EEP_RST,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, NK_TOGG, KC_PWR, KC_SLEP, KC_END, KC_PGDN, KC_VOLU, KC_INS,
KC_TRNS, TG(3), KC_TRNS, KC_TRNS, KC_MUTE, KC_MPLY, KC_MPRV, KC_VOLD, KC_MNXT
),
[_LAYER2] = LAYOUT(
KC_TRNS, 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,
TG(2), RGB_TOG, RGB_MOD, RGB_RMOD, RGB_M_P, RGB_M_B, RGB_M_R, RGB_M_SW, RGB_M_SN, RGB_M_K, RGB_M_X, RGB_M_G, RGB_M_T, QK_BOOT,
KC_TRNS, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, RGB_SPI, RGB_SPD, KC_TRNS, KC_TRNS, KC_TRNS, EE_CLR,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS
),
[_LAYER3] = LAYOUT(
KC_NUM, KC_PSLS, KC_PAST, KC_PMNS, KC_PPLS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PMNS, KC_PPLS, KC_TRNS,
KC_TRNS, KC_P7, KC_P8, KC_P9, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_P7, KC_P8, KC_P9, KC_PSLS, KC_PAST,
KC_TRNS, KC_P4, KC_P5, KC_P6, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_P4, KC_P5, KC_P6, KC_PENT,
KC_TRNS, KC_P1, KC_P2, KC_P3, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_P1, KC_P2, KC_P3, KC_TRNS, KC_TRNS,
TG(3), KC_P0, KC_PDOT, KC_PENT, KC_P0, KC_PDOT, KC_PCMM, KC_TRNS, KC_TRNS
)
};
void matrix_init_user(void)
{
//user initialization
}
void matrix_scan_user(void)
{
//user matrix
}
bool process_record_user(uint16_t keycode, keyrecord_t *record)
{
return true;
}
@@ -0,0 +1 @@
OPENRGB_ENABLE = yes
+368
View File
@@ -0,0 +1,368 @@
/* Copyright 2020 Kasper
*
* 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/>.
*/
#ifndef RAW_ENABLE
# error "RAW_ENABLE is not enabled"
#endif
#include "version.h"
#include "quantum.h"
#include "openrgb.h"
#include "raw_hid.h"
#include "string.h"
#include <color.h>
#if !defined(OPENRGB_DIRECT_MODE_STARTUP_RED)
# define OPENRGB_DIRECT_MODE_STARTUP_RED 0
#endif
#if !defined(OPENRGB_DIRECT_MODE_STARTUP_GREEN)
# define OPENRGB_DIRECT_MODE_STARTUP_GREEN 0
#endif
#if !defined(OPENRGB_DIRECT_MODE_STARTUP_BLUE)
# define OPENRGB_DIRECT_MODE_STARTUP_BLUE 255
#endif
RGB g_openrgb_direct_mode_colors[DRIVER_LED_TOTAL] = {[0 ... DRIVER_LED_TOTAL - 1] = {OPENRGB_DIRECT_MODE_STARTUP_GREEN, OPENRGB_DIRECT_MODE_STARTUP_RED, OPENRGB_DIRECT_MODE_STARTUP_BLUE}};
static const uint8_t openrgb_rgb_matrix_effects_indexes[] = {
1, 2,
#ifndef DISABLE_RGB_MATRIX_ALPHAS_MODS
3,
#endif
#ifndef DISABLE_RGB_MATRIX_GRADIENT_UP_DOWN
4,
#endif
#ifndef DISABLE_RGB_MATRIX_GRADIENT_LEFT_RIGHT
5,
#endif
#ifndef DISABLE_RGB_MATRIX_BREATHING
6,
#endif
#ifndef DISABLE_RGB_MATRIX_BAND_SAT
7,
#endif
#ifndef DISABLE_RGB_MATRIX_BAND_VAL
8,
#endif
#ifndef DISABLE_RGB_MATRIX_BAND_PINWHEEL_SAT
9,
#endif
#ifndef DISABLE_RGB_MATRIX_BAND_PINWHEEL_VAL
10,
#endif
#ifndef DISABLE_RGB_MATRIX_BAND_SPIRAL_SAT
11,
#endif
#ifndef DISABLE_RGB_MATRIX_BAND_SPIRAL_VAL
12,
#endif
#ifndef DISABLE_RGB_MATRIX_CYCLE_ALL
13,
#endif
#ifndef DISABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT
14,
#endif
#ifndef DISABLE_RGB_MATRIX_CYCLE_UP_DOWN
15,
#endif
#ifndef DISABLE_RGB_MATRIX_CYCLE_OUT_IN
16,
#endif
#ifndef DISABLE_RGB_MATRIX_CYCLE_OUT_IN_DUAL
17,
#endif
#ifndef DISABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON
18,
#endif
#ifndef DISABLE_RGB_MATRIX_CYCLE_PINWHEEL
19,
#endif
#ifndef DISABLE_RGB_MATRIX_CYCLE_SPIRAL
20,
#endif
#ifndef DISABLE_RGB_MATRIX_DUAL_BEACON
21,
#endif
#ifndef DISABLE_RGB_MATRIX_RAINBOW_BEACON
22,
#endif
#ifndef DISABLE_RGB_MATRIX_RAINBOW_PINWHEELS
23,
#endif
#ifndef DISABLE_RGB_MATRIX_RAINDROPS
24,
#endif
#ifndef DISABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS
25,
#endif
#ifndef DISABLE_RGB_MATRIX_HUE_BREATHING
26,
#endif
#ifndef DISABLE_RGB_MATRIX_HUE_PENDULUM
27,
#endif
#ifndef DISABLE_RGB_MATRIX_HUE_WAVE
28,
#endif
#if defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS) && !defined(DISABLE_RGB_MATRIX_TYPING_HEATMAP)
29,
#endif
#if defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS) && !defined(DISABLE_RGB_MATRIX_DIGITAL_RAIN)
30,
#endif
#if defined RGB_MATRIX_KEYREACTIVE_ENABLED && !defined DISABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE
31,
#endif
#if defined RGB_MATRIX_KEYREACTIVE_ENABLED && !defined DISABLE_RGB_MATRIX_SOLID_REACTIVE
32,
#endif
#if defined RGB_MATRIX_KEYREACTIVE_ENABLED && !defined DISABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE
33,
#endif
#if defined RGB_MATRIX_KEYREACTIVE_ENABLED && !defined DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE
34,
#endif
#if defined RGB_MATRIX_KEYREACTIVE_ENABLED && !defined DISABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS
35,
#endif
#if defined RGB_MATRIX_KEYREACTIVE_ENABLED && !defined DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS
36,
#endif
#if defined RGB_MATRIX_KEYREACTIVE_ENABLED && !defined DISABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS
37,
#endif
#if defined RGB_MATRIX_KEYREACTIVE_ENABLED && !defined DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS
38,
#endif
#if defined RGB_MATRIX_KEYREACTIVE_ENABLED && !defined DISABLE_RGB_MATRIX_SPLASH
39,
#endif
#if defined RGB_MATRIX_KEYREACTIVE_ENABLED && !defined DISABLE_RGB_MATRIX_MULTISPLASH
40,
#endif
#if defined RGB_MATRIX_KEYREACTIVE_ENABLED && !defined DISABLE_RGB_MATRIX_SOLID_SPLASH
41,
#endif
#if defined RGB_MATRIX_KEYREACTIVE_ENABLED && !defined DISABLE_RGB_MATRIX_SOLID_MULTISPLASH
42,
#endif
};
static uint8_t raw_hid_buffer[RAW_EPSIZE];
void raw_hid_receive(uint8_t *data, uint8_t length) {
switch (*data) {
case OPENRGB_GET_PROTOCOL_VERSION:
openrgb_get_protocol_version();
break;
case OPENRGB_GET_QMK_VERSION:
openrgb_get_qmk_version();
break;
case OPENRGB_GET_DEVICE_INFO:
openrgb_get_device_info();
break;
case OPENRGB_GET_MODE_INFO:
openrgb_get_mode_info();
break;
case OPENRGB_GET_LED_INFO:
openrgb_get_led_info(data);
break;
case OPENRGB_GET_ENABLED_MODES:
openrgb_get_enabled_modes();
break;
case OPENRGB_SET_MODE:
openrgb_set_mode(data);
break;
case OPENRGB_DIRECT_MODE_SET_SINGLE_LED:
openrgb_direct_mode_set_single_led(data);
break;
case OPENRGB_DIRECT_MODE_SET_LEDS:
openrgb_direct_mode_set_leds(data);
break;
}
if (*data != OPENRGB_DIRECT_MODE_SET_LEDS) {
raw_hid_buffer[RAW_EPSIZE - 1] = OPENRGB_END_OF_MESSAGE;
raw_hid_send(raw_hid_buffer, RAW_EPSIZE);
memset(raw_hid_buffer, 0x00, RAW_EPSIZE);
}
}
void openrgb_get_protocol_version(void) {
raw_hid_buffer[0] = OPENRGB_GET_PROTOCOL_VERSION;
raw_hid_buffer[1] = OPENRGB_PROTOCOL_VERSION;
}
void openrgb_get_qmk_version(void) {
raw_hid_buffer[0] = OPENRGB_GET_QMK_VERSION;
uint8_t current_byte = 1;
for (uint8_t i = 0; (current_byte < (RAW_EPSIZE - 2)) && (QMK_VERSION[i] != 0); i++) {
raw_hid_buffer[current_byte] = QMK_VERSION[i];
current_byte++;
}
}
void openrgb_get_device_info(void) {
raw_hid_buffer[0] = OPENRGB_GET_DEVICE_INFO;
raw_hid_buffer[1] = DRIVER_LED_TOTAL;
raw_hid_buffer[2] = MATRIX_COLS * MATRIX_ROWS;
#define MASSDROP_VID 0x04D8
#if VENDOR_ID == MASSDROP_VID
# define PRODUCT_STRING PRODUCT
# define MANUFACTURER_STRING MANUFACTURER
#else
# define PRODUCT_STRING STR(PRODUCT)
# define MANUFACTURER_STRING STR(MANUFACTURER)
#endif
uint8_t current_byte = 3;
for (uint8_t i = 0; (current_byte < ((RAW_EPSIZE - 2) / 2)) && (PRODUCT_STRING[i] != 0); i++) {
raw_hid_buffer[current_byte] = PRODUCT_STRING[i];
current_byte++;
}
raw_hid_buffer[current_byte] = 0;
current_byte++;
for (uint8_t i = 0; (current_byte + 2 < RAW_EPSIZE) && (MANUFACTURER_STRING[i] != 0); i++) {
raw_hid_buffer[current_byte] = MANUFACTURER_STRING[i];
current_byte++;
}
}
void openrgb_get_mode_info(void) {
const HSV hsv_color = rgb_matrix_get_hsv();
raw_hid_buffer[0] = OPENRGB_GET_MODE_INFO;
raw_hid_buffer[1] = rgb_matrix_get_mode();
raw_hid_buffer[2] = rgb_matrix_get_speed();
raw_hid_buffer[3] = hsv_color.h;
raw_hid_buffer[4] = hsv_color.s;
raw_hid_buffer[5] = hsv_color.v;
}
void openrgb_get_led_info(uint8_t *data) {
const uint8_t first_led = data[1];
const uint8_t number_leds = data[2];
raw_hid_buffer[0] = OPENRGB_GET_LED_INFO;
for (uint8_t i = 0; i < number_leds; i++) {
const uint8_t led_idx = first_led + i;
const uint8_t data_idx = i * 7;
if (led_idx >= DRIVER_LED_TOTAL) {
raw_hid_buffer[data_idx + 3] = OPENRGB_FAILURE;
} else {
raw_hid_buffer[data_idx + 1] = g_led_config.point[led_idx].x;
raw_hid_buffer[data_idx + 2] = g_led_config.point[led_idx].y;
raw_hid_buffer[data_idx + 3] = g_led_config.flags[led_idx];
raw_hid_buffer[data_idx + 4] = g_openrgb_direct_mode_colors[led_idx].r;
raw_hid_buffer[data_idx + 5] = g_openrgb_direct_mode_colors[led_idx].g;
raw_hid_buffer[data_idx + 6] = g_openrgb_direct_mode_colors[led_idx].b;
}
uint8_t row = 0;
uint8_t col = 0;
uint8_t found = 0;
for (row = 0; row < MATRIX_ROWS; row++) {
for (col = 0; col < MATRIX_COLS; col++) {
if (g_led_config.matrix_co[row][col] == led_idx) {
found = 1;
break;
}
}
if (found == 1) {
break;
}
}
if (col >= MATRIX_COLS || row >= MATRIX_ROWS) {
raw_hid_buffer[data_idx + 7] = KC_NO;
}
else {
raw_hid_buffer[data_idx + 7] = pgm_read_byte(&keymaps[0][row][col]);
}
}
}
void openrgb_get_enabled_modes(void) {
raw_hid_buffer[0] = OPENRGB_GET_ENABLED_MODES;
const uint8_t size = sizeof openrgb_rgb_matrix_effects_indexes / sizeof openrgb_rgb_matrix_effects_indexes[0];
for (int i = 0; i < size; i++) {
raw_hid_buffer[i + 1] = openrgb_rgb_matrix_effects_indexes[i];
}
}
void openrgb_set_mode(uint8_t *data) {
const uint8_t h = data[1];
const uint8_t s = data[2];
const uint8_t v = data[3];
const uint8_t mode = data[4];
const uint8_t speed = data[5];
const uint8_t save = data[6];
raw_hid_buffer[0] = OPENRGB_SET_MODE;
if (h > 255 || s > 255 || v > 255 || mode >= RGB_MATRIX_EFFECT_MAX || speed > 255) {
raw_hid_buffer[RAW_EPSIZE - 2] = OPENRGB_FAILURE;
return;
}
if (save == 1) {
rgb_matrix_mode(mode);
rgb_matrix_set_speed(speed);
rgb_matrix_sethsv(h, s, v);
}
else {
rgb_matrix_mode_noeeprom(mode);
rgb_matrix_set_speed_noeeprom(speed);
rgb_matrix_sethsv_noeeprom(h, s, v);
}
raw_hid_buffer[RAW_EPSIZE - 2] = OPENRGB_SUCCESS;
}
void openrgb_direct_mode_set_single_led(uint8_t *data) {
const uint8_t led = data[1];
const uint8_t r = data[2];
const uint8_t g = data[3];
const uint8_t b = data[4];
raw_hid_buffer[0] = OPENRGB_DIRECT_MODE_SET_SINGLE_LED;
if (led >= DRIVER_LED_TOTAL || r > 255 || g > 255 || b > 255) {
raw_hid_buffer[RAW_EPSIZE - 2] = OPENRGB_FAILURE;
return;
}
g_openrgb_direct_mode_colors[led].r = r;
g_openrgb_direct_mode_colors[led].g = g;
g_openrgb_direct_mode_colors[led].b = b;
raw_hid_buffer[RAW_EPSIZE - 2] = OPENRGB_SUCCESS;
}
void openrgb_direct_mode_set_leds(uint8_t *data) {
const uint8_t first_led = data[1];
const uint8_t number_leds = data[2];
for (uint8_t i = 0; i < number_leds; i++) {
const uint8_t color_idx = first_led + i;
const uint8_t data_idx = i * 3;
g_openrgb_direct_mode_colors[color_idx].r = data[data_idx + 3];
g_openrgb_direct_mode_colors[color_idx].g = data[data_idx + 4];
g_openrgb_direct_mode_colors[color_idx].b = data[data_idx + 5];
}
}
+55
View File
@@ -0,0 +1,55 @@
/* Copyright 2020 Kasper
*
* 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
// This is changed only when the command IDs change,
// so OpenRGB can detect compatible firmware.
#define OPENRGB_PROTOCOL_VERSION 0xC
#define RAW_EPSIZE 64
enum openrgb_command_id {
OPENRGB_GET_PROTOCOL_VERSION = 1,
OPENRGB_GET_QMK_VERSION,
OPENRGB_GET_DEVICE_INFO,
OPENRGB_GET_MODE_INFO,
OPENRGB_GET_LED_INFO,
OPENRGB_GET_ENABLED_MODES,
OPENRGB_SET_MODE,
OPENRGB_DIRECT_MODE_SET_SINGLE_LED,
OPENRGB_DIRECT_MODE_SET_LEDS,
};
enum openrgb_responses {
OPENRGB_FAILURE = 25,
OPENRGB_SUCCESS = 50,
OPENRGB_END_OF_MESSAGE = 100,
};
extern RGB g_openrgb_direct_mode_colors[DRIVER_LED_TOTAL];
void openrgb_get_protocol_version(void);
void openrgb_get_qmk_version(void);
void openrgb_get_device_info(void);
void openrgb_get_mode_info(void);
void openrgb_get_led_info(uint8_t *data);
void openrgb_get_enabled_modes(void);
void openrgb_set_mode(uint8_t *data);
void openrgb_direct_mode_set_single_led(uint8_t *data);
void openrgb_direct_mode_set_leds(uint8_t *data);
+4
View File
@@ -214,6 +214,10 @@ extern layer_state_t layer_state;
# include "via.h"
#endif
#ifdef OPENRGB_ENABLE
# include "openrgb.h"
#endif
#ifdef WPM_ENABLE
# include "wpm.h"
#endif
@@ -0,0 +1,29 @@
#ifdef OPENRGB_ENABLE
RGB_MATRIX_EFFECT(OPENRGB_DIRECT)
# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
bool OPENRGB_DIRECT(effect_params_t* params) {
RGB_MATRIX_USE_LIMITS(led_min, led_max);
for (uint8_t i = led_min; i < led_max; i++) {
#ifdef OPENRGB_DIRECT_MODE_USE_UNIVERSAL_BRIGHTNESS
float brightness = (float)rgb_matrix_config.hsv.v / UINT8_MAX;
rgb_matrix_set_color(
i,
brightness * g_openrgb_direct_mode_colors[i].r,
brightness * g_openrgb_direct_mode_colors[i].g,
brightness * g_openrgb_direct_mode_colors[i].b
);
#else
rgb_matrix_set_color(
i,
g_openrgb_direct_mode_colors[i].r,
g_openrgb_direct_mode_colors[i].g,
g_openrgb_direct_mode_colors[i].b
);
#endif
}
return led_max < DRIVER_LED_TOTAL;
}
# endif
#endif
@@ -38,3 +38,4 @@
#include "solid_reactive_nexus.h"
#include "splash_anim.h"
#include "solid_splash_anim.h"
#include "openrgb_direct_anim.h"
+8 -4
View File
@@ -86,12 +86,16 @@ __attribute__((weak)) RGB rgb_matrix_hsv_to_rgb(HSV hsv) {
#endif
#if !defined(RGB_MATRIX_STARTUP_MODE)
# ifdef ENABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT
# define RGB_MATRIX_STARTUP_MODE RGB_MATRIX_CYCLE_LEFT_RIGHT
# ifdef OPENRGB_ENABLE
# define RGB_MATRIX_STARTUP_MODE RGB_MATRIX_OPENRGB_DIRECT
# else
# ifndef DISABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT
# define RGB_MATRIX_STARTUP_MODE RGB_MATRIX_CYCLE_LEFT_RIGHT
# else
// fallback to solid colors if RGB_MATRIX_CYCLE_LEFT_RIGHT is disabled in userspace
# define RGB_MATRIX_STARTUP_MODE RGB_MATRIX_SOLID_COLOR
# endif
# define RGB_MATRIX_STARTUP_MODE RGB_MATRIX_SOLID_COLOR
# endif
# endif
#endif
#if !defined(RGB_MATRIX_STARTUP_HUE)
@@ -21,7 +21,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define KEYBOARD_EPSIZE 8
#define MOUSE_EPSIZE 8
#define EXTRAKEY_EPSIZE 8
#define RAW_EPSIZE 32
#define RAW_EPSIZE 64
#define CONSOLE_EPSIZE 32
#define NKRO_EPSIZE 32
#define MIDI_STREAM_EPSIZE 64
+1 -1
View File
@@ -305,7 +305,7 @@ enum usb_endpoints {
#define KEYBOARD_EPSIZE 8
#define SHARED_EPSIZE 32
#define MOUSE_EPSIZE 8
#define RAW_EPSIZE 32
#define RAW_EPSIZE 64
#define CONSOLE_EPSIZE 32
#define MIDI_STREAM_EPSIZE 64
#define CDC_NOTIFICATION_EPSIZE 8