-
-
Notifications
You must be signed in to change notification settings - Fork 40k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Features/ws2812 matrix driver #5418
Features/ws2812 matrix driver #5418
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Quick scan it looks good. How can I test ? What flags do I need to set to try it out?
I guess this needs documentation since I don't know how to turn it on |
@yanfali in your rules.mk file you set the rgb matrix to use this driver via: |
So I'm trying to test this feature, but I have no idea how to structure g_rgb_leds. Can you provide some examples of what this is supposed to look like for a RGB strip where everything ie basically in a single row? |
OK, I got some info, tested this on an XD84 by replacing rgblight with rgbmatrix. Compiling: tmk_core/common/action_util.c [OK]
diff --git a/keyboards/xd84/keymaps/yanfali/config.h b/keyboards/xd84/keymaps/yanfali/config.h
index f8e5c7396..61e5d67e4 100644
--- a/keyboards/xd84/keymaps/yanfali/config.h
+++ b/keyboards/xd84/keymaps/yanfali/config.h
@@ -1,2 +1,3 @@
#undef RGBLED_NUM
#define RGBLED_NUM 20
+#define DRIVER_LED_TOTAL RGBLED_NUM
diff --git a/keyboards/xd84/keymaps/yanfali/keymap.c b/keyboards/xd84/keymaps/yanfali/keymap.c
index bccc31365..763e1530d 100644
--- a/keyboards/xd84/keymaps/yanfali/keymap.c
+++ b/keyboards/xd84/keymaps/yanfali/keymap.c
@@ -36,3 +36,29 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* └───────────┴───────────┴───────────┴───────────────────────────────────────────────────────────────┴─────────┴─────────┴─────────┴─────────┴─────────┴─────────┘ */
)
};
+
+#ifdef RGB_MATRIX_ENABLE
+ const rgb_led g_rgb_leds[DRIVER_LED_TOTAL] = {
+ // Left Hand Mapped Left to Right
+ { { 0xFF }, { 0, 0 }, 0},
+ { { 0xFF }, { 0, 1 }, 0},
+ { { 0xFF }, { 0, 2 }, 0},
+ { { 0xFF }, { 0, 3 }, 0},
+ { { 0xFF }, { 0, 4 }, 0},
+ { { 0xFF }, { 0, 5 }, 0},
+ { { 0xFF }, { 0, 6 }, 0},
+ { { 0xFF }, { 1, 7 }, 0},
+ { { 0xFF }, { 2, 8 }, 0},
+ { { 0xFF }, { 1, 9 }, 0},
+ { { 0xFF }, { 2, 10 }, 0},
+ { { 0xFF }, { 1, 11 }, 0},
+ { { 0xFF }, { 2, 12 }, 0},
+ { { 0xFF }, { 1, 13 }, 0},
+ { { 0xFF }, { 2, 14 }, 0},
+ { { 0xFF }, { 1, 15 }, 0},
+ { { 0xFF }, { 2, 16 }, 0},
+ { { 0xFF }, { 1, 17 }, 0},
+ { { 0xFF }, { 2, 18 }, 0},
+ { { 0xFF }, { 1, 19 }, 0},
+ };
+#endif
diff --git a/keyboards/xd84/keymaps/yanfali/rules.mk b/keyboards/xd84/keymaps/yanfali/rules.mk
index 17c7c431e..74d33bb73 100644
--- a/keyboards/xd84/keymaps/yanfali/rules.mk
+++ b/keyboards/xd84/keymaps/yanfali/rules.mk
@@ -1,2 +1,4 @@
CONSOLE_ENABLE = yes # Console for debug(+400)
COMMAND_ENABLE = yes # Commands for debug and configuration
+RGB_MATRIX_ENABLE = WS2812
+RGBLIGHT_ENABLE = no Used 2 light strips, one with 7 LEDs and one with 13. Was a very fun light show. This seems like a good addition. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like a fun addition. Let's add this, I'm sure people with crkbd and sol keyboards will get a kick out of this. On normal RGB strips it's a little frenetic but very fun.
What would be required in order to use this for some LEDs in a single series and allow rgblight to control other LEDs in the series? (The general ability to arbitrarily assign LEDs between rgbmatrix and rgblight effects could be quite cool, and you could get quite cool behaviours happening even on a keyboard that only had per-key LEDs, e.g. by assigning outer LEDs to rgblight) |
@Lenbok we would need to setup quite a bit more in logic to understand which block which system was responsible for operating under. Though in the long term, I don't that is a very good idea to implement. Both systems essentially do the same thing: run some animation code against a block of LEDs. So why does there need to be two different systems? The only answer to that is performance as today rgblight is more performant than rgbmatrix. Personally I'd rather migrate the animations that rgblight does into rgbmatrix then just have rgbmatrix as the gold standard for all lighting. Especially since there is a ton of room in that system for doing really efficient and dynamic effects, such as the possibility for 1 animation on the keys while another animation on the under/back/side lighting all in one system. |
354ec47
to
a13defd
Compare
Force push rebase on latest master |
a13defd
to
82bc0ad
Compare
Rebased on master after the rgb matrix overhaul pr |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested this out on a prototype 4x4 midi/macro pad, it looks fantastic! 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I checked this out on a crkbd and approve of this feature!
@r2d2rogers Do you have a commit somewhere that demonstrates how to do this so I can have a play on my crkbd? |
@Lenbok look at my branch at https://github.com/r2d2rogers/qmk_firmware/tree/WSmatrix It has some other PRs in the mix, but that's where I have the matrix setup for crkbd, you might find some bugs in the order for the opposite hand. I'll check in discord when I get to work if you have questions. |
985d9ce
to
91d7303
Compare
Rebased on lasted master to fix merge errors |
Passes Drashna CI. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
=)
* WS2812 driver implementation for RGB Matrix * Added driver configuration docs
Features/ws2812 matrix driver (qmk#5418)
* WS2812 driver implementation for RGB Matrix * Added driver configuration docs
* WS2812 driver implementation for RGB Matrix * Added driver configuration docs
Added rgb matrix led driver for ws2812 addressable LEDs.
Description
Types of Changes
Issues Fixed or Closed by This PR
Checklist