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

Allow analogPinToChannel for chips other than ATTinyX5 #1366

Closed
tarunlightup opened this issue Apr 16, 2013 · 6 comments
Closed

Allow analogPinToChannel for chips other than ATTinyX5 #1366

tarunlightup opened this issue Apr 16, 2013 · 6 comments

Comments

@tarunlightup
Copy link

For my board, it makes sense to renumber the pins on the ATTiny84. Thus, the ADC channel is no longer the same number as the Arduino pin number. The macro "analogPinToChannel" seems to address this, but it currently is only called for ATTinyX5 and ATMega32U4. I'm able to get my board working if I edit the arduino core (analogRead function) to ensure that the macro is called without restriction if defined. Could this macro be allowed to work for all chips without restriction if defined, instead of being restricted to only be called for ATTinyX5 and ATMega32U4? It would make it easier to use other chips without having to update the analogRead function each time.

@Lauszus
Copy link
Contributor

Lauszus commented Apr 16, 2013

I would like this change as well. I makes it much easier to add new boards without needing to modify the core. @tarunpondicherry I can open up a pull request if you like?

@damellis
Copy link
Contributor

I also think this would be great as we've needed a more flexible way of mapping pins to analog channels for a while now. I would suggest that any pull request default to the current behavior if the analogPinToChannel() macro isn't defined.

In addition, we'll probably want to test this on a range of boards. What do people have available to test with? I can try to cover some cases too.

@niesteszeck
Copy link

I can do test on a Arduino Mega 2560 if you provide the test.

@Lauszus
Copy link
Contributor

Lauszus commented Apr 17, 2013

@damellis I can test it on Arduino Mega, Mega 2560, Uno and Leonardo. I have just send a pull request that should fix this: #1368.

@Lauszus
Copy link
Contributor

Lauszus commented Apr 19, 2013

@niesteszeck you can find my test code here: #1368 (comment).

@Lauszus
Copy link
Contributor

Lauszus commented Feb 20, 2014

This issue should be closed, as this was fixed with: #1368.

@cmaglie cmaglie closed this as completed Feb 21, 2014
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

No branches or pull requests

5 participants