Skip to content

Commit

Permalink
fix: Proper behavior metadata for key repeat/toggle
Browse files Browse the repository at this point in the history
  • Loading branch information
petejohanson committed Jul 5, 2024
1 parent 3694ff8 commit 8c6bda2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 24 deletions.
23 changes: 1 addition & 22 deletions app/src/behaviors/behavior_key_repeat.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,27 +19,6 @@ 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 @@ -89,7 +68,7 @@ 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,
.get_parameter_metadata = zmk_behavior_get_empty_param_metadata,
#endif // IS_ENABLED(CONFIG_ZMK_BEHAVIOR_METADATA)
};

Expand Down
3 changes: 1 addition & 2 deletions app/src/behaviors/behavior_key_toggle.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ static int on_keymap_binding_released(struct zmk_behavior_binding *binding,
static const struct behavior_parameter_value_metadata param_values[] = {
{
.display_name = "Key",
.type = BEHAVIOR_PARAMETER_VALUE_TYPE_STANDARD,
.standard = BEHAVIOR_PARAMETER_STANDARD_DOMAIN_HID_USAGE,
.type = BEHAVIOR_PARAMETER_VALUE_TYPE_HID_USAGE,
},
};

Expand Down

0 comments on commit 8c6bda2

Please sign in to comment.