Skip to content

Commit

Permalink
Check if ATmega32u4 is defined
Browse files Browse the repository at this point in the history
Needed in order to work with Arduino Leonardo
  • Loading branch information
Lauszus committed Apr 17, 2013
1 parent 8d26462 commit 0a7b402
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cores/arduino/wiring_analog.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ int analogRead(uint8_t pin)
uint8_t low, high;

#if defined(analogPinToChannel)
#if defined(__AVR_ATmega32U4__)
if (pin >= 18) pin -= 18; // allow for channel or pin numbers
#endif
pin = analogPinToChannel(pin);
#elif defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
if (pin >= 54) pin -= 54; // allow for channel or pin numbers
Expand Down

0 comments on commit 0a7b402

Please sign in to comment.