Skip to content

Commit bb0e428

Browse files
committed
drivers: adc: adc_sam0: Allow all ADC channels to be used
In struct adc_sequence the channels member is a bitset specifying which channels to cover by the scan. The sam0 driver only supports one channel to be scanned at a time, but the check made until now did not regard .channels as a bitset but a number and thus only accepting a value of 1 aka channel 0 With this fix it is now checked whether more bits are set Signed-off-by: Kim Bøndergaard <[email protected]>
1 parent 4446272 commit bb0e428

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/adc/adc_sam0.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,8 @@ static int start_read(const struct device *dev,
392392

393393
wait_synchronization(adc);
394394

395-
if (sequence->channels != 1U) {
395+
if ((sequence->channels == 0) ||
396+
((sequence->channels & (sequence->channels - 1)) != 0)) {
396397
LOG_ERR("Channel scanning is not supported");
397398
return -ENOTSUP;
398399
}

0 commit comments

Comments
 (0)