diff --git a/Kconfig b/Kconfig index f8b38d8..e97f9d5 100644 --- a/Kconfig +++ b/Kconfig @@ -45,10 +45,10 @@ config RGBLED_WIDGET_LAYER_DEBOUNCE_MS endif # RGBLED_WIDGET_SHOW_LAYER_CHANGE +endif # RGBLED_WIDGET + DT_COMPAT_ZMK_BEHAVIOR_RGBLED_WIDGET := zmk,behavior-rgbled-widget config ZMK_BEHAVIOR_RGBLED_WIDGET bool default $(dt_compat_enabled,$(DT_COMPAT_ZMK_BEHAVIOR_RGBLED_WIDGET)) - -endif diff --git a/README.md b/README.md index 5731440..d85528d 100644 --- a/README.md +++ b/README.md @@ -84,6 +84,10 @@ This module also defines keymap [behaviors](https://zmk.dev/docs/keymaps/behavio When you invoke the behavior by pressing the corresponding key (or combo), it will trigger the LED color display. This will happen on all keyboard parts for split keyboards, so make sure to flash firmware to all parts after enabling. +> [!NOTE] +> The behaviors can be used even when you use split keyboards with different controllers that don't all support the widget. +> Make sure that you use the `rgbled_adapter` shield (or enable `CONFIG_RGBLED_WIDGET`) only for the keyboard parts that support it. + ## Configuration Blink durations can also be adjusted, see the [Kconfig file](Kconfig) for available config properties. diff --git a/src/behaviors/behavior_rgbled_widget.c b/src/behaviors/behavior_rgbled_widget.c index 6a4af07..9113a45 100644 --- a/src/behaviors/behavior_rgbled_widget.c +++ b/src/behaviors/behavior_rgbled_widget.c @@ -20,6 +20,7 @@ static int behavior_rgb_wdg_init(const struct device *dev) { return 0; } static int on_keymap_binding_pressed(struct zmk_behavior_binding *binding, struct zmk_behavior_binding_event event) { +#if IS_ENABLED(CONFIG_RGBLED_WIDGET) const struct device *dev = zmk_behavior_get_binding(binding->behavior_dev); const struct behavior_rgb_wdg_config *cfg = dev->config; @@ -38,6 +39,7 @@ static int on_keymap_binding_pressed(struct zmk_behavior_binding *binding, indicate_layer(); } #endif +#endif // IS_ENABLED(CONFIG_RGBLED_WIDGET) return ZMK_BEHAVIOR_OPAQUE; }