From 80a8317a1605a748e731368ca31ba1459bea7b82 Mon Sep 17 00:00:00 2001 From: Martino Facchin Date: Fri, 25 Aug 2023 09:41:25 +0200 Subject: [PATCH 1/2] unor4: fix NUM_DIGITAL_PINS macro The macro represents the number of pins that can be actively used "directly". Since A4/A5 are shared with SDA/SCL, the total number of unique gpios on UNO R4 headers is indeed 14+6 NUM_DIGITAL_PINS is currently unused in the core (better to use PINCOUNT #107 for any safety check) --- variants/MINIMA/pins_arduino.h | 2 +- variants/UNOWIFIR4/pins_arduino.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/variants/MINIMA/pins_arduino.h b/variants/MINIMA/pins_arduino.h index 0f1bc16d7..df4330dee 100644 --- a/variants/MINIMA/pins_arduino.h +++ b/variants/MINIMA/pins_arduino.h @@ -5,7 +5,7 @@ // Pin count // ---- #define PINS_COUNT (PINCOUNT_fn()) -#define NUM_DIGITAL_PINS (22u) +#define NUM_DIGITAL_PINS (20u) #define NUM_ANALOG_INPUTS (6u) #define NUM_ANALOG_OUTPUTS (1u) diff --git a/variants/UNOWIFIR4/pins_arduino.h b/variants/UNOWIFIR4/pins_arduino.h index 70eebe526..50d887f9b 100644 --- a/variants/UNOWIFIR4/pins_arduino.h +++ b/variants/UNOWIFIR4/pins_arduino.h @@ -5,7 +5,7 @@ // Pin count // ---- #define PINS_COUNT (PINCOUNT_fn()) -#define NUM_DIGITAL_PINS (22u) +#define NUM_DIGITAL_PINS (20u) #define NUM_ANALOG_INPUTS (6u) #define NUM_ANALOG_OUTPUTS (1u) From 3b5c7ef5af1667f42ab1710fd054c196d9816ffa Mon Sep 17 00:00:00 2001 From: Martino Facchin Date: Fri, 25 Aug 2023 09:45:52 +0200 Subject: [PATCH 2/2] unor4 minima: add extra pins on SWD connector --- variants/MINIMA/variant.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/variants/MINIMA/variant.cpp b/variants/MINIMA/variant.cpp index 6e2f01898..a1a209813 100644 --- a/variants/MINIMA/variant.cpp +++ b/variants/MINIMA/variant.cpp @@ -48,6 +48,11 @@ extern "C" const PinMuxCfg_t g_pin_cfg[] = { { BSP_IO_PORT_05_PIN_00, P500 }, /* (20) Analog voltage measure pin */ { BSP_IO_PORT_00_PIN_12, P012 }, /* (21) TX LED */ { BSP_IO_PORT_00_PIN_13, P013 }, /* (22) RX LED */ + + { BSP_IO_PORT_05_PIN_01, P501 }, /* (23) TX on SWD connector */ + { BSP_IO_PORT_05_PIN_02, P502 }, /* (24) RX on SWD connector */ + { BSP_IO_PORT_01_PIN_08, P108 }, /* (25) SWDIO */ + { BSP_IO_PORT_03_PIN_00, P300 }, /* (26) SWCLK */ }; extern "C" const size_t g_pin_cfg_size = sizeof(g_pin_cfg);