[Keyboard] Add modded Razer Orbweaver with RP2040 (#19711)

Co-authored-by: jack <0x6a73@protonmail.com>
Co-authored-by: Sergey Vlasov <sigprof@gmail.com>
This commit is contained in:
a_marmot 2023-02-01 09:26:37 -08:00 committed by GitHub
parent 252b041b97
commit ca8b4b8e30
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 319 additions and 0 deletions

View File

@ -0,0 +1,24 @@
// Copyright 2023 a_marmot
//
// 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 &lt;http://www.gnu.org/licenses/&gt;.
//
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#define DRIVER_COUNT 1
#define DRIVER_ADDR_1 0b1110100
#define RGB_MATRIX_LED_COUNT 20
#define I2C1_CLOCK_SPEED 100000
#define RGB_MATRIX_CENTER { 40, 30 }

View File

@ -0,0 +1,59 @@
{
"manufacturer": "a_marmot",
"keyboard_name": "orbweaver",
"maintainer": "a_marmot",
"bootloader": "rp2040",
"diode_direction": "ROW2COL",
"features": {
"bootmagic": true,
"command": false,
"console": false,
"extrakey": true,
"mousekey": true,
"nkro": true
},
"matrix_pins": {
"rows": ["GP4", "GP5", "GP6", "GP7", "GP8", "GP9"],
"cols": ["GP12", "GP13", "GP14", "GP15", "GP16"]
},
"processor": "RP2040",
"url": "https://geekhack.org/index.php?topic=119396.0",
"usb": {
"device_version": "1.0.0",
"pid": "0x0000",
"vid": "0xFEED"
},
"layouts": {
"LAYOUT": {
"layout": [
{ "matrix": [0, 0], "x": 0, "y": 0 },
{ "matrix": [0, 1], "x": 1, "y": 0 },
{ "matrix": [0, 2], "x": 2, "y": 0 },
{ "matrix": [0, 3], "x": 3, "y": 0 },
{ "matrix": [0, 4], "x": 4, "y": 0 },
{ "matrix": [1, 0], "x": 0, "y": 1 },
{ "matrix": [1, 1], "x": 1, "y": 1 },
{ "matrix": [1, 2], "x": 2, "y": 1 },
{ "matrix": [1, 3], "x": 3, "y": 1 },
{ "matrix": [1, 4], "x": 4, "y": 1 },
{ "matrix": [2, 0], "x": 0, "y": 2 },
{ "matrix": [2, 1], "x": 1, "y": 2 },
{ "matrix": [2, 2], "x": 2, "y": 2 },
{ "matrix": [2, 3], "x": 3, "y": 2 },
{ "matrix": [2, 4], "x": 4, "y": 2 },
{ "matrix": [3, 0], "x": 0, "y": 3 },
{ "matrix": [3, 1], "x": 1, "y": 3 },
{ "matrix": [3, 2], "x": 2, "y": 3 },
{ "matrix": [3, 3], "x": 3, "y": 3 },
{ "matrix": [3, 4], "x": 4, "y": 3 },
{ "matrix": [4, 0], "x": 0, "y": 4 },
{ "matrix": [4, 1], "x": 1, "y": 4 },
{ "matrix": [4, 2], "x": 2, "y": 4 },
{ "matrix": [4, 3], "x": 3, "y": 4 },
{ "matrix": [4, 4], "x": 4, "y": 4 },
{ "matrix": [5, 0], "x": 0, "y": 5 },
{ "matrix": [5, 1], "w": 4, "x": 1, "y": 5 }
]
}
}
}

View File

@ -0,0 +1,110 @@
/* Copyright 2023 a_marmot
*
* 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 &lt;http://www.gnu.org/licenses/&gt;.
*/
#include QMK_KEYBOARD_H
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
//generic default keymap with Razor defaults (+ mode toggle)
/*
*
* Esc 1 2 3 4
*
* Tab q w e r
*
* Cap a s d f
*
* Shi z x c v
*
* Alt
*
* Spacebarchange map
*
*/
[0] = LAYOUT(
KC_ESC, KC_1, KC_2, KC_3, KC_4,
KC_TAB, KC_Q, KC_W, KC_E, KC_R,
KC_CAPS, KC_A, KC_S, KC_D, KC_F,
KC_LSFT, KC_Z, KC_X, KC_C, KC_V,
KC_LALT, KC_UP, KC_DOWN, KC_RIGHT, KC_LEFT,
KC_SPACE, TO(1)
),
//Second example keymap with all modifier keys replaced with numbers or letters
/*
*
* 0 1 2 3 4
*
* i q w e r
*
* j a s d f
*
* k z x c v
*
* l
*
* Spacebarchange map
*
*/
[1] = LAYOUT(
KC_0, KC_1, KC_2, KC_3, KC_4,
KC_I, KC_Q, KC_W, KC_E, KC_R,
KC_J, KC_A, KC_S, KC_D, KC_F,
KC_K, KC_Z, KC_X, KC_C, KC_V,
KC_L, KC_UP, KC_DOWN, KC_RIGHT, KC_LEFT,
KC_SPACE, TO(0)
)
//, add more keymaps here
};
static const uint8_t colormap[][20][3] = {
// colors for the default key map in hex RGB values
{
{0x00, 0x00, 0xFF},{0xE7, 0xFF, 0x00},{0xE7, 0xFF, 0x00},{0xE7, 0xFF, 0x00},{0xE7, 0xFF, 0x00},
{0xFF, 0x70, 0x00},{0x00, 0xFF, 0xFF},{0x80, 0x00, 0xFF},{0x00, 0xFF, 0xFF},{0x00, 0xFF, 0xFF},
{0xFF, 0x70, 0x00},{0x80, 0x00, 0xFF},{0x80, 0x00, 0xFF},{0x80, 0x00, 0xFF},{0x00, 0xFF, 0xFF},
{0xFF, 0x70, 0x00},{0x00, 0xFF, 0xFF},{0x00, 0xFF, 0xFF},{0x00, 0xFF, 0xFF},{0x00, 0xFF, 0xFF}
},
// colors for the 2nd key map
{
{0xE7, 0xFF, 0x00},{0xE7, 0xFF, 0x00},{0xE7, 0xFF, 0x00},{0xE7, 0xFF, 0x00},{0xE7, 0xFF, 0x00},
{0x00, 0xFF, 0xFF},{0x00, 0xFF, 0xFF},{0x80, 0x00, 0xFF},{0x00, 0xFF, 0xFF},{0x00, 0xFF, 0xFF},
{0x00, 0xFF, 0xFF},{0x80, 0x00, 0xFF},{0x80, 0x00, 0xFF},{0x80, 0x00, 0xFF},{0x00, 0xFF, 0xFF},
{0x00, 0xFF, 0xFF},{0x00, 0xFF, 0xFF},{0x00, 0xFF, 0xFF},{0x00, 0xFF, 0xFF},{0x00, 0xFF, 0xFF}
}
//, add more keymaps here
};
bool rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
for (uint8_t i = led_min; i < led_max; i++) {
rgb_matrix_set_color(i,
colormap[get_highest_layer(layer_state|default_layer_state)][i][0],
colormap[get_highest_layer(layer_state|default_layer_state)][i][1],
colormap[get_highest_layer(layer_state|default_layer_state)][i][2]);
}
return false;
}

