Skip to content

Commit ab67081

Browse files
ubiedafabiobaltieri
authored andcommitted
afbr-s50: fix build-time asserts for settings outside dual-freq mode
The existing build-time asserts not only needs to cover dual-frequency mode does no exceed high-speed settings, it needs to allow not using dual-frequency mode settings at all, which is what this patch does. Signed-off-by: Luis Ubieda <[email protected]>
1 parent c1e7b2e commit ab67081

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

drivers/sensor/broadcom/afbr_s50/afbr_s50.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -362,12 +362,13 @@ BUILD_ASSERT(CONFIG_MAIN_STACK_SIZE >= 4096,
362362
#define AFBR_S50_INIT(inst) \
363363
\
364364
BUILD_ASSERT(DT_INST_PROP(inst, odr) > 0, "Please set valid ODR"); \
365-
BUILD_ASSERT((DT_INST_PROP(inst, dual_freq_mode) != 0) ^ \
366-
((DT_INST_PROP(inst, measurement_mode) & ARGUS_MODE_FLAG_HIGH_SPEED) != 0), \
365+
BUILD_ASSERT(DT_INST_PROP(inst, dual_freq_mode == 0) || \
366+
((DT_INST_PROP(inst, dual_freq_mode) != 0) ^ \
367+
((DT_INST_PROP(inst, measurement_mode) & ARGUS_MODE_FLAG_HIGH_SPEED) != 0)), \
367368
"High Speed mode is not compatible with Dual-Frequency mode enabled. " \
368369
"Please disable it on device-tree or change measurement modes"); \
369-
BUILD_ASSERT((DT_INST_PROP(inst, dual_freq_mode) != 0) ^ \
370-
(DT_INST_PROP(inst, odr) > 100), \
370+
BUILD_ASSERT(DT_INST_PROP(inst, dual_freq_mode) == 0 || \
371+
((DT_INST_PROP(inst, dual_freq_mode) != 0) ^ (DT_INST_PROP(inst, odr) > 100)),\
371372
"ODR is too high for Dual-Frequency mode. Please reduce it to " \
372373
"100Hz or less"); \
373374
\

0 commit comments

Comments
 (0)