summaryrefslogtreecommitdiff
path: root/keyboards/skyloong/qk21/v1/v1.c
diff options
context:
space:
mode:
Diffstat (limited to 'keyboards/skyloong/qk21/v1/v1.c')
-rw-r--r--keyboards/skyloong/qk21/v1/v1.c49
1 files changed, 49 insertions, 0 deletions
diff --git a/keyboards/skyloong/qk21/v1/v1.c b/keyboards/skyloong/qk21/v1/v1.c
new file mode 100644
index 0000000000..9630d3e223
--- /dev/null
+++ b/keyboards/skyloong/qk21/v1/v1.c
@@ -0,0 +1,49 @@
+// Copyright 2021 JZ-Skyloong (@JZ-Skyloong)
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#include "quantum.h"
+
+#if defined(RGB_MATRIX_ENABLE) && defined(NUM_LOCK_INDEX)
+
+bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
+ if (!process_record_user(keycode, record)) {
+ return false;
+ }
+ switch (keycode) {
+# ifdef RGB_MATRIX_ENABLE
+ case RGB_TOG:
+ if (record->event.pressed) {
+ switch (rgb_matrix_get_flags()) {
+ case LED_FLAG_ALL: {
+ rgb_matrix_set_flags(LED_FLAG_NONE);
+ rgb_matrix_set_color_all(0, 0, 0);
+ } break;
+ default: {
+ rgb_matrix_set_flags(LED_FLAG_ALL);
+ } break;
+ }
+ }
+ return false;
+# endif
+ }
+ return true;
+}
+
+bool rgb_matrix_indicators_advanced_kb(uint8_t led_min, uint8_t led_max) {
+ if (!rgb_matrix_indicators_advanced_user(led_min, led_max)) {
+ return false;
+ }
+ // RGB_MATRIX_INDICATOR_SET_COLOR(index, red, green, blue);
+
+ if (host_keyboard_led_state().num_lock) {
+ RGB_MATRIX_INDICATOR_SET_COLOR(NUM_LOCK_INDEX, 255, 255, 255);
+ } else {
+ if (!rgb_matrix_get_flags()) {
+ RGB_MATRIX_INDICATOR_SET_COLOR(NUM_LOCK_INDEX, 0, 0, 0);
+ }
+ }
+ return true;
+}
+
+#endif // NUM_LOCK_INDEX
+