Skip to content
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

digitalRead()/analogRead() interference #1006

Merged
merged 2 commits into from
Jun 10, 2016
Merged

Conversation

avtolstoy
Copy link
Member

@avtolstoy avtolstoy commented May 22, 2016

Fixes #993

  • Saves PinMode in PIN_MAP[pin].user_property instead of a single global variable
  • Fixes ADC PinMode configuration
  • Fixes DAC PinMode configuration (affected by the same issue as ADC pins described in #993 under certain conditions)

Relevant tests:

  • wiring/no_fixture GPIO_AnalogReadWorksMixedWithDigitalRead
  • wiring/adc_dac DAC_AnalogWriteWorksMixedWithDigitalRead

Doneness:

  • Contributor has signed CLA
  • Problem and Solution clearly stated
  • Code peer reviewed
  • API tests compiled
  • Run unit/integration/application tests on device
  • Add documentation (to docs master)

analogRead():
Since 0.5.3 Note: you do not need to set the pinMode() with analogRead(). The pinMode() is automatically set to AN_INPUT any time analogRead() is called for a particular analog pin, if that pin is set to a pinMode other than AN_INPUT. If you explicitly set a pin to INPUT, INPUT_PULLUP, INPUT_PULLDOWN or OUTPUT before using analogRead(), it will switch it back to AN_INPUT before taking the reading. If you use digitalRead() afterwards, it will automatically switch the pinMode back to whatever you originally explicitly set it to.

  • Add to CHANGELOG.md after merging (add links to docs and issues)

@m-mcgowan m-mcgowan added this to the 0.6.x milestone Jun 10, 2016
@m-mcgowan m-mcgowan self-assigned this Jun 10, 2016
@m-mcgowan m-mcgowan force-pushed the feature/save-pinmode branch from b403fd6 to 14a0086 Compare June 10, 2016 17:32
@m-mcgowan m-mcgowan merged commit 79995f3 into develop Jun 10, 2016
@m-mcgowan
Copy link
Contributor

Tested on the Core.

@technobly technobly deleted the feature/save-pinmode branch October 27, 2016 17:25
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.

digitalRead() interferes with analogRead()
2 participants