diff --git a/drivers/comparator/comparator_nrf_comp.c b/drivers/comparator/comparator_nrf_comp.c index b60aef17987..311a864303b 100644 --- a/drivers/comparator/comparator_nrf_comp.c +++ b/drivers/comparator/comparator_nrf_comp.c @@ -17,16 +17,16 @@ _CONCAT(COMP_NRF_COMP_REFSEL_, DT_INST_STRING_TOKEN(inst, refsel)) #define SHIM_NRF_COMP_DT_INST_REFSEL_IS_AREF(inst) \ - DT_INST_ENUM_HAS_VALUE(inst, refsel, AREF) + DT_INST_ENUM_HAS_VALUE(inst, refsel, aref) #define SHIM_NRF_COMP_DT_INST_EXTREFSEL(inst) \ _CONCAT(COMP_NRF_COMP_EXTREFSEL_, DT_INST_STRING_TOKEN(inst, extrefsel)) #define SHIM_NRF_COMP_DT_INST_MAIN_MODE_IS_SE(inst) \ - DT_INST_ENUM_HAS_VALUE(inst, main_mode, SE) + DT_INST_ENUM_HAS_VALUE(inst, main_mode, se) #define SHIM_NRF_COMP_DT_INST_MAIN_MODE_IS_DIFF(inst) \ - DT_INST_ENUM_HAS_VALUE(inst, main_mode, DIFF) + DT_INST_ENUM_HAS_VALUE(inst, main_mode, diff) #define SHIM_NRF_COMP_DT_INST_TH_DOWN(inst) \ DT_INST_PROP(inst, th_down) diff --git a/drivers/comparator/comparator_nrf_lpcomp.c b/drivers/comparator/comparator_nrf_lpcomp.c index a3de2b8069c..623c7adacd4 100644 --- a/drivers/comparator/comparator_nrf_lpcomp.c +++ b/drivers/comparator/comparator_nrf_lpcomp.c @@ -19,7 +19,7 @@ _CONCAT(COMP_NRF_LPCOMP_REFSEL_, DT_INST_STRING_TOKEN(inst, refsel)) #define SHIM_NRF_LPCOMP_DT_INST_REFSEL_IS_AREF(inst) \ - DT_INST_ENUM_HAS_VALUE(inst, refsel, AREF) + DT_INST_ENUM_HAS_VALUE(inst, refsel, aref) #define SHIM_NRF_LPCOMP_DT_INST_EXTREFSEL(inst) \ _CONCAT(COMP_NRF_LPCOMP_EXTREFSEL_, DT_INST_STRING_TOKEN(inst, extrefsel)) diff --git a/scripts/dts/gen_defines.py b/scripts/dts/gen_defines.py index 65ae177b63c..ee6a88dd1d1 100755 --- a/scripts/dts/gen_defines.py +++ b/scripts/dts/gen_defines.py @@ -679,6 +679,9 @@ def enum_macros(prop: edtlib.Property, macro: str): val = prop.val_as_tokens if spec.enum_tokenizable else (prop.val if isinstance(prop.val, list) else [prop.val]) for i, subval in enumerate(val): + # make sure the subval is a formated right. + if isinstance(subval, str): + subval = str2ident(subval) # DT_N__P__IDX__EXISTS ret[f"{macro}_IDX_{i}_EXISTS"] = 1 # DT_N__P__IDX__ENUM_VAL__EXISTS 1