Check if ATmega32u4 is defined
Needed in order to work with Arduino Leonardo
This commit is contained in:
parent
8d26462be2
commit
0a7b402c45
|
@ -42,6 +42,9 @@ int analogRead(uint8_t pin)
|
||||||
uint8_t low, high;
|
uint8_t low, high;
|
||||||
|
|
||||||
#if defined(analogPinToChannel)
|
#if defined(analogPinToChannel)
|
||||||
|
#if defined(__AVR_ATmega32U4__)
|
||||||
|
if (pin >= 18) pin -= 18; // allow for channel or pin numbers
|
||||||
|
#endif
|
||||||
pin = analogPinToChannel(pin);
|
pin = analogPinToChannel(pin);
|
||||||
#elif defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
|
#elif defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
|
||||||
if (pin >= 54) pin -= 54; // allow for channel or pin numbers
|
if (pin >= 54) pin -= 54; // allow for channel or pin numbers
|
||||||
|
|
Loading…
Reference in New Issue