* [pin_remap 1/3] platform: define ARDUINO_CORE_BUILD when building core files * [pin_remap 2/3] core,libs: add pin remap hooks * platform: remove previous build options if file is missing "touch" would create the file if not present, but not delete its contents if a previous run left the file in the build dir. * platform: make debug_custom.json file customizable by board * platform: fix default debug prefix "debug.toolchain.prefix" must end with a dash, since only the tool name is appended to this string. The reason this is not a major issue is that the "debug_custom.json" file (copied in the sketch directory when debugging is enabled) forces its own prefix. And to make things more interesting, the "toolchainPrefix" entry in that file should _not_ end with a dash. * [pin_remap 3/3]: add Arduino Nano ESP32 board * fix: periman: include it by default, add include guard * fix: io_pin_remap: adjust for new perimap APIs * fix: libraries: manually handled pin remapping files Previously all libraries invoked either high-level APIs (transparently remapped, like the user sketch) or low-level ESP-IDF calls (where the remap to GPIO numbers had to be added manually). Since 3.x, some of these are mixed (for example, periman* APIs are remapped, while soc* are not). This must be handled by disabling the automatic API remapping and making sure all calls use GPIO numbers. * feat: show remapped pins in chip debug reports --------- Co-authored-by: Jan Procházka <90197375+P-R-O-C-H-Y@users.noreply.github.com> Co-authored-by: Me No Dev <me-no-dev@users.noreply.github.com>
108 lines
3.4 KiB
C
108 lines
3.4 KiB
C
#ifndef Pins_Arduino_h
|
|
#define Pins_Arduino_h
|
|
|
|
#include <stdint.h>
|
|
|
|
#define USB_VID 0x2341
|
|
#define USB_PID 0x0070
|
|
|
|
#ifndef __cplusplus
|
|
#define constexpr const
|
|
#endif
|
|
|
|
// primary pin names
|
|
|
|
#if defined(BOARD_HAS_PIN_REMAP) && !defined(BOARD_USES_HW_GPIO_NUMBERS)
|
|
|
|
// Arduino style definitions (API uses Dx)
|
|
|
|
static constexpr uint8_t D0 = 0; // also RX
|
|
static constexpr uint8_t D1 = 1; // also TX
|
|
static constexpr uint8_t D2 = 2;
|
|
static constexpr uint8_t D3 = 3; // also CTS
|
|
static constexpr uint8_t D4 = 4; // also DSR
|
|
static constexpr uint8_t D5 = 5;
|
|
static constexpr uint8_t D6 = 6;
|
|
static constexpr uint8_t D7 = 7;
|
|
static constexpr uint8_t D8 = 8;
|
|
static constexpr uint8_t D9 = 9;
|
|
static constexpr uint8_t D10 = 10; // also SS
|
|
static constexpr uint8_t D11 = 11; // also MOSI
|
|
static constexpr uint8_t D12 = 12; // also MISO
|
|
static constexpr uint8_t D13 = 13; // also SCK, LED_BUILTIN
|
|
static constexpr uint8_t LED_RED = 14;
|
|
static constexpr uint8_t LED_GREEN = 15;
|
|
static constexpr uint8_t LED_BLUE = 16; // also RTS
|
|
|
|
static constexpr uint8_t A0 = 17; // also DTR
|
|
static constexpr uint8_t A1 = 18;
|
|
static constexpr uint8_t A2 = 19;
|
|
static constexpr uint8_t A3 = 20;
|
|
static constexpr uint8_t A4 = 21; // also SDA
|
|
static constexpr uint8_t A5 = 22; // also SCL
|
|
static constexpr uint8_t A6 = 23;
|
|
static constexpr uint8_t A7 = 24;
|
|
|
|
#else
|
|
|
|
// ESP32-style definitions (API uses GPIOx)
|
|
|
|
static constexpr uint8_t D0 = 44; // also RX
|
|
static constexpr uint8_t D1 = 43; // also TX
|
|
static constexpr uint8_t D2 = 5;
|
|
static constexpr uint8_t D3 = 6; // also CTS
|
|
static constexpr uint8_t D4 = 7; // also DSR
|
|
static constexpr uint8_t D5 = 8;
|
|
static constexpr uint8_t D6 = 9;
|
|
static constexpr uint8_t D7 = 10;
|
|
static constexpr uint8_t D8 = 17;
|
|
static constexpr uint8_t D9 = 18;
|
|
static constexpr uint8_t D10 = 21; // also SS
|
|
static constexpr uint8_t D11 = 38; // also MOSI
|
|
static constexpr uint8_t D12 = 47; // also MISO
|
|
static constexpr uint8_t D13 = 48; // also SCK, LED_BUILTIN
|
|
static constexpr uint8_t LED_RED = 46;
|
|
static constexpr uint8_t LED_GREEN = 0;
|
|
static constexpr uint8_t LED_BLUE = 45; // also RTS
|
|
|
|
static constexpr uint8_t A0 = 1; // also DTR
|
|
static constexpr uint8_t A1 = 2;
|
|
static constexpr uint8_t A2 = 3;
|
|
static constexpr uint8_t A3 = 4;
|
|
static constexpr uint8_t A4 = 11; // also SDA
|
|
static constexpr uint8_t A5 = 12; // also SCL
|
|
static constexpr uint8_t A6 = 13;
|
|
static constexpr uint8_t A7 = 14;
|
|
|
|
#endif
|
|
|
|
// alternate pin functions
|
|
|
|
static constexpr uint8_t LED_BUILTIN = D13;
|
|
|
|
static constexpr uint8_t TX = D1;
|
|
static constexpr uint8_t RX = D0;
|
|
static constexpr uint8_t RTS = LED_BLUE;
|
|
static constexpr uint8_t CTS = D3;
|
|
static constexpr uint8_t DTR = A0;
|
|
static constexpr uint8_t DSR = D4;
|
|
|
|
static constexpr uint8_t SS = D10;
|
|
static constexpr uint8_t MOSI = D11;
|
|
static constexpr uint8_t MISO = D12;
|
|
static constexpr uint8_t SCK = D13;
|
|
|
|
static constexpr uint8_t SDA = A4;
|
|
static constexpr uint8_t SCL = A5;
|
|
|
|
#define PIN_I2S_SCK D7
|
|
#define PIN_I2S_FS D8
|
|
#define PIN_I2S_SD D9
|
|
#define PIN_I2S_SD_OUT D9 // same as bidir
|
|
#define PIN_I2S_SD_IN D10
|
|
|
|
#ifndef __cplusplus
|
|
#undef constexpr
|
|
#endif
|
|
|
|
#endif /* Pins_Arduino_h */
|