summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQMK Bot <hello@qmk.fm>2022-02-09 05:42:39 +0000
committerQMK Bot <hello@qmk.fm>2022-02-09 05:42:39 +0000
commit7650e6879803c121f9f08a8b07617d36b7c22ac7 (patch)
tree8179941cdf7ea3e275913d40c31dd2181825ec6a
parent4b377a80fad8d47c2967f5eb6bdd9341c5fad891 (diff)
parentbf4ce4169617140b31d781aa556c84477efea635 (diff)
Merge remote-tracking branch 'origin/master' into develop
-rwxr-xr-xkeyboards/kbdfans/kbd67/mkiirgb/v3/v3.c56
1 files changed, 42 insertions, 14 deletions
diff --git a/keyboards/kbdfans/kbd67/mkiirgb/v3/v3.c b/keyboards/kbdfans/kbd67/mkiirgb/v3/v3.c
index 85806aff51..306c22615f 100755
--- a/keyboards/kbdfans/kbd67/mkiirgb/v3/v3.c
+++ b/keyboards/kbdfans/kbd67/mkiirgb/v3/v3.c
@@ -93,35 +93,63 @@ const is31_led PROGMEM g_is31_leds[DRIVER_LED_TOTAL] = {
{0, CS39_SW7, CS38_SW7, CS37_SW7}
};
+
+#define __ NO_LED
+#define CAPS_LOCK_LED_INDEX 30
+
led_config_t g_led_config = { {
// Key Matrix to LED Index
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 },
{ 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29 },
- { 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, NO_LED, 42, 43 },
- { 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, NO_LED, 56, 57 },
- { 58, 59, 60, NO_LED, NO_LED, 61, NO_LED, NO_LED, 62, NO_LED, 63, 64, NO_LED, 65, 66 }
+ { 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, __, 42, 43 },
+ { 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, __, 56, 57 },
+ { 58, 59, 60, __, __, 61, __, __, 62, __, 63, 64, __, 65, 66 }
}, {
// LED Index to Physical Position
- {6,10},{20,10},{34,10},{48,10},{62,10},{76,10},{90,10},{104,10},{118,10},{132,10},{146,10},{160,10},{174,10}, {196,10},{217,10},
- {9,23}, {27,23},{41,23},{55,23},{69,23},{83,23},{97,23},{111,23},{125,23},{139,23},{153,23},{167,23},{181,23}, {199,23},{217,23},
- {11,36},{30,36},{44,36},{58,36},{72,36},{86,36},{101,36},{115,36},{129,36},{143,36},{157,36},{171,36}, {194,36},{217,36},
- {15,49}, {38,49},{52,49},{66,49},{80,49},{94,49},{108,49},{122,49},{136,49},{150,49},{164,49}, {184,49},{203,49},{217,49},
- {8,62},{25,62},{43,62}, {95,62}, {149,62},{166,62}, {189,62},{203,62},{217,62}
-
+ // based on: https://gist.github.com/vinorodrigues/07fd735683856b2a06c7c52b9b3878cb
+ {0, 0}, {15, 0}, {30, 0}, {45, 0}, {60, 0}, {75, 0}, {90, 0}, {105, 0}, {119, 0}, {134, 0}, {149, 0}, {164, 0}, {179, 0}, {202, 0}, {224, 0},
+ {4, 16}, {22, 16}, {37, 16}, {52, 16}, {67, 16}, {82, 16}, {97, 16}, {112, 16}, {127, 16}, {142, 16}, {157, 16}, {172, 16}, {187, 16}, {205, 16}, {224, 16},
+ {6, 32}, {26, 32}, {41, 32}, {56, 32}, {71, 32}, {86, 32}, {101, 32}, {116, 32}, {131, 32}, {146, 32}, {161, 32}, {175, 32}, {200, 32}, {224, 32},
+ {9, 48}, {34, 48}, {49, 48}, {63, 48}, {78, 48}, {93, 48}, {108, 48}, {123, 48}, {138, 48}, {153, 48}, {168, 48}, {189, 48}, {209, 48}, {224, 48},
+ {2, 64}, {21, 64}, {39, 64}, {95, 64}, {151, 64}, {170, 64}, {194, 64}, {209, 64}, {224, 64}
}, {
// LED Index to Flag
1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1,
1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1,
- 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1,
- 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1,
- 1, 1, 1, 4, 1, 1, 1, 1, 1
+ 9, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, // caps lock is also an indicator so mask is `0x01 | 0x08`
+ 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1,
+ 1, 1, 1, 4, 1, 1, 1, 1, 1
} };
+#endif
+
+#if defined(RGB_MATRIX_ENABLE) && defined(CAPS_LOCK_LED_INDEX)
+
+#ifdef RGB_MATRIX_MAXIMUM_BRIGHTNESS
+ #define CAPS_LOCK_MAX_BRIGHTNESS RGB_MATRIX_MAXIMUM_BRIGHTNESS
+#else
+ #define CAPS_LOCK_MAX_BRIGHTNESS 0xFF
+#endif
+
+#ifdef RGB_MATRIX_VAL_STEP
+ #define CAPS_LOCK_VAL_STEP RGB_MATRIX_VAL_STEP
+#else
+ #define CAPS_LOCK_VAL_STEP 8
+#endif
__attribute__ ((weak))
void rgb_matrix_indicators_user(void) {
- if (host_keyboard_led_state().caps_lock) {
- rgb_matrix_set_color(30, 0xFF, 0xFF, 0xFF);
+ if (host_keyboard_led_state().caps_lock) {
+ uint8_t b = rgb_matrix_get_val();
+ if (b < CAPS_LOCK_VAL_STEP) {
+ b = CAPS_LOCK_VAL_STEP;
+ } else if (b < (CAPS_LOCK_MAX_BRIGHTNESS - CAPS_LOCK_VAL_STEP)) {
+ b += CAPS_LOCK_VAL_STEP; // one step more than current brightness
+ } else {
+ b = CAPS_LOCK_MAX_BRIGHTNESS;
+ }
+ rgb_matrix_set_color(CAPS_LOCK_LED_INDEX, b, b, b); // white, with the adjusted brightness
}
}
+
#endif