From 1303bc45baf290e38808a57ae8e55b33222981be Mon Sep 17 00:00:00 2001 From: ReFil <31960031+ReFil@users.noreply.github.com> Date: Thu, 22 Aug 2024 09:30:27 +0100 Subject: [PATCH] more metadata --- app/src/behaviors/behavior_stp_indicators.c | 25 +++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/app/src/behaviors/behavior_stp_indicators.c b/app/src/behaviors/behavior_stp_indicators.c index 0ed6f0d2a01..9d4b7ef035a 100644 --- a/app/src/behaviors/behavior_stp_indicators.c +++ b/app/src/behaviors/behavior_stp_indicators.c @@ -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, @@ -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,