View File

@ -0,0 +1,84 @@
// Copyright 2023 a_marmot
//
// 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 &lt;http://www.gnu.org/licenses/&gt;.
//
// SPDX-License-Identifier: GPL-2.0-or-later
// This IS31FL3731 configuration is for a Razer Orbweaver Chroma.
// It was reverse-engineered by testing all possible Cx_y combinations (144 total),
// and determining which ones addressed individual diodes (60 total). These were then
// placed in order R-G-B, sweeping left to right, and then top to bottom.
#include "rgb_matrix.h"
const is31_led PROGMEM g_is31_leds[RGB_MATRIX_LED_COUNT] = {
/* Refer to IS31 manual for these locations
* driver
* | R location
* | | G location
* | | | B location
* | | | | */
{0, C9_1, C8_1, C7_1}, //top left key.
{0, C9_2, C8_2, C7_2},
{0, C9_3, C8_3, C7_3},
{0, C9_4, C8_4, C7_4},
{0, C9_5, C8_5, C7_5}, //top right key.
{0, C9_6, C8_6, C7_6},
{0, C9_7, C8_7, C6_6},
{0, C9_8, C7_7, C6_7},
{0, C1_8, C2_8, C3_8},
{0, C1_7, C2_7, C3_7},
{0, C1_6, C2_6, C3_6},
{0, C1_5, C2_5, C3_5},
{0, C1_4, C2_4, C3_4},
{0, C1_3, C2_3, C3_3},
{0, C1_2, C2_2, C4_3},
{0, C1_1, C3_2, C4_2}, //lower left key
{0, C9_9, C8_9, C7_9},
{0, C9_10, C8_10, C7_10},
{0, C9_11, C8_11, C7_11},
{0, C9_12, C8_12, C7_12} //lower right key
};
led_config_t g_led_config = {
// Matrix location to LED index
{
{ 0, 2, 3, 4, 5 },
{ 6, 7, 8, 9, 10 },
{ 11, 12, 13, 14, 15 },
{ 16, 17, 18, 19, 19 },
{ NO_LED, NO_LED, NO_LED, NO_LED, NO_LED },
{ NO_LED, NO_LED }
},
// LED index to physical location
{
{0,0}, {20,0}, {40,0}, {60,0}, {80,0},
{0,20}, {20,20}, {40,20}, {60,20}, {80,20},
{0,40}, {20,40}, {40,40}, {60,40}, {80,40},
{0,60}, {20,60}, {40,60}, {60,60}, {80,60}
},
// LED index to flags
{
4, 4, 4, 4, 4,
4, 4, 4, 4, 4,
4, 4, 4, 4, 4,
4, 4, 4, 4, 4
}
};

View File

@ -0,0 +1,39 @@
# orbweaver
This firmware is for a Razer Orbweaver Chroma keypad, modded to replace the stock MCU
with an Elite Pi RP2040 microcontroller. Mod instructions can be found on [geekhack](https://geekhack.org/index.php?topic=119396.0).
The firmware controls a 6x5 key matrix (4x5 keypad + 6 additional keys
on the thumb pad and up to 4 additional keys added by user). It also controls a
IS31FL3731 RGB Matrix controller (on the Chroma model) via I2C interface. This requires
a single I2C Driver with 20 common anode RGB LEDs. I found that the I2C clock speed must
be slowed down to 100 kHz for the IS31 chip to keep up (the default for RP2040 seems to
be 400 kHz unless specified otherwise).
The default key map (layer 0) is a generic layer based on the original Razer defaults.
You can change or add layers as needed, and change static colors in keymap.c
Many thanks to bomtarnes, Drashna, Dasky, sigprof, and casuanoob for helpful discussions
and coding suggestions and snippets.
* Keyboard Maintainer: [a_marmot](https://github.com/a-marmot)
* Hardware Supported: RP2040 + IS31FL3731
* Hardware Availability: [https://geekhack.org/index.php?topic=119396.0](https://geekhack.org/index.php?topic=119396.0)
Make example for this keyboard (after setting up your build environment):
make handwired/orbweaver:default
Flashing example for this keyboard:
make handwired/orbweaver:default:flash
See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs).
## Bootloader
Enter the bootloader in 2 ways:
* Press and hold the upper left hand key on the main keyboard while you plug in the USB.
* Press and release both reset buttons on the top of the RP2040 inside the modded unit.

View File

@ -0,0 +1,3 @@
# Add support for 3731 RGB matrix controller
RGB_MATRIX_ENABLE = yes
RGB_MATRIX_DRIVER = IS31FL3731