diff options
author | Peter Johanson <[email protected]> | 2024-09-30 10:21:28 -0600 |
---|---|---|
committer | Pete Johanson <[email protected]> | 2024-09-30 12:00:21 -0600 |
commit | 7276fd525ff90a82444a9c6e8e29906bb124fa53 (patch) | |
tree | b25ab96135b37ae3302af3e1b68af64842cb65bc /app/src | |
parent | 59c82ef27a6538408117762f0663a12039ce0b55 (diff) | |
download | zmk-7276fd525ff90a82444a9c6e8e29906bb124fa53.tar.gz zmk-7276fd525ff90a82444a9c6e8e29906bb124fa53.zip |
feat: Build asserts for requires studio layout bits.
* When building with ZMK Studio, assert that we have physical layouts,
and those layouts have key information set.
Diffstat (limited to 'app/src')
-rw-r--r-- | app/src/physical_layouts.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/app/src/physical_layouts.c b/app/src/physical_layouts.c index 59077ede27..6e719d29a2 100644 --- a/app/src/physical_layouts.c +++ b/app/src/physical_layouts.c @@ -29,6 +29,11 @@ ZMK_EVENT_IMPL(zmk_physical_layout_selection_changed); #define USE_PHY_LAYOUTS \ (DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT) && !DT_HAS_CHOSEN(zmk_matrix_transform)) +BUILD_ASSERT( + !IS_ENABLED(CONFIG_ZMK_STUDIO) || USE_PHY_LAYOUTS, + "ZMK Studio requires physical layouts with key positions, and no chosen zmk,matrix-transform. " + "See https://zmk.dev/docs/development/hardware-integration/studio-setup"); + #if USE_PHY_LAYOUTS #define ZKPA_INIT(i, n) \ @@ -43,6 +48,9 @@ ZMK_EVENT_IMPL(zmk_physical_layout_selection_changed); } #define ZMK_LAYOUT_INST(n) \ + BUILD_ASSERT(!IS_ENABLED(CONFIG_ZMK_STUDIO) || DT_INST_NODE_HAS_PROP(n, keys), \ + "ZMK Studio requires physical layouts with key positions. See " \ + "https://zmk.dev/docs/development/hardware-integration/studio-setup"); \ static const struct zmk_key_physical_attrs const _CONCAT( \ _zmk_physical_layout_keys_, n)[DT_INST_PROP_LEN_OR(n, keys, 0)] = { \ LISTIFY(DT_INST_PROP_LEN_OR(n, keys, 0), ZKPA_INIT, (, ), n)}; \ |