add individual LED configuration over USB ethernet

This commit is contained in:
2025-08-27 15:01:11 -04:00
parent c6ac21a15b
commit 26d89c5492
21 changed files with 3135 additions and 128 deletions
+29 -22
View File
@@ -1,11 +1,11 @@
# HyperX Alloy Elite 2 Automatic Backlight
# HyperX Alloy Elite 2 RGB Controller
This project automatically controls the RGB backlight of a HyperX Alloy Elite 2
keyboard based on ADC readings from an attached light dependent resistor. The
backlight automatically turns on to white when the LDR reading is below
a programmed threshold and otherwise turns all RGB lights completely off.
![Keyboard RGB turning on and off with ambient lighting](lightonoff.gif)
![Web interface for setting individual LED RGB values](ui.png)
## Setup
@@ -49,28 +49,34 @@ hole for the LDR to detect ambient light.
## Software
Flash the [hyperx_kb_rgb.uf2](hyperx_kb_rgb.uf2) file to the Raspberry Pi Pico,
and connect the keyboard to the female USB port and insert the male USB
connector of the device into your host device such as PC.
Flash the elite2_rgb.uf2 file from the latest
[release](https://git.kkozai.com/kenji/alloy_elite2_rgb/releases) to the
Raspberry Pi Pico, and connect the keyboard to the female USB port and insert
the male USB connector of the device into your host device such as PC.
If you wish to change the ADC reading threshold for changing the lighting,
you can do so by changing the values of `LDR_OFF_THRESHOLD` and
`LDR_ON_THRESHOLD` in [hyperx_elite2.h](hyperx_elite2.h).
To load the UI for configuring the RGB lighting, open a browser to the page at
http://alloyelite2.usb, or if that doesn't load, to http://192.168.226.1
(226 is E2 for "Elite 2" in hexademical). From the webpage, you can click on
any individual key that you want to configure and change the color using the
color selector or by manually inputting the RGB color value into the text
boxes. To finalize setting the color for the selected key(s), click on the
"Set Color" button.
You can change the color used in the two different modes inside the `rgb_task`
function of [hyperx_elite2.c](hyperx_elite2.c).
To save the lighting configuration to the Pico 2 so that it loads the next time
it is powered on, click on the "Save" button under the "Flash Memory" section.
If you make unsaved changes and want to reload the configuration from memory,
you can also click the "Load" button to reset to the last saved setting.
If you used a different ADC pin than ADC2, you can change the selected ADC pin
and ADC channel by changing `LDR_PIN` and `LDR_ADC`
[hyperx_elite2.h](hyperx_elite2.h).
If the checkbox next to "Adaptive" is selected when setting the color, the key's
brightness will automatically adjust with the ambient lighting, as determined by
the ADC reading of the LDR. Leaving it unchecked will set the RGB color to be
constant regardless of the ambient light level.
For any of the changes above, you will need to modify the
[CMakeLists.txt](CMakeLists.txt) file and compile the program yourself. You
will need to change `PICO_SDK_PATH` and `PICO_PIO_USB_PATH` to the
directories where you have the
[Raspberry Pi Pico SDK](https://github.com/raspberrypi/pico-sdk) and
[Pico-PIO-USB](https://github.com/sekigon-gonnoc/Pico-PIO-USB) library
downloaded on your machine.
The mute button has special behavior when set to adaptive mode. It will toggle
between the user-configured color and red each time that it is pressed as a
way to indicate whether system sounds are muted or not. The keyboard will
always boot in the "unmuted" setting, so if your system starts off muted,
the LED color on the keyboard and your system may not match.
## Licensing
@@ -86,5 +92,6 @@ The project uses code from the following sources:
- [Pico-PIO-USB](https://github.com/sekigon-gonnoc/Pico-PIO-USB/) for templates
used from the [host_hid_to_device_cdc](https://github.com/sekigon-gonnoc/Pico-PIO-USB/tree/control-keyboard-led/examples/host_hid_to_device_cdc)
example released under the MIT license
- [TinyUSB](https://github.com/hathach/tinyusb) for templates used in
[tusb_config.h](tusb_config.h) distributed under the MIT license
- [TinyUSB](https://github.com/hathach/tinyusb) for templates used from the
[net_lwip_webserver](https://github.com/hathach/tinyusb/tree/master/examples/device/net_lwip_webserver)
example distributed under the MIT license