Skip to content

Commit

Permalink
more metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
ReFil committed Aug 22, 2024
1 parent dcba9d3 commit 1303bc4
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions app/src/behaviors/behavior_stp_indicators.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,28 @@ 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 no_arg_values[] = {
{
.display_name = "Battery Indication",
.type = BEHAVIOR_PARAMETER_VALUE_TYPE_VALUE,
.value = STP_BAT,
},
};

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

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

#endif

static int behavior_stp_indicators_init(const struct device *dev) { return 0; }

static int on_keymap_binding_pressed(struct zmk_behavior_binding *binding,
Expand All @@ -42,6 +64,9 @@ static int on_keymap_binding_released(struct zmk_behavior_binding *binding,
static const struct behavior_driver_api behavior_stp_indicators_driver_api = {
.binding_pressed = on_keymap_binding_pressed,
.binding_released = on_keymap_binding_released,
#if IS_ENABLED(CONFIG_ZMK_BEHAVIOR_METADATA)
.parameter_metadata = &metadata,
#endif
};

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

0 comments on commit 1303bc4

Please sign in to comment.