|
7 | 7 | #define USB_VID 0x2341
|
8 | 8 | #define USB_PID 0x0070
|
9 | 9 |
|
10 |
| -#define EXTERNAL_NUM_INTERRUPTS 46 |
11 |
| -#define NUM_DIGITAL_PINS 25 |
12 |
| -#define NUM_ANALOG_INPUTS 8 |
13 |
| - |
14 |
| -#define analogInputToDigitalPin(p) (p) |
15 |
| -#define digitalPinToInterrupt(p) ((((uint8_t)digitalPinToGPIONumber(p)) < 48)? digitalPinToGPIONumber(p) : -1) |
16 |
| -#define digitalPinHasPWM(p) (((uint8_t)digitalPinToGPIONumber(p)) < 46) |
17 |
| - |
18 | 10 | #ifndef __cplusplus
|
19 | 11 | #define constexpr const
|
20 | 12 | #endif
|
21 | 13 |
|
22 | 14 | // primary pin names
|
23 | 15 |
|
| 16 | +#if defined(BOARD_HAS_PIN_REMAP) && !defined(BOARD_USES_HW_GPIO_NUMBERS) |
| 17 | + |
| 18 | +// Arduino style definitions (API uses Dx) |
| 19 | + |
| 20 | +#define analogInputToDigitalPin(p) (p) |
| 21 | +#define digitalPinToInterrupt(p) ((((uint8_t)digitalPinToGPIONumber(p)) < 48)? digitalPinToGPIONumber(p) : -1) |
| 22 | +#define digitalPinHasPWM(p) (((uint8_t)digitalPinToGPIONumber(p)) < 46) |
| 23 | + |
| 24 | +#define EXTERNAL_NUM_INTERRUPTS 46 |
| 25 | +#define NUM_DIGITAL_PINS 25 |
| 26 | +#define NUM_ANALOG_INPUTS 8 |
| 27 | + |
24 | 28 | static constexpr uint8_t D0 = 0; // also RX
|
25 | 29 | static constexpr uint8_t D1 = 1; // also TX
|
26 | 30 | static constexpr uint8_t D2 = 2;
|
@@ -48,6 +52,47 @@ static constexpr uint8_t A5 = 22; // also SCL
|
48 | 52 | static constexpr uint8_t A6 = 23;
|
49 | 53 | static constexpr uint8_t A7 = 24;
|
50 | 54 |
|
| 55 | +#else |
| 56 | + |
| 57 | +// ESP32-style definitions (API uses GPIOx) |
| 58 | + |
| 59 | +#define EXTERNAL_NUM_INTERRUPTS 46 |
| 60 | +#define NUM_DIGITAL_PINS 48 |
| 61 | +#define NUM_ANALOG_INPUTS 20 |
| 62 | + |
| 63 | +#define analogInputToDigitalPin(p) (((p)<20)?(analogChannelToDigitalPin(p)):-1) |
| 64 | +#define digitalPinToInterrupt(p) (((p)<48)?(p):-1) |
| 65 | +#define digitalPinHasPWM(p) (p < 46) |
| 66 | + |
| 67 | +static constexpr uint8_t D0 = 44; // also RX |
| 68 | +static constexpr uint8_t D1 = 43; // also TX |
| 69 | +static constexpr uint8_t D2 = 5; |
| 70 | +static constexpr uint8_t D3 = 6; // also CTS |
| 71 | +static constexpr uint8_t D4 = 7; // also DSR |
| 72 | +static constexpr uint8_t D5 = 8; |
| 73 | +static constexpr uint8_t D6 = 9; |
| 74 | +static constexpr uint8_t D7 = 10; |
| 75 | +static constexpr uint8_t D8 = 17; |
| 76 | +static constexpr uint8_t D9 = 18; |
| 77 | +static constexpr uint8_t D10 = 21; // also SS |
| 78 | +static constexpr uint8_t D11 = 38; // also MOSI |
| 79 | +static constexpr uint8_t D12 = 47; // also MISO |
| 80 | +static constexpr uint8_t D13 = 48; // also SCK, LED_BUILTIN |
| 81 | +static constexpr uint8_t LED_RED = 46; |
| 82 | +static constexpr uint8_t LED_GREEN = 0; |
| 83 | +static constexpr uint8_t LED_BLUE = 45; // also RTS |
| 84 | + |
| 85 | +static constexpr uint8_t A0 = 1; // also DTR |
| 86 | +static constexpr uint8_t A1 = 2; |
| 87 | +static constexpr uint8_t A2 = 3; |
| 88 | +static constexpr uint8_t A3 = 4; |
| 89 | +static constexpr uint8_t A4 = 11; // also SDA |
| 90 | +static constexpr uint8_t A5 = 12; // also SCL |
| 91 | +static constexpr uint8_t A6 = 13; |
| 92 | +static constexpr uint8_t A7 = 14; |
| 93 | + |
| 94 | +#endif |
| 95 | + |
51 | 96 | // alternate pin functions
|
52 | 97 |
|
53 | 98 | static constexpr uint8_t LED_BUILTIN = D13;
|
|
0 commit comments