Skip to content

Conversation

@KimBP
Copy link
Contributor

@KimBP KimBP commented Jan 16, 2022

Make support for all samd21 adc channels. Before only channel 0 was supported.

example project drivers/adc enriched with overlay for arduino_zero.
Unfortunately I don't have access to this board and can't verify it my self.
I'm currently working on another board on which the fix has been verified, but it would be nice if someone could test it at arduino_zero

@KimBP KimBP requested review from anangl and nashif as code owners January 16, 2022 18:59
@github-actions github-actions bot added area: ADC Analog-to-Digital Converter (ADC) area: Samples Samples labels Jan 16, 2022
KimBP added 2 commits January 16, 2022 20:13
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]>
Some adc drivers, like adc_sam0, doesn't look at channel_id
when setting up the adc channel, but rely on the input_positive
and input_negative members.

With this change the sample project also supports e.g.
samd21 based boards using other pins than AIN[0].

This is exemplified by adding arduino_zero overlay using AIN[10]

Signed-off-by: Kim Bøndergaard <[email protected]>
@nandojve
Copy link
Member

Hi @KimBP ,

#41319 is under review too. Would you mind check if that fix the issue you are addressing here?

@nandojve nandojve self-requested a review January 18, 2022 11:44
@attie-argentum
Copy link
Member

attie-argentum commented Jan 18, 2022

  • I believe the first commit is taken care of here (in a different way)
  • The second commit mirrors this, but also includes the arduino_zero.overlay

@KimBP
Copy link
Contributor Author

KimBP commented Jan 18, 2022

Seems like other PR's in the pipeline are fixing the issues solved by this PR so I'll retract this one

@KimBP KimBP closed this Jan 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: ADC Analog-to-Digital Converter (ADC) area: Samples Samples

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants