aboutsummaryrefslogtreecommitdiff
path: root/keyboards/gmmk/pro/ansi/keymaps/mike1808/fun.c
diff options
context:
space:
mode:
Diffstat (limited to 'keyboards/gmmk/pro/ansi/keymaps/mike1808/fun.c')
-rw-r--r--keyboards/gmmk/pro/ansi/keymaps/mike1808/fun.c49
1 files changed, 49 insertions, 0 deletions
diff --git a/keyboards/gmmk/pro/ansi/keymaps/mike1808/fun.c b/keyboards/gmmk/pro/ansi/keymaps/mike1808/fun.c
new file mode 100644
index 000000000..f553874eb
--- /dev/null
+++ b/keyboards/gmmk/pro/ansi/keymaps/mike1808/fun.c
@@ -0,0 +1,49 @@
1/* Copyright 2021 Mikael Manukyan <arm.localhost@gmail.com>
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16#include "mike1808.h"
17#include "print.h"
18
19static bool wpm_rgb_enabled = false;
20static uint8_t rgb_mode;
21
22void rgb_matrix_indicators_keymap(void) {
23 if (wpm_rgb_enabled && rgb_matrix_is_enabled()) {
24 uint8_t wpm = get_current_wpm();
25 dprintf("WPM = %d\n", wpm);
26 HSV hsv = rgb_matrix_get_hsv();
27 hsv.h = wpm;
28 RGB rgb = hsv_to_rgb(hsv);
29 rgb_matrix_set_color_all(rgb.r, rgb.g, rgb.b);
30 }
31}
32
33bool process_record_fun(uint16_t keycode, keyrecord_t *record) {
34 if (record->event.pressed && keycode == KC_WPM_RGB) {
35 if (wpm_rgb_enabled) {
36 wpm_rgb_enabled = false;
37 rgb_matrix_mode(rgb_mode);
38 } else {
39 wpm_rgb_enabled = true;
40 rgb_mode = rgb_matrix_get_mode();
41 rgb_matrix_enable();
42 rgb_matrix_mode(RGB_MATRIX_SOLID_COLOR);
43 }
44
45 return false;
46 }
47
48 return true;
49}