Nope, back to being confused. I look at the variant.cpp but where is it actually defining the pin numbers?
I see this:
// 30/31 - EDBG/UART
{ PORTB, 22, PIO_SERCOM_ALT, PIN_ATTR_NONE, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // TX: SERCOM5/PAD[2]
{ PORTB, 23, PIO_SERCOM_ALT, PIN_ATTR_NONE, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // RX: SERCOM5/PAD[3]
I see it getting initialized but I don’t see it defined. Excuse me if I’m wrong but when you look at PA14 which would be “zero pin 2” is defined like this:
{ PORTA, 14, PIO_DIGITAL, (PIN_ATTR_DIGITAL), No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_14 },
So it looks like you’d really want the third and fourth variables to be “PIO_DIGITAL, (PIN_ATTR_DIGITAL)” respectively?
And still confused on how we still get to “arduino pin 2” from that.
UPDATE:
I guess the pin numbers are derived from the order they are in that array.
And to get the analog pin names it’s coming from variant.h
/*
* Analog pins
*/
#define PIN_A0 (14ul)
#define PIN_A1 (15ul)
#define PIN_A2 (16ul)
#define PIN_A3 (17ul)
#define PIN_A4 (18ul)
#define PIN_A5 (19ul)
#define PIN_DAC0 (14ul)
static const uint8_t A0 = PIN_A0;
static const uint8_t A1 = PIN_A1;
static const uint8_t A2 = PIN_A2;
static const uint8_t A3 = PIN_A3;
static const uint8_t A4 = PIN_A4;
static const uint8_t A5 = PIN_A5;
Now I need to figure out where “14ul” is defined???
UPDATE:
I have just discovered (14ul) is a compiler macro for unsigned long 14… right?