Closed mehalter closed 4 years ago
Along with the example I put in the code.py
, here is a more advanced macro (here its MACRO(0)
that lets you set up a cycle for the current RGB options with this in the code.py
:
keyboard.set_default_color(r=0xFF, g=0, b=0xFF)
keyboard.rgb_mode = keyboard.RGB_TAP
def macro_handler(dev, n, is_down):
if is_down and n == 0:
if keyboard.rgb_mode == keyboard.RGB_TAP:
keyboard.rgb_mode = keyboard.RGB_FILL
elif keyboard.rgb_mode == keyboard.RGB_FILL:
keyboard.rgb_mode = keyboard.RGB_EMPTY
keyboard.backlight.on(*keyboard.default_color)
elif keyboard.rgb_mode == keyboard.RGB_EMPTY:
keyboard.rgb_mode = keyboard.RGB_OFF
keyboard.backlight.on(*keyboard.default_color)
elif keyboard.backlight.dev.any():
keyboard.backlight.off()
else:
keyboard.rgb_mode = keyboard.RGB_TAP
UPDATED: updated macro to match the latest commit and cycle all of the available RGB options
I cleaned up the implementation a little bit and separated out the RGB updating. This allows for the higher latency when the lights on keypress is enabled, but when it is set to false, the latency drops back down to 1/2 nanoseconds. Neither set ups has a noticeable lag tho even when typing at high speeds 120/130wpm which is good.
I was thinking to add some new action codes to control the backlight. With backlight action codes, we could just modify the keymap without the macro handler.
Ah yeah I like that solution a lot better
Just added some keycodes to control RGB backlight. We can use RGB_MOD
to change backlight modes.
Awesome! That is amazing! Thank you so much! I'll play around with this code a bit and look into what I can add. I'm really enjoying this keeb, thanks for all your hard work!
This adds a feature that allows you to change the default light of the keyboard and also turn on light on keypress. I have a few more ideas on patterns that I will look into implementing soon. Let me know what you think of the implementation. I think we should figure out a good place to move this code so that its easy to separate from the action of the keypress. Maybe out to its own function. But this is a good proof of concept