mirror of
https://github.com/Keychron/qmk_firmware.git
synced 2024-11-25 01:47:10 +06:00
234e099c72
Co-authored-by: Duncan Sutherland <dunk2k_2000@hotmail.com> Co-authored-by: Ryan <fauxpark@gmail.com> Co-authored-by: Drashna Jaelre <drashna@live.com>
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
|
|
|