summaryrefslogtreecommitdiff
path: root/keyboards/idobao/id67/id67.c
diff options
context:
space:
mode:
authorVino Rodrigues <366673+vinorodrigues@users.noreply.github.com>2022-05-12 10:09:10 +1000
committerGitHub <noreply@github.com>2022-05-11 17:09:10 -0700
commit7fd05afb100966032ebd10378f68d0446e23ed71 (patch)
treef0cb4a9f3174b01d897dfc8ef6a15b90dd367c2c /keyboards/idobao/id67/id67.c
parent37417d531d524d674ea7b1dcf8678f6679738e2f (diff)
[Keyboard] Revert "Fix id67 RGB Matrix (#16916)" - on IDOBAO ID67 kb (#16917)
Co-authored-by: Drashna Jaelre <drashna@live.com>
Diffstat (limited to 'keyboards/idobao/id67/id67.c')
-rw-r--r--keyboards/idobao/id67/id67.c43
1 files changed, 39 insertions, 4 deletions
diff --git a/keyboards/idobao/id67/id67.c b/keyboards/idobao/id67/id67.c
index 8d27298625..155cc74087 100644
--- a/keyboards/idobao/id67/id67.c
+++ b/keyboards/idobao/id67/id67.c
@@ -19,7 +19,11 @@
#define __ NO_LED
-// Indices are reveresed on the physical board, top left is bottom right.
+#if defined(RGB_MATRIX_ENABLE)
+
+/* NB!!: Indices are reversed on the physical board, top left is bottom right.
+ * These "LED Index to *" arrays are in that reversed order!
+ * i.e., Space row on top, listed right to left */
led_config_t g_led_config = { {
// Key Matrix to LED Index
{66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52},
@@ -47,15 +51,46 @@ led_config_t g_led_config = { {
1, 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 9, // third row
1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, // fourth row
1, 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 // fifth row
- // underglow leds
+ // underglow LEDs
#ifndef ID67_DISABLE_UNDERGLOW
, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2
#endif
} };
-__attribute__ ((weak))
+#endif // #ifdef RGB_MATRIX_ENABLE
+
+
+/* Use `#define ID67_CAPS_LOCK_KEY_INDEX 36` in `keymaps/yourkeymap/config.h`
+ * if you want to enable Caps-Lock LED mode */
+#if defined(RGB_MATRIX_ENABLE) && defined(ID67_CAPS_LOCK_KEY_INDEX)
+
+#define ID67_CAPS_LOCK_MAX_BRIGHTNESS 0xFF
+#ifdef RGB_MATRIX_MAXIMUM_BRIGHTNESS
+ #undef ID67_CAPS_LOCK_MAX_BRIGHTNESS
+ #define ID67_CAPS_LOCK_MAX_BRIGHTNESS RGB_MATRIX_MAXIMUM_BRIGHTNESS
+#endif
+
+#define ID67_CAPS_LOCK_VAL_STEP 8
+#ifdef RGB_MATRIX_VAL_STEP
+ #undef ID67_CAPS_LOCK_VAL_STEP
+ #define ID67_CAPS_LOCK_VAL_STEP RGB_MATRIX_VAL_STEP
+#endif
+
+/* This function is defined as weak, so if you create your own in keymap then
+ * that will compile, not this */
+__attribute__((weak))
void rgb_matrix_indicators_user(void) {
if (host_keyboard_led_state().caps_lock) {
- rgb_matrix_set_color(23, 0xFF, 0xFF, 0xFF);
+ uint8_t b = rgb_matrix_get_val();
+ if (b < ID67_CAPS_LOCK_VAL_STEP) {
+ b = ID67_CAPS_LOCK_VAL_STEP;
+ } else if (b < (ID67_CAPS_LOCK_MAX_BRIGHTNESS - ID67_CAPS_LOCK_VAL_STEP)) {
+ b += ID67_CAPS_LOCK_VAL_STEP; // one step more than current brightness
+ } else {
+ b = ID67_CAPS_LOCK_MAX_BRIGHTNESS;
+ }
+ rgb_matrix_set_color(ID67_CAPS_LOCK_KEY_INDEX, b, b, b); // white, with the adjusted brightness
}
}
+
+#endif // #ifdef ID67_CAPS_LOCK_KEY_INDEX