Skip to content

Allow analogPinToChannel for chips other than ATTinyX5 #1366

Closed

Description

@tarunlightup

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.

Activity

  1. Lauszus commented on Apr 16, 2013

    @Lauszus
    Contributor

    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?

  2. damellis commented on Apr 17, 2013

    @damellis
    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.

  3. niesteszeck commented on Apr 17, 2013

    @niesteszeck

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

  4. Lauszus commented on Apr 17, 2013

    @Lauszus
    Contributor

    @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.

  5. Lauszus commented on Apr 19, 2013

    @Lauszus
    Contributor

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

  6. Lauszus commented on Feb 20, 2014

    @Lauszus
    Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions