fix(combos): Properly report combos len with emply block (#2739)

Handle the scenario where there is an empty combos block and return
a zero combos length.
This commit is contained in:
Pete Johanson 2025-01-01 16:14:53 -07:00 committed by GitHub
parent 85aba16eec
commit f0a77b888a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 4 deletions

View File

@ -8,9 +8,9 @@
#include <zephyr/devicetree.h>
#define ZMK_COMBOS_UTIL_ONE(n) 1
#define ZMK_COMBOS_UTIL_ONE(n) +1
#define ZMK_COMBOS_LEN \
COND_CODE_1( \
DT_HAS_COMPAT_STATUS_OKAY(zmk_combos), \
(DT_FOREACH_CHILD_STATUS_OKAY_SEP(DT_INST(0, zmk_combos), ZMK_COMBOS_UTIL_ONE, (+))), (0))
COND_CODE_1(DT_HAS_COMPAT_STATUS_OKAY(zmk_combos), \
(0 DT_FOREACH_CHILD_STATUS_OKAY(DT_INST(0, zmk_combos), ZMK_COMBOS_UTIL_ONE)), \
(0))

View File

@ -18,6 +18,10 @@
};
/ {
combos {
compatible = "zmk,combos";
};
keymap {
compatible = "zmk,keymap";
label ="Default keymap";