Skip to content

Add support for differential ADC #246

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Aug 27, 2020
Merged

Add support for differential ADC #246

merged 11 commits into from
Aug 27, 2020

Conversation

nseidle
Copy link
Member

@nseidle nseidle commented Aug 13, 2020

This PR adds two ADC channels:

ADIFF0
ADIFF1

and allows user to read the analog value of the channel like this:

int myAnalog0 = analogRead(ADIFF0); //Pads 12/13. Pins 9/10 on RedBoard Artemis.

This allows the user to read differential sensors such as load cells and wheatstone bridges.

An example is included in the advanced directory. To support this, if user tries to read a diff pair, the two associated diff pins will be set to analog inputs and the ADC will be set to channel DIFF0 or DIFF1.

My only concern with this PR is that it's a bit inelegant. I had to add pad2pin() function because it was easier than modifying ap3_set_pin_to_analog() and creating a ap3_set_pad_to_analog().

If needed, I can re-base this branch to the release candidate.

@oclyke
Copy link
Contributor

oclyke commented Aug 19, 2020

Can we put a pin in this PR and plan to add this functionality in the v2.0.0 core? I ask because there are HUGE structural changes in 2.0.0. Things like pin2pad no longer exist, the special ADC pads no longer exist, etc...

I think it would make more sense to make these things happen on the v2.0.0 side. Thoughts? btw release of v2.0.0 is coming up quite soon

Copy link
Contributor

@oclyke oclyke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nseidle Since we are going to keep the v1.x core around for a while I will merge this PR - let's get this functionality into the v2.x branch also

@oclyke oclyke merged commit f92ce2d into release-candidate Aug 27, 2020
@oclyke oclyke deleted the adcDifferential branch August 27, 2020 18:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants