aboutsummaryrefslogtreecommitdiff
path: root/variants/leonardo/pins_arduino.h
diff options
context:
space:
mode:
authorZach Eveland <zeveland@blacklabel-development.com>2011-09-13 23:52:26 -0400
committerZach Eveland <zeveland@blacklabel-development.com>2011-09-13 23:52:26 -0400
commitd0b0f3e45d5c4cf3a7fbcf5832c5e6cc764016e0 (patch)
treee1ad6e1c36d07612e0e4bb105aa55b120b71e54d /variants/leonardo/pins_arduino.h
parent15c4c969298c303899bf80fbc962591d84163216 (diff)
fixed analog pin mapping for 32u4
Diffstat (limited to 'variants/leonardo/pins_arduino.h')
-rw-r--r--variants/leonardo/pins_arduino.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/variants/leonardo/pins_arduino.h b/variants/leonardo/pins_arduino.h
index 6fc3ea9..65ab5e2 100644
--- a/variants/leonardo/pins_arduino.h
+++ b/variants/leonardo/pins_arduino.h
@@ -48,6 +48,10 @@ const static uint8_t A5 = 19;
const static uint8_t A6 = 20;
const static uint8_t A7 = 21;
+// __AVR_ATmega32U4__ has an unusual mapping of pins to channels
+extern const uint8_t PROGMEM analog_pin_to_channel_PGM[];
+#define analogPinToChannel(P) ( pgm_read_byte( analog_pin_to_channel_PGM + (P) ) )
+
#ifdef ARDUINO_MAIN
// On the Arduino board, digital pins are also used
@@ -228,6 +232,35 @@ const uint8_t PROGMEM digital_pin_to_timer_PGM[18] = {
NOT_ON_TIMER,
};
+const uint8_t PROGMEM analog_pin_to_channel_PGM[11] = {
+ /*
+ A0 PF7 ADC7
+ A1 PF6 ADC6
+ A2 PF5 ADC5
+ A3 PF4 ADC4
+ A4 PF1 ADC1
+ A5 PF0 ADC0
+ D4 A6 PD4 ADC8
+ D5 A7 PD6 FastPWM OC4D/ADC9
+ D6 A8 PD7 FastPWM #OC4D/ADC10
+ D9 A9 PB5 PWM16 OC1A/#OC4B/ADC13/PCINT5
+ D10 A10 PB6 PWM16 OC1B/0c4B/ADC12/PCINT6
+ */
+
+ 7,
+ 6,
+ 5,
+ 4,
+ 1,
+ 0,
+ 8,
+ 9,
+
+ 10,
+ 13,
+ 12
+};
+
#endif
#endif \ No newline at end of file