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

Add explicit support for arduino-nano #169

Closed
wants to merge 0 commits into from
Closed

Conversation

drmorr0
Copy link
Contributor

@drmorr0 drmorr0 commented Mar 25, 2021

  1. Add the arduino-nano feature flag to arduino-hal.
  2. Make the ADC6 and ADC7 pins only available for nano, not for uno.
  3. Add an example crate for arduino-nano with just a blink and ADC example.

Copy link
Owner

@Rahix Rahix left a comment

Choose a reason for hiding this comment

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

Hey, thanks a lot for the PR! I've got one thing I'd like to see differently: Instead of the "negative" opt-out feature I'd prefer a "positive" opt-in feature because this composes better with the way cargo merges features.

examples/arduino-nano/.cargo/config.toml Outdated Show resolved Hide resolved
@@ -7,6 +7,7 @@ edition = "2018"
[features]
rt = ["avr-device/rt"]
device-selected = []
disable-unused-adc = []
Copy link
Owner

Choose a reason for hiding this comment

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

In general, features should always be opt-in instead of opt-out, because features are selected based on the union of all features requested by downstream crates. I.e. suppose crate A sets disable-unused-adc while crate B expects the pins to be available - this wouldn't compile. If, OTOH you'd have an additional-adc-pins feature which crate A ignores and crate B sets explicitly - all is well.

This also means you can get rid of the not() you have to use everywhere.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yep, this makes sense, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mcu-support Support for a new Microcontroller
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants