diff --git a/samples/bluetooth/mesh/ngcdp/ble_mesh.overlay b/samples/bluetooth/mesh/ngcdp/ble_mesh.overlay index b31e4a7af053..ecfb2eea4e33 100644 --- a/samples/bluetooth/mesh/ngcdp/ble_mesh.overlay +++ b/samples/bluetooth/mesh/ngcdp/ble_mesh.overlay @@ -13,6 +13,7 @@ model-health-srv { vname = "health_srv"; cmodel = "bt-mesh-model-health-srv"; + vargs = "&health_pub"; compatible = "bt-mesh-model"; }; model-onoff-cli-0 { diff --git a/samples/bluetooth/mesh/ngcdp/dts/bindings/bt_mesh_model.yaml b/samples/bluetooth/mesh/ngcdp/dts/bindings/bt_mesh_model.yaml index 72c22f26aa5e..1e1e06d35f80 100644 --- a/samples/bluetooth/mesh/ngcdp/dts/bindings/bt_mesh_model.yaml +++ b/samples/bluetooth/mesh/ngcdp/dts/bindings/bt_mesh_model.yaml @@ -15,3 +15,8 @@ properties: type: string description: Model variable name required: true + + vargs: + type: string-array + description: Variable args to model macro + required: false diff --git a/samples/bluetooth/mesh/ngcdp/src/main.c b/samples/bluetooth/mesh/ngcdp/src/main.c index f2e7c913fe09..fcf982bedeed 100644 --- a/samples/bluetooth/mesh/ngcdp/src/main.c +++ b/samples/bluetooth/mesh/ngcdp/src/main.c @@ -83,10 +83,10 @@ BT_MESH_HEALTH_PUB_DEFINE(health_pub, 0); #define EXPAND(x) x -#define bt_mesh_model_cfg_srv_MACRO(name) EXPAND(BT_MESH_MODEL_CFG_SRV) -#define bt_mesh_model_health_srv_MACRO(name) EXPAND(BT_MESH_MODEL_HEALTH_SRV(&name, &health_pub)) -#define bt_mesh_model_onoff_cli_MACRO(name) EXPAND(BT_MESH_MODEL_ONOFF_CLI(&name)) -#define bt_mesh_model_ponoff_srv_MACRO(name) EXPAND(BT_MESH_MODEL_PONOFF_SRV(&name)) +#define bt_mesh_model_cfg_srv_MACRO(model) EXPAND(BT_MESH_MODEL_CFG_SRV) +#define bt_mesh_model_health_srv_MACRO(model) EXPAND(BT_MESH_MODEL_HEALTH_SRV(&DT_STRING_TOKEN(model, vname), DT_STRING_UNQUOTED_BY_IDX(model, vargs, 0))) +#define bt_mesh_model_onoff_cli_MACRO(model) EXPAND(BT_MESH_MODEL_ONOFF_CLI(&DT_STRING_TOKEN(model, vname))) +#define bt_mesh_model_ponoff_srv_MACRO(model) EXPAND(BT_MESH_MODEL_PONOFF_SRV(&DT_STRING_TOKEN(model, vname))) //#define MACRO_FROM_COMPAT(compat) compat##_MACRO @@ -100,7 +100,7 @@ BT_MESH_HEALTH_PUB_DEFINE(health_pub, 0); /** * @param model - dts model */ -#define DT_BT_MESH_MODEL_INIT(model) EXPAND_AND_CONCAT(DT_STRING_TOKEN(model, cmodel), _MACRO)(DT_STRING_TOKEN(model, vname)), +#define DT_BT_MESH_MODEL_INIT(model) EXPAND_AND_CONCAT(DT_STRING_TOKEN(model, cmodel), _MACRO)(model), /** * @param element - dts element