50 lines
1.4 KiB
C
50 lines
1.4 KiB
C
// 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
|
|
|