|
27 | 27 | #include"timers.h" |
28 | 28 |
|
29 | 29 | #defineNUM_DIGITAL_PINS 22 // (14 on digital headers + 8 on analog headers) |
30 | | -#defineNUM_ANALOG_INPUTS8 |
| 30 | +#defineNUM_ANALOG_INPUTS14 |
31 | 31 | #defineNUM_RESERVED_PINS 6 // (TOSC1/2, VREF, RESET, DEBUG USART Rx/Tx) |
32 | 32 | #defineNUM_INTERNALLY_USED_PINS 10 // (2 x Chip select + 2 x UART + 4 x IO + LED_BUILTIN + 1 unused pin) |
33 | 33 | #defineNUM_I2C_PINS 2 // (SDA / SCL) |
34 | 34 | #defineNUM_SPI_PINS 3 // (MISO / MOSI / SCK) |
35 | 35 | #defineNUM_TOTAL_FREE_PINS (NUM_DIGITAL_PINS) |
36 | 36 | #defineNUM_TOTAL_PINS (NUM_DIGITAL_PINS + NUM_RESERVED_PINS + NUM_INTERNALLY_USED_PINS + NUM_I2C_PINS + NUM_SPI_PINS) |
37 | 37 | #defineANALOG_INPUT_OFFSET 14 |
38 | | -#definedigitalPinToAnalogInput(p) ((p < NUM_ANALOG_INPUTS) ? (p) : (p) - ANALOG_INPUT_OFFSET) |
39 | 38 |
|
40 | 39 | #defineEXTERNAL_NUM_INTERRUPTS 48 |
41 | 40 |
|
@@ -90,14 +89,14 @@ static const uint8_t SCL = PIN_WIRE_SCL; |
90 | 89 |
|
91 | 90 | #defineLED_BUILTIN (13) |
92 | 91 |
|
93 | | -#definePIN_A0 (17) |
94 | | -#definePIN_A1 (16) |
95 | | -#definePIN_A2 (15) |
96 | | -#definePIN_A3 (14) |
97 | | -#definePIN_A4 (26) // PF2 / AIN12 |
98 | | -#definePIN_A5 (27) // PF3 / AIN13 |
99 | | -#definePIN_A6 (18) |
100 | | -#definePIN_A7 (19) |
| 92 | +#definePIN_A0 (0) // AIN3 |
| 93 | +#definePIN_A1 (1) // AIN2 |
| 94 | +#definePIN_A2 (2) // AIN1 |
| 95 | +#definePIN_A3 (3) // AIN0 |
| 96 | +#definePIN_A4 (4) // PF2 / AIN12 |
| 97 | +#definePIN_A5 (5) // PF3 / AIN13 |
| 98 | +#definePIN_A6 (6) // AIN5 |
| 99 | +#definePIN_A7 (7) // AIN4 |
101 | 100 |
|
102 | 101 | staticconstuint8_tA0=PIN_A0; |
103 | 102 | staticconstuint8_tA1=PIN_A1; |
@@ -321,9 +320,22 @@ const uint8_t PROGMEM digital_pin_to_timer[] = { |
321 | 320 | NOT_ON_TIMER// 40 PF6 RESET |
322 | 321 | }; |
323 | 322 |
|
| 323 | +constuint8_tPROGMEManalog_pin_to_channel[]= { |
| 324 | +3, |
| 325 | +2, |
| 326 | +1, |
| 327 | +0, |
| 328 | +12, |
| 329 | +13, |
| 330 | +5, |
| 331 | +4 |
| 332 | +}; |
324 | 333 |
|
325 | 334 | #endif |
326 | 335 |
|
| 336 | +externconstuint8_tanalog_pin_to_channel[]; |
| 337 | +#definedigitalPinToAnalogInput(p) ((p < NUM_ANALOG_INPUTS) ? pgm_read_byte(analog_pin_to_channel + p) : NOT_A_PIN ) |
| 338 | + |
327 | 339 | // These serial port names are intended to allow libraries and architecture-neutral |
328 | 340 | // sketches to automatically default to the correct port name for a particular type |
329 | 341 | // of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN, |
|