Skip to content

Commit d13c2b4

Browse files
committed
UNOR4: align analog pins used as digital with R3 definitions
1 parent 2037382 commit d13c2b4

File tree

4 files changed

+36
-40
lines changed

4 files changed

+36
-40
lines changed

variants/MINIMA/pins_arduino.h

+9-9
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@
99
#define NUM_ANALOG_INPUTS (6u)
1010
#define NUM_ANALOG_OUTPUTS (1u)
1111

12-
#define PIN_A0 (16u)
13-
#define PIN_A1 (17u)
14-
#define PIN_A2 (18u)
15-
#define PIN_A3 (19u)
16-
#define PIN_A4 (20u)
17-
#define PIN_A5 (21u)
12+
#define PIN_A0 (14u)
13+
#define PIN_A1 (15u)
14+
#define PIN_A2 (16u)
15+
#define PIN_A3 (17u)
16+
#define PIN_A4 (18u)
17+
#define PIN_A5 (19u)
1818

1919
#define DAC8_HOWMANY (0)
2020
#define DAC12_HOWMANY (1)
@@ -88,8 +88,8 @@ static const uint8_t A5 = PIN_A5;
8888
/****** WIRE CORE DEFINES ******/
8989

9090
#define WIRE_HOWMANY 1
91-
#define WIRE_SDA_PIN 14 /* A4 */
92-
#define WIRE_SCL_PIN 15 /* A5 */
91+
#define WIRE_SDA_PIN 18 /* A4 */
92+
#define WIRE_SCL_PIN 19 /* A5 */
9393

9494
static const uint8_t SDA = WIRE_SDA_PIN;
9595
static const uint8_t SCL = WIRE_SDA_PIN;
@@ -131,7 +131,7 @@ static const uint8_t SS = PIN_SPI_CS;
131131

132132
#define EXT_INTERRUPTS_HOWMANY 2
133133

134-
#define AVCC_MEASURE_PIN 22
134+
#define AVCC_MEASURE_PIN 20
135135
#define AVCC_MULTIPLY_FACTOR 8.33
136136

137137
#define USB_VID (0x2341)

variants/MINIMA/variant.cpp

+7-9
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,14 @@ extern "C" const PinMuxCfg_t g_pin_cfg[] = {
3838
{ BSP_IO_PORT_01_PIN_09, P109 }, /* (11) D11~ */
3939
{ BSP_IO_PORT_01_PIN_10, P110 }, /* (12) D12 */
4040
{ BSP_IO_PORT_01_PIN_11, P111 }, /* (13) D13 */
41-
{ BSP_IO_PORT_01_PIN_01, P101 }, /* (14) D14 */
42-
{ BSP_IO_PORT_01_PIN_00, P100 }, /* (15) D15 */
43-
{ BSP_IO_PORT_00_PIN_14, P014 }, /* (16) A0 -------------------------- ANALOG */
44-
{ BSP_IO_PORT_00_PIN_00, P000 }, /* (17) A1 */
45-
{ BSP_IO_PORT_00_PIN_01, P001 }, /* (18) A2 */
46-
{ BSP_IO_PORT_00_PIN_02, P002 }, /* (19) A3 */
47-
{ BSP_IO_PORT_01_PIN_01, P101 }, /* (20) A4 */
48-
{ BSP_IO_PORT_01_PIN_00, P100 }, /* (21) A5 */
41+
{ BSP_IO_PORT_00_PIN_14, P014 }, /* (14) A0 -------------------------- ANALOG */
42+
{ BSP_IO_PORT_00_PIN_00, P000 }, /* (15) A1 */
43+
{ BSP_IO_PORT_00_PIN_01, P001 }, /* (16) A2 */
44+
{ BSP_IO_PORT_00_PIN_02, P002 }, /* (17) A3 */
45+
{ BSP_IO_PORT_01_PIN_01, P101 }, /* (18) A4/SDA */
46+
{ BSP_IO_PORT_01_PIN_00, P100 }, /* (19) A5/SCL */
4947

50-
{ BSP_IO_PORT_05_PIN_00, P500 }, /* (22) Analog voltage measure pin */
48+
{ BSP_IO_PORT_05_PIN_00, P500 }, /* (20) Analog voltage measure pin */
5149
};
5250

5351
extern "C" const size_t g_pin_cfg_size = sizeof(g_pin_cfg);

variants/UNOWIFIR4/pins_arduino.h

+9-9
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@
99
#define NUM_ANALOG_INPUTS (6u)
1010
#define NUM_ANALOG_OUTPUTS (1u)
1111

12-
#define PIN_A0 (16u)
13-
#define PIN_A1 (17u)
14-
#define PIN_A2 (18u)
15-
#define PIN_A3 (19u)
16-
#define PIN_A4 (20u)
17-
#define PIN_A5 (21u)
12+
#define PIN_A0 (14u)
13+
#define PIN_A1 (15u)
14+
#define PIN_A2 (16u)
15+
#define PIN_A3 (17u)
16+
#define PIN_A4 (18u)
17+
#define PIN_A5 (19u)
1818

1919
#define DAC8_HOWMANY (0)
2020
#define DAC12_HOWMANY (1)
@@ -92,8 +92,8 @@ static const uint8_t A5 = PIN_A5;
9292
/****** WIRE CORE DEFINES ******/
9393

9494
#define WIRE_HOWMANY 2
95-
#define WIRE_SDA_PIN 14 /* A4 */
96-
#define WIRE_SCL_PIN 15 /* A5 */
95+
#define WIRE_SDA_PIN 18 /* A4 */
96+
#define WIRE_SCL_PIN 19 /* A5 */
9797
#define WIRE1_SDA_PIN 27
9898
#define WIRE1_SCL_PIN 26
9999

@@ -135,7 +135,7 @@ static const uint8_t SS = PIN_SPI_CS;
135135

136136
#define EXT_INTERRUPTS_HOWMANY 2
137137

138-
#define AVCC_MEASURE_PIN 39
138+
#define AVCC_MEASURE_PIN 20
139139
#define AVCC_MULTIPLY_FACTOR 8.33
140140

141141
#define USB_VID (0x2341)

variants/UNOWIFIR4/variant.cpp

+11-13
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,15 @@ extern "C" const PinMuxCfg_t g_pin_cfg[] = {
3838
{ BSP_IO_PORT_04_PIN_11, P411 }, /* (11) D11~ */
3939
{ BSP_IO_PORT_04_PIN_10, P410 }, /* (12) D12 */
4040
{ BSP_IO_PORT_01_PIN_02, P102 }, /* (13) D13 */
41-
{ BSP_IO_PORT_01_PIN_01, P101 }, /* (14) D14 */
42-
{ BSP_IO_PORT_01_PIN_00, P100 }, /* (15) D15 */
43-
{ BSP_IO_PORT_00_PIN_14, P014 }, /* (16) A0 -------------------------- ANALOG */
44-
{ BSP_IO_PORT_00_PIN_00, P000 }, /* (17) A1 */
45-
{ BSP_IO_PORT_00_PIN_01, P001 }, /* (18) A2 */
46-
{ BSP_IO_PORT_00_PIN_02, P002 }, /* (19) A3 */
47-
{ BSP_IO_PORT_01_PIN_01, P101 }, /* (20) A4 */
48-
{ BSP_IO_PORT_01_PIN_00, P100 }, /* (21) A5 */
41+
{ BSP_IO_PORT_00_PIN_14, P014 }, /* (14) A0 -------------------------- ANALOG */
42+
{ BSP_IO_PORT_00_PIN_00, P000 }, /* (15) A1 */
43+
{ BSP_IO_PORT_00_PIN_01, P001 }, /* (16) A2 */
44+
{ BSP_IO_PORT_00_PIN_02, P002 }, /* (17) A3 */
45+
{ BSP_IO_PORT_01_PIN_01, P101 }, /* (18) A4/SDA */
46+
{ BSP_IO_PORT_01_PIN_00, P100 }, /* (19) A5/SCL */
47+
48+
{ BSP_IO_PORT_05_PIN_00, P500 }, /* (20) Analog voltage measure pin */
49+
{ BSP_IO_PORT_04_PIN_08, P408 }, /* (21) USB switch, drive high for RA4 */
4950

5051
{ BSP_IO_PORT_01_PIN_09, P109 }, /* (22) D22 ------------------------ TX */
5152
{ BSP_IO_PORT_01_PIN_10, P110 }, /* (23) D23 ------------------------ RX */
@@ -66,9 +67,6 @@ extern "C" const PinMuxCfg_t g_pin_cfg[] = {
6667
{ BSP_IO_PORT_02_PIN_06, P206 }, /* (36) D36 */
6768
{ BSP_IO_PORT_02_PIN_12, P212 }, /* (37) D37 */
6869
{ BSP_IO_PORT_02_PIN_13, P213 }, /* (38) D38 */
69-
70-
{ BSP_IO_PORT_05_PIN_00, P500 }, /* (39) Analog voltage measure pin */
71-
{ BSP_IO_PORT_04_PIN_08, P408 }, /* (40) USB switch, drive high for RA4 */
7270
};
7371

7472
extern "C" const size_t g_pin_cfg_size = sizeof(g_pin_cfg);
@@ -94,8 +92,8 @@ void configure_usb_mux() {
9492
(*((volatile uint32_t *) &R_SYSTEM->VBTBKR[1])) = 40;
9593
R_SYSTEM->PRCR = (uint16_t) BSP_PRV_PRCR_LOCK;
9694

97-
pinMode(40, OUTPUT);
98-
digitalWrite(40, HIGH);
95+
pinMode(21, OUTPUT);
96+
digitalWrite(21, HIGH);
9997
}
10098

10199
#include "FspTimer.h"

0 commit comments

Comments
 (0)