Skip to content

Commit

Permalink
fix: Add metadata to missed behaviors.
Browse files Browse the repository at this point in the history
  • Loading branch information
petejohanson committed Jun 25, 2024
1 parent 29599e8 commit a1c72b5
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 0 deletions.
3 changes: 3 additions & 0 deletions app/src/behaviors/behavior_caps_word.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ static int on_caps_word_binding_released(struct zmk_behavior_binding *binding,
static const struct behavior_driver_api behavior_caps_word_driver_api = {
.binding_pressed = on_caps_word_binding_pressed,
.binding_released = on_caps_word_binding_released,
#if IS_ENABLED(CONFIG_ZMK_BEHAVIOR_METADATA)
.get_parameter_metadata = zmk_behavior_get_empty_param_metadata,
#endif // IS_ENABLED(CONFIG_ZMK_BEHAVIOR_METADATA)
};

static int caps_word_keycode_state_changed_listener(const zmk_event_t *eh);
Expand Down
24 changes: 24 additions & 0 deletions app/src/behaviors/behavior_key_repeat.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,27 @@ LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL);

#if DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT)

#if IS_ENABLED(CONFIG_ZMK_BEHAVIOR_METADATA)

static const struct behavior_parameter_value_metadata param_values[] = {
{
.display_name = "Key",
.type = BEHAVIOR_PARAMETER_VALUE_TYPE_HID_USAGE,
},
};

static const struct behavior_parameter_metadata_set param_metadata_set[] = {{
.param1_values = param_values,
.param1_values_len = ARRAY_SIZE(param_values),
}};

static const struct behavior_parameter_metadata metadata = {
.sets_len = ARRAY_SIZE(param_metadata_set),
.sets = param_metadata_set,
};

#endif

struct behavior_key_repeat_config {
uint8_t index;
uint8_t usage_pages_count;
Expand Down Expand Up @@ -67,6 +88,9 @@ static int on_key_repeat_binding_released(struct zmk_behavior_binding *binding,
static const struct behavior_driver_api behavior_key_repeat_driver_api = {
.binding_pressed = on_key_repeat_binding_pressed,
.binding_released = on_key_repeat_binding_released,
#if IS_ENABLED(CONFIG_ZMK_BEHAVIOR_METADATA)
.parameter_metadata = &metadata,
#endif // IS_ENABLED(CONFIG_ZMK_BEHAVIOR_METADATA)
};

static int key_repeat_keycode_state_changed_listener(const zmk_event_t *eh);
Expand Down
3 changes: 3 additions & 0 deletions app/src/behaviors/behavior_mod_morph.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ static int on_mod_morph_binding_released(struct zmk_behavior_binding *binding,
static const struct behavior_driver_api behavior_mod_morph_driver_api = {
.binding_pressed = on_mod_morph_binding_pressed,
.binding_released = on_mod_morph_binding_released,
#if IS_ENABLED(CONFIG_ZMK_BEHAVIOR_METADATA)
.get_parameter_metadata = zmk_behavior_get_empty_param_metadata,
#endif // IS_ENABLED(CONFIG_ZMK_BEHAVIOR_METADATA)
};

static int behavior_mod_morph_init(const struct device *dev) { return 0; }
Expand Down
3 changes: 3 additions & 0 deletions app/src/behaviors/behavior_reset.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ static int on_keymap_binding_pressed(struct zmk_behavior_binding *binding,
static const struct behavior_driver_api behavior_reset_driver_api = {
.binding_pressed = on_keymap_binding_pressed,
.locality = BEHAVIOR_LOCALITY_EVENT_SOURCE,
#if IS_ENABLED(CONFIG_ZMK_BEHAVIOR_METADATA)
.get_parameter_metadata = zmk_behavior_get_empty_param_metadata,
#endif // IS_ENABLED(CONFIG_ZMK_BEHAVIOR_METADATA)
};

#define RST_INST(n) \
Expand Down
3 changes: 3 additions & 0 deletions app/src/behaviors/behavior_transparent.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ static int on_keymap_binding_released(struct zmk_behavior_binding *binding,
static const struct behavior_driver_api behavior_transparent_driver_api = {
.binding_pressed = on_keymap_binding_pressed,
.binding_released = on_keymap_binding_released,
#if IS_ENABLED(CONFIG_ZMK_BEHAVIOR_METADATA)
.get_parameter_metadata = zmk_behavior_get_empty_param_metadata,
#endif // IS_ENABLED(CONFIG_ZMK_BEHAVIOR_METADATA)
};

BEHAVIOR_DT_INST_DEFINE(0, behavior_transparent_init, NULL, NULL, NULL, POST_KERNEL,
Expand Down

0 comments on commit a1c72b5

Please sign in to comment.