Skip to content

Enable digitalRead on output pins, only enable pull-up in digitalWrite if pin is not output #101

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 5 commits into from
Jul 8, 2016

Conversation

sandeepmistry
Copy link
Contributor

Resolves #56 and #94.

  • pinMode:
    • enable input mode of output pins, to support using digitalRead to read current value (maintains AVR behaviour).
    • disable pull-up on output mode
  • digitalWrite:
    • only enable pull-up if pin is not in output mode and HIGH is passed in, disable pull-up if LOW passed in. (This is similar to [samd] fixing issue #28 #41, but it did not set OUT which is needed to enable pull-up - as per table 22-1 in the SAMD21 datasheet).
    • simplify some duplicated code, by using local variables.

If this is merged #41 can be closed.

@sandeepmistry
Copy link
Contributor Author

@ArduinoBot build this please

@BlackBrix
Copy link

digitalWrite: if the pin is in OUTPUT mode, please do not enable/disable/modify the pull-up at all

will it be this way ?

@sandeepmistry
Copy link
Contributor Author

@BlackBrix
Copy link

is it within the nightly build already ?

@sandeepmistry
Copy link
Contributor Author

@ArduinoBot build this please

@ArduinoBot
Copy link

✅ Build completed.

⬇️ Build URL: http://downloads.arduino.cc/PR/samd/package_samd-b52_index.json

ℹ️ To test this build:

  1. Open the Preferences of the Arduino IDE.
  2. Add the Build URL above in the Additional Boards Manager URLs field, and click OK.
  3. Open the Boards Manager (menu Tools->Board->Board Manager...)
  4. Install Arduino SAMD core - Pull Request Enable digitalRead on output pins, only enable pull-up in digitalWrite if pin is not output #101
  5. Select one of the boards under SAMD Pull Request Enable digitalRead on output pins, only enable pull-up in digitalWrite if pin is not output #101 in Tools->Board menu
  6. Compile/Upload as usual

@sandeepmistry
Copy link
Contributor Author

@dirk67 this change has not been merged into master yet, see @ArduinoBot's comment above for instructions on how to try out these changes.

@BlackBrix
Copy link

(I am formerly @dirk67)
I tested this and get no errors.
I think this should merged into master now.

mattairtech added a commit to mattairtech/ArduinoCore-samd that referenced this pull request Mar 30, 2016
@agdl agdl merged commit f054f5c into arduino:master Jul 8, 2016
@sandeepmistry sandeepmistry deleted the digital-read-write-pullup branch July 8, 2016 15:00
@cmaglie cmaglie added this to the Release 1.6.19 milestone Jul 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

writing LOW to a digital input pin blocks subsequent digitalRead attempts
5 participants