summaryrefslogtreecommitdiffstats
path: root/keyboards/gmmk/pro/rev1/ansi/keymaps/mike1808/rgb_matrix_ledmaps.c
diff options
context:
space:
mode:
authorGloriousThrall <74627436+GloriousThrall@users.noreply.github.com>2022-05-19 19:47:22 -0500
committerGitHub <noreply@github.com>2022-05-20 01:47:22 +0100
commit83fa6fe916bfd7d337f05d7805f0a51ad86c8b43 (patch)
treefc279aa7123dfcf99ba8753ca01082b1f6eadbec /keyboards/gmmk/pro/rev1/ansi/keymaps/mike1808/rgb_matrix_ledmaps.c
parentb5608cbb6d8a5a24d9c3b928521acbc57726831f (diff)
Move GMMK Pro to allow for multiple revisions (#16423)
* Added GMMK PRO Rev2 WBG7 MCU compatibility. Added GMMK 2 WBG7 MCU compatibility. * GMMK PRO MCU Updates only (removed other kbs) * fix problems * Optimize the code. * Update form develop branch * Update * Updater from qmk/develop * Update * Update config.h * Update config.h * Remove gmmk pro rev2 * move moults31/keymap.c * Update * tidy up Co-authored-by: Joy <chang.li@westberrytech.com> Co-authored-by: zvecr <git@zvecr.com>
Diffstat (limited to 'keyboards/gmmk/pro/rev1/ansi/keymaps/mike1808/rgb_matrix_ledmaps.c')
-rw-r--r--keyboards/gmmk/pro/rev1/ansi/keymaps/mike1808/rgb_matrix_ledmaps.c71
1 files changed, 71 insertions, 0 deletions
diff --git a/keyboards/gmmk/pro/rev1/ansi/keymaps/mike1808/rgb_matrix_ledmaps.c b/keyboards/gmmk/pro/rev1/ansi/keymaps/mike1808/rgb_matrix_ledmaps.c
new file mode 100644
index 0000000000..6f4d333ede
--- /dev/null
+++ b/keyboards/gmmk/pro/rev1/ansi/keymaps/mike1808/rgb_matrix_ledmaps.c
@@ -0,0 +1,71 @@
+/* Copyright 2021 Mikael Manukyan <arm.localhost@gmail.com>
+ *
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+#include "rgb_matrix_ledmaps.h"
+
+__attribute__((weak)) void rgb_matrix_indicators_keymap(void) { return; }
+__attribute__((weak)) void rgb_matrix_indicators_advanced_keymap(uint8_t led_min, uint8_t led_max) {
+ return;
+}
+
+#ifdef RGB_MATRIX_LEDMAPS_ENABLED
+
+static bool enabled = true;
+
+#endif // RGB_MATRIX_LEDMAPS_ENABLED
+
+void rgb_matrix_indicators_user(void) { rgb_matrix_indicators_keymap(); }
+void rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
+#ifdef RGB_MATRIX_LEDMAPS_ENABLED
+ if (rgb_matrix_is_enabled() && enabled) {
+ set_layer_rgb(led_min, led_max, get_highest_layer(layer_state | default_layer_state));
+ }
+
+#endif // RGB_MATRIX_LEDMAPS_ENABLED
+ rgb_matrix_indicators_advanced_keymap(led_min, led_max);
+}
+
+#ifdef RGB_MATRIX_LEDMAPS_ENABLED
+
+void set_layer_rgb(uint8_t led_min, uint8_t led_max, int layer) {
+ const ledmap *l = &(ledmaps[layer]);
+
+ uint8_t val = rgb_matrix_get_val();
+
+ for (int i = 0; i < DRIVER_LED_TOTAL; i++) {
+ HSV hsv = {
+ .h = (*l)[i][0],
+ .s = (*l)[i][1],
+ .v = val,
+ };
+
+ if (hsv.h || hsv.s) {
+ RGB rgb = hsv_to_rgb(hsv);
+ RGB_MATRIX_INDICATOR_SET_COLOR(i, rgb.r, rgb.g, rgb.b);
+ }
+ }
+}
+
+void rgb_matrix_layers_enable() {
+ dprintf("ledmaps are enabled\n");
+ enabled = true;
+}
+
+void rgb_matrix_layers_disable() {
+ dprintf("ledmaps are disabled\n");
+ enabled = false;
+}
+
+#endif // RGB_MATRIX_LEDMAPS_ENABLED