Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 9817b09

Browse filesBrowse files
authored
Nano ESP32: fix digital, analog and GPIO pin counts (espressif#8586)
* Nano ESP32: fix previous merge issues * 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. * Nano ESP32: add debugging support * Nano ESP32: fix digital, analog and GPIO pin counts
1 parent 738be45 commit 9817b09
Copy full SHA for 9817b09

File tree

Expand file treeCollapse file tree

1 file changed

+12
-12
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+12
-12
lines changed

‎variants/arduino_nano_nora/pins_arduino.h

Copy file name to clipboardExpand all lines: variants/arduino_nano_nora/pins_arduino.h
+12-12Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@
1717

1818
// Arduino style definitions (API uses Dx)
1919

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)
20+
#define NUM_DIGITAL_PINS 25 // 25 I/O lines exported
21+
#define NUM_ANALOG_INPUTS 20 // 20 CPU ADC inputs, not all exported
22+
#define EXTERNAL_NUM_INTERRUPTS NUM_DIGITAL_PINS // All GPIOs
2323

24-
#define EXTERNAL_NUM_INTERRUPTS 46
25-
#define NUM_DIGITAL_PINS 25
26-
#define NUM_ANALOG_INPUTS 8
24+
#define analogInputToDigitalPin(p) (((p)<NUM_ANALOG_INPUTS)?(analogChannelToDigitalPin(p)):-1)
25+
#define digitalPinToInterrupt(p) (((p)<NUM_DIGITAL_PINS)?(p):NOT_AN_INTERRUPT)
26+
#define digitalPinHasPWM(p) (p < NUM_DIGITAL_PINS)
2727

2828
static constexpr uint8_t D0 = 0; // also RX
2929
static constexpr uint8_t D1 = 1; // also TX
@@ -56,13 +56,13 @@ static constexpr uint8_t A7 = 24;
5656

5757
// ESP32-style definitions (API uses GPIOx)
5858

59-
#define EXTERNAL_NUM_INTERRUPTS 46
60-
#define NUM_DIGITAL_PINS 48
61-
#define NUM_ANALOG_INPUTS 20
59+
#define NUM_DIGITAL_PINS SOC_GPIO_PIN_COUNT // GPIO 0..48, not all exported
60+
#define NUM_ANALOG_INPUTS 20 // GPIO 1..20, not all exported
61+
#define EXTERNAL_NUM_INTERRUPTS NUM_DIGITAL_PINS // All GPIOs
6262

63-
#define analogInputToDigitalPin(p) (((p)<20)?(analogChannelToDigitalPin(p)):-1)
64-
#define digitalPinToInterrupt(p) (((p)<48)?(p):-1)
65-
#define digitalPinHasPWM(p) (p < 46)
63+
#define analogInputToDigitalPin(p) (((p)<NUM_ANALOG_INPUTS)?(analogChannelToDigitalPin(p)):-1)
64+
#define digitalPinToInterrupt(p) (((p)<NUM_DIGITAL_PINS)?(p):NOT_AN_INTERRUPT)
65+
#define digitalPinHasPWM(p) (p < NUM_DIGITAL_PINS)
6666

6767
static constexpr uint8_t D0 = 44; // also RX
6868
static constexpr uint8_t D1 = 43; // also TX

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.