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

Analog config #174

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Analog config #174

wants to merge 2 commits into from

Conversation

soundanalogous
Copy link
Member

This is an evolution of #40 so I opened a new pull for it. However adding this functionality is not so straight forward. There are 2 major issues:

  1. Only SAM-based variants include the methods analogReadResolution and analogWriteResolution.
  2. Only AVR-based variants support setting the analogReference value. SAM variants have an analogReference method, but it is set with a typedef value rather than a constant. Furthermore, the DEFAULT and EXTERNAL are defined for SAM variants, but they cannot be passed to analogReference since analogReference expects a parameter of type eAnalogReference which is a type created specifically for SAM variants.

There appears to be no clean implementation possible here. I'd have to pick an existing define that is unique to each architecture and use that to determine whether a board is of SAM or AVR architecture, or I'd have to add some defines to Boards.h to sort it out.

@soundanalogous
Copy link
Member Author

Teensy 3.1 can also make use of analogWriteResolution

@soundanalogous
Copy link
Member Author

Arduino Zero uses 12-bit ADC

@soundanalogous
Copy link
Member Author

ESP8266 has a 10-bit PWM resolution

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant