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

initial implementation of analog config protocol #143

Closed
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. I've added a pull request for the protocol as well: https://github.com/firmata/protocol/pull/8/files.

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.

case ANALOG_CONFIG:
if (argc > 1) {
switch (argv[0]) {
case 0: // set analog reference voltage
Copy link
Member Author

Choose a reason for hiding this comment

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

SAM-based variants would need to skip this entire case.

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.

1 participant