Skip to content

Commit

Permalink
Get behavior to build and work in mixed board setups
Browse files Browse the repository at this point in the history
  • Loading branch information
caksoylar committed Sep 3, 2024
1 parent e3ed07a commit 8ed0d99
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 2 additions & 0 deletions src/behaviors/behavior_rgbled_widget.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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;
}
Expand Down

0 comments on commit 8ed0d99

Please sign in to comment.