aboutsummaryrefslogtreecommitdiff
path: root/keyboards/skyloong/gk61/pro/pro.c
diff options
context:
space:
mode:
Diffstat (limited to 'keyboards/skyloong/gk61/pro/pro.c')
-rw-r--r--keyboards/skyloong/gk61/pro/pro.c149
1 files changed, 28 insertions, 121 deletions
diff --git a/keyboards/skyloong/gk61/pro/pro.c b/keyboards/skyloong/gk61/pro/pro.c
index 2299977e0e..11411ba2b1 100644
--- a/keyboards/skyloong/gk61/pro/pro.c
+++ b/keyboards/skyloong/gk61/pro/pro.c
@@ -1,11 +1,8 @@
// Copyright 2023 linlin012 (@linlin012)
// SPDX-License-Identifier: GPL-2.0-or-later
#include "quantum.h"
-int FN_WIN = 0;
-int FN_MAC = 0;
-int L_WIN = 0;
-int L_MAC = 0;
+#if defined(RGB_MATRIX_ENABLE)
const is31fl3743a_led_t PROGMEM g_is31fl3743a_leds[IS31FL3743A_LED_COUNT] = {
/* Refer to IS31 manual for these locations
* driver
@@ -83,7 +80,32 @@ const is31fl3743a_led_t PROGMEM g_is31fl3743a_leds[IS31FL3743A_LED_COUNT] = {
{0, SW10_CS13, SW10_CS14, SW10_CS15}
};
-#if defined(RGB_MATRIX_ENABLE) /*&& defined(CAPS_LOCK_INDEX)*/
+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;
+ }
+
+ if (host_keyboard_led_state().caps_lock) {
+ RGB_MATRIX_INDICATOR_SET_COLOR(CAPS_LOCK_INDEX, 255, 255, 255);
+ } else {
+ if (!rgb_matrix_get_flags()) {
+ RGB_MATRIX_INDICATOR_SET_COLOR(CAPS_LOCK_INDEX, 0, 0, 0);
+ }
+ }
+
+ return false;
+}
+
+void suspend_power_down_kb(void) {
+ gpio_write_pin_low(IS31FL3743A_SDB_PIN);
+ suspend_power_down_user();
+}
+
+void suspend_wakeup_init_kb(void) {
+ gpio_write_pin_high(IS31FL3743A_SDB_PIN);
+ suspend_wakeup_init_user();
+}
+#endif
bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
if (!process_record_user(keycode, record)) {
@@ -105,124 +127,9 @@ bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
}
return false;
# endif
- case TO(0):
- if (record->event.pressed) {
- L_WIN = 1;
- set_single_persistent_default_layer(0); // Save default layer 0 to eeprom
- } else {
- L_WIN = 0;
- }
- return true; // continue all further processing of this key
-
- case MO(2):
- if (record->event.pressed) {
- FN_WIN = 1;
- } else {
- FN_WIN = 0;
- }
- return true; // continue all further processing of this key
-
- case TO(1):
- if (record->event.pressed) {
- L_MAC = 1;
- set_single_persistent_default_layer(1); //Save default layer 1 to eeprom
- } else {
- L_MAC = 0;
- }
- return true; // continue all further processing of this key
-
- case MO(3):
- if (record->event.pressed) {
- FN_MAC = 1;
- } else {
- FN_MAC = 0;
- }
- return true; // continue all further processing of this key
- default:
- 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;
- }
-
- if (host_keyboard_led_state().caps_lock) {
- RGB_MATRIX_INDICATOR_SET_COLOR(CAPS_LOCK_INDEX, 255, 255, 255);
- } else {
- if (!rgb_matrix_get_flags()) {
- RGB_MATRIX_INDICATOR_SET_COLOR(CAPS_LOCK_INDEX, 0, 0, 0);
- }
- }
-
- switch (get_highest_layer(layer_state)) {
- case 0:{
- if (L_WIN) {
- RGB_MATRIX_INDICATOR_SET_COLOR(WIN_MOD_INDEX, 255, 255, 255);
- if (!rgb_matrix_get_flags()) {
- RGB_MATRIX_INDICATOR_SET_COLOR(MAC_MOD_INDEX, 0, 0, 0);
- }
- }else{
- if (!rgb_matrix_get_flags()) {
- RGB_MATRIX_INDICATOR_SET_COLOR(WIN_MOD_INDEX, 0, 0, 0);
- }
- }
- } break;
-
- case 1:{
- if (L_MAC) {
- RGB_MATRIX_INDICATOR_SET_COLOR(MAC_MOD_INDEX, 255, 255, 255);
- if (!rgb_matrix_get_flags()) {
- RGB_MATRIX_INDICATOR_SET_COLOR(WIN_MOD_INDEX, 0, 0, 0);
- }
- }else{
- if (!rgb_matrix_get_flags()) {
- RGB_MATRIX_INDICATOR_SET_COLOR(MAC_MOD_INDEX, 0, 0, 0);
- }
- }
- } break;
-
-
- case 2:{
- RGB_MATRIX_INDICATOR_SET_COLOR(WIN_MOD_INDEX, 255, 255, 255);
- if (!rgb_matrix_get_flags()) {
- RGB_MATRIX_INDICATOR_SET_COLOR(MAC_MOD_INDEX, 0, 0, 0);
- }
- } break;
-
- case 3:{
- RGB_MATRIX_INDICATOR_SET_COLOR(MAC_MOD_INDEX, 255, 255, 255);
- if (!rgb_matrix_get_flags()) {
- RGB_MATRIX_INDICATOR_SET_COLOR(WIN_MOD_INDEX, 0, 0, 0);
- }
- } break;
-
- default:{
- if (!rgb_matrix_get_flags()) {
- RGB_MATRIX_INDICATOR_SET_COLOR(WIN_MOD_INDEX, 0, 0, 0);
- RGB_MATRIX_INDICATOR_SET_COLOR(MAC_MOD_INDEX, 0, 0, 0);
- }
- }
}
- return false;
-}
-
-#endif
-void suspend_power_down_kb() {
-# ifdef RGB_MATRIX_ENABLE
- gpio_write_pin_low(IS31FL3743A_SDB_PIN);
-# endif
- suspend_power_down_user();
-}
-
-void suspend_wakeup_init_kb() {
-# ifdef RGB_MATRIX_ENABLE
- gpio_write_pin_high(IS31FL3743A_SDB_PIN);
-# endif
- suspend_wakeup_init_user();
+ return true;
}
void board_init(void) {