Skip to content

Use analogPinToChannel if it's defined - #1368

Merged
cmaglie merged 4 commits into
arduino:masterfrom
Lauszus:issue1366
Aug 1, 2013
Merged

cmaglie merged 4 commits into
arduino:masterfrom
Lauszus:issue1366

Conversation

@Lauszus

@Lauszus Lauszus commented Apr 17, 2013

Copy link
Copy Markdown
Contributor

See #1366

@damellis

Copy link
Copy Markdown
Contributor

This looks like it will break analogRead() on the ATmega32U4 (e.g. the Leonardo) because analogPinToChannel() will be called twice. Can you update (or verify that it's not a problem)?

@Lauszus

Lauszus commented Apr 17, 2013

Copy link
Copy Markdown
Contributor Author

Sorry my bad. It should be fixed now.

@damellis

Copy link
Copy Markdown
Contributor

Thanks! I don't see any immediate problems. What have you tested it with?

@Lauszus

Lauszus commented Apr 19, 2013

Copy link
Copy Markdown
Contributor Author

I havn't had time to test it on any yet. I will try to do it tomorrow or it will be on monday, as I'm off for the weekend.

Btw I left these lines untouched: https://github.com/Lauszus/Arduino/blob/59c5b94c51d726ea656471bc232333ebd200eb19/hardware/arduino/cores/arduino/wiring_analog.c#L51-L52, as I didn't want to break any compatibility issues with other devices out there. I don't know if it's really necessary, but I just thought it would be better to stay on the safe side.

@Lauszus

Lauszus commented Apr 19, 2013

Copy link
Copy Markdown
Contributor Author

I can confirm it's working on Arduino Mega, Mega2560, Leonardo and Uno.
This is the code I used to test it with:

void setup() {
  Serial.begin(115200);
}

void loop() {
  for(uint8_t i = 0; i < NUM_ANALOG_INPUTS; i++) {
    Serial.print(analogRead(A0+i));
    Serial.print('\t');
    delay(100);
  }
  Serial.println();
}

@Lauszus

Lauszus commented Apr 26, 2013

Copy link
Copy Markdown
Contributor Author

@damellis Have you had time to try it yet?

@Lauszus

Lauszus commented May 9, 2013

Copy link
Copy Markdown
Contributor Author

@damellis Any news regarding this issue?

@cmaglie
cmaglie merged commit dbd584e into arduino:master Aug 1, 2013
@cmaglie

cmaglie commented Aug 1, 2013

Copy link
Copy Markdown
Member

Merged, thank you!
C

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.

3 participants