@@ -86,8 +86,8 @@ LOG_MODULE_REGISTER(adc_stm32);
8686#define ASYNC 2
8787
8888/* Sequencer type */
89- #define NOT_FULLY_CONFIGURABLE 0
90- #define FULLY_CONFIGURABLE 1
89+ #define SEQUENCER_FIXED 0
90+ #define SEQUENCER_PROGRAMMABLE 1
9191
9292/* Oversampler type */
9393#define OVERSAMPLER_NONE 0
@@ -107,17 +107,17 @@ LOG_MODULE_REGISTER(adc_stm32);
107107#define ANY_ADC_SEQUENCER_TYPE_IS (value ) \
108108 (DT_INST_FOREACH_STATUS_OKAY_VARGS(IS_EQ_STRING_PROP, \
109109 st_adc_sequencer,\
110- value) 0)
110+ value, SEQUENCER_ ) 0)
111111
112112#define ANY_ADC_OVERSAMPLER_TYPE_IS (value ) \
113113 (DT_INST_FOREACH_STATUS_OKAY_VARGS(IS_EQ_STRING_PROP, \
114114 st_adc_oversampler,\
115- value) 0)
115+ value, OVERSAMPLER_ ) 0)
116116
117117#define ANY_ADC_INTERNAL_REGULATOR_TYPE_IS (value ) \
118118 (DT_INST_FOREACH_STATUS_OKAY_VARGS(IS_EQ_STRING_PROP, \
119119 st_adc_internal_regulator,\
120- value) 0)
120+ value, INTERNAL_REGULATOR_ ) 0)
121121
122122#define ANY_ADC_HAS_DEEP_POWERDOWN \
123123 (DT_INST_FOREACH_STATUS_OKAY_VARGS(IS_EQ_PROP_OR, \
@@ -145,13 +145,13 @@ LOG_MODULE_REGISTER(adc_stm32);
145145#define IS_EQ_NODE_PROP_OR (node , prop , default_value , compare_value ) \
146146 IS_EQ(DT_PROP_OR(node, prop, default_value), compare_value) ||
147147
148- #define IS_EQ_STRING_PROP (inst , prop , compare_value ) \
149- IS_EQ(DT_INST_STRING_UPPER_TOKEN(inst, prop), compare_value) ||
148+ #define IS_EQ_STRING_PROP (inst , prop , compare_value , prefix ) \
149+ IS_EQ(CONCAT(prefix, DT_INST_STRING_UPPER_TOKEN(inst, prop) ), compare_value) ||
150150
151151/* reference voltage for the ADC */
152152#define STM32_ADC_VREF_MV DT_INST_PROP(0, vref_mv)
153153
154- #if ANY_ADC_SEQUENCER_TYPE_IS (FULLY_CONFIGURABLE )
154+ #if ANY_ADC_SEQUENCER_TYPE_IS (SEQUENCER_PROGRAMMABLE )
155155
156156#if defined(LL_ADC_REG_RANK_28 )
157157#define MAX_RANK 28
@@ -172,7 +172,7 @@ static const uint32_t table_seq_len[] = {
172172 LISTIFY (UTIL_DEC (MAX_RANK ), SEQ_LEN , (,))
173173};
174174
175- #endif /* ANY_ADC_SEQUENCER_TYPE_IS(FULLY_CONFIGURABLE ) */
175+ #endif /* ANY_ADC_SEQUENCER_TYPE_IS(SEQUENCER_PROGRAMMABLE ) */
176176
177177/* Number of different sampling time values */
178178#define STM32_NB_SAMPLING_TIME 8
@@ -946,8 +946,8 @@ static int set_sequencer(const struct device *dev)
946946
947947 channels_mask |= channel ;
948948
949- #if ANY_ADC_SEQUENCER_TYPE_IS (FULLY_CONFIGURABLE )
950- if (config -> sequencer_type == FULLY_CONFIGURABLE ) {
949+ #if ANY_ADC_SEQUENCER_TYPE_IS (SEQUENCER_PROGRAMMABLE )
950+ if (config -> sequencer_type == SEQUENCER_PROGRAMMABLE ) {
951951#if ANY_ADC_HAS_CHANNEL_PRESELECTION
952952 if (config -> has_channel_preselection ) {
953953 /*
@@ -961,11 +961,11 @@ static int set_sequencer(const struct device *dev)
961961 LL_ADC_REG_SetSequencerRanks (adc , table_rank [channel_index ], channel );
962962 LL_ADC_REG_SetSequencerLength (adc , table_seq_len [channel_index ]);
963963 }
964- #endif /* ANY_ADC_SEQUENCER_TYPE_IS(FULLY_CONFIGURABLE ) */
964+ #endif /* ANY_ADC_SEQUENCER_TYPE_IS(SEQUENCER_PROGRAMMABLE ) */
965965 }
966966
967- #if ANY_ADC_SEQUENCER_TYPE_IS (NOT_FULLY_CONFIGURABLE )
968- if (config -> sequencer_type == NOT_FULLY_CONFIGURABLE ) {
967+ #if ANY_ADC_SEQUENCER_TYPE_IS (SEQUENCER_FIXED )
968+ if (config -> sequencer_type == SEQUENCER_FIXED ) {
969969 LL_ADC_REG_SetSequencerChannels (adc , channels_mask );
970970
971971#ifdef LL_ADC_FLAG_CCRDY
@@ -978,7 +978,7 @@ static int set_sequencer(const struct device *dev)
978978 LL_ADC_ClearFlag_CCRDY (adc );
979979#endif /* LL_ADC_FLAG_CCRDY */
980980 }
981- #endif /* ANY_ADC_SEQUENCER_TYPE_IS(NOT_FULLY_CONFIGURABLE ) */
981+ #endif /* ANY_ADC_SEQUENCER_TYPE_IS(SEQUENCER_FIXED ) */
982982
983983#if DT_HAS_COMPAT_STATUS_OKAY (st_stm32f1_adc ) || \
984984 DT_HAS_COMPAT_STATUS_OKAY (st_stm32f4_adc )
@@ -1006,12 +1006,12 @@ static int start_read(const struct device *dev,
10061006 return - EINVAL ;
10071007 }
10081008
1009- #if ANY_ADC_SEQUENCER_TYPE_IS (FULLY_CONFIGURABLE )
1009+ #if ANY_ADC_SEQUENCER_TYPE_IS (SEQUENCER_PROGRAMMABLE )
10101010 if (data -> channel_count > ARRAY_SIZE (table_seq_len )) {
10111011 LOG_ERR ("Too many channels for sequencer. Max: %d" , ARRAY_SIZE (table_seq_len ));
10121012 return - EINVAL ;
10131013 }
1014- #endif /* ANY_ADC_SEQUENCER_TYPE_IS(FULLY_CONFIGURABLE ) */
1014+ #endif /* ANY_ADC_SEQUENCER_TYPE_IS(SEQUENCER_PROGRAMMABLE ) */
10151015
10161016#if DT_HAS_COMPAT_STATUS_OKAY (st_stm32f1_adc ) && !defined(CONFIG_ADC_STM32_DMA )
10171017 /* Multiple samplings is only supported with DMA for F1 */
@@ -1974,8 +1974,10 @@ static const struct adc_stm32_cfg adc_stm32_cfg_##index = { \
19741974 .clk_prescaler = ADC_STM32_DT_PRESC(index), \
19751975 .pcfg = PINCTRL_DT_INST_DEV_CONFIG_GET(index), \
19761976 .differential_channels_used = (ANY_CHILD_NODE_IS_DIFFERENTIAL(index) > 0), \
1977- .sequencer_type = DT_INST_STRING_UPPER_TOKEN(index, st_adc_sequencer), \
1978- .oversampler_type = DT_INST_STRING_UPPER_TOKEN(index, st_adc_oversampler), \
1977+ .sequencer_type = CONCAT(SEQUENCER_, \
1978+ DT_INST_STRING_UPPER_TOKEN(index, st_adc_sequencer)), \
1979+ .oversampler_type = CONCAT(OVERSAMPLER_, \
1980+ DT_INST_STRING_UPPER_TOKEN(index, st_adc_oversampler)), \
19791981 .internal_regulator = CONCAT(INTERNAL_REGULATOR_, \
19801982 DT_INST_STRING_UPPER_TOKEN(index, st_adc_internal_regulator)), \
19811983 .has_deep_powerdown = DT_INST_PROP(index, st_adc_has_deep_powerdown), \
0 commit comments