summaryrefslogtreecommitdiff
path: root/keyboards
diff options
context:
space:
mode:
authorFlorian Didron <0x6664@hey.com>2023-03-15 15:55:50 +0700
committerFlorian Didron <0x6664@hey.com>2023-03-15 15:55:50 +0700
commit0f23d33a864b78b20b460eb9126ee17a26f6f0ac (patch)
tree2a22c9a0f6c116de05920b9350a2e9b77ccaecec /keyboards
parent788d70c1a78a30d75a5a286f04d8451162bb7f6e (diff)
feat: allows to take over the rgb leds and light them individually from raw hid
Diffstat (limited to 'keyboards')
-rw-r--r--keyboards/moonlander/rgb_matrix_kb.inc26
-rw-r--r--keyboards/planck/ez/rgb_matrix_kb.inc26
2 files changed, 52 insertions, 0 deletions
diff --git a/keyboards/moonlander/rgb_matrix_kb.inc b/keyboards/moonlander/rgb_matrix_kb.inc
new file mode 100644
index 0000000000..6438896bc1
--- /dev/null
+++ b/keyboards/moonlander/rgb_matrix_kb.inc
@@ -0,0 +1,26 @@
+#ifdef RGB_MATRIX_ENABLE
+RGB_MATRIX_EFFECT(oryx_webhid_effect)
+# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
+
+static void oryx_webhid_effect_init(void) {
+ // Paint it black
+ for (uint8_t i = 0; i < DRIVER_LED_TOTAL; ++i) {
+ webhid_leds[i] = (RGB){0, 0, 0};
+ }
+}
+
+static bool oryx_webhid_effect_run(effect_params_t* params) {
+ RGB_MATRIX_USE_LIMITS(led_min, led_max);
+ for (uint8_t i = led_min; i < led_max; ++i) {
+ rgb_matrix_set_color(i, webhid_leds[i].r, webhid_leds[i].g, webhid_leds[i].b);
+ }
+ return rgb_matrix_check_finished_leds(led_max);
+}
+
+static bool oryx_webhid_effect(effect_params_t* params) {
+ if (params->init) oryx_webhid_effect_init();
+ return oryx_webhid_effect_run(params);
+}
+
+# endif
+#endif
diff --git a/keyboards/planck/ez/rgb_matrix_kb.inc b/keyboards/planck/ez/rgb_matrix_kb.inc
new file mode 100644
index 0000000000..6438896bc1
--- /dev/null
+++ b/keyboards/planck/ez/rgb_matrix_kb.inc
@@ -0,0 +1,26 @@
+#ifdef RGB_MATRIX_ENABLE
+RGB_MATRIX_EFFECT(oryx_webhid_effect)
+# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
+
+static void oryx_webhid_effect_init(void) {
+ // Paint it black
+ for (uint8_t i = 0; i < DRIVER_LED_TOTAL; ++i) {
+ webhid_leds[i] = (RGB){0, 0, 0};
+ }
+}
+
+static bool oryx_webhid_effect_run(effect_params_t* params) {
+ RGB_MATRIX_USE_LIMITS(led_min, led_max);
+ for (uint8_t i = led_min; i < led_max; ++i) {
+ rgb_matrix_set_color(i, webhid_leds[i].r, webhid_leds[i].g, webhid_leds[i].b);
+ }
+ return rgb_matrix_check_finished_leds(led_max);
+}
+
+static bool oryx_webhid_effect(effect_params_t* params) {
+ if (params->init) oryx_webhid_effect_init();
+ return oryx_webhid_effect_run(params);
+}
+
+# endif
+#endif