Skip to content

Commit f922774

Browse files
committed
[genpinmap] Set to NC by default
This allows to build the file without any modification
1 parent 4d1f280 commit f922774

File tree

2 files changed

+15
-11
lines changed

2 files changed

+15
-11
lines changed

src/genpinmap/genpinmap_arduino.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -943,7 +943,7 @@ def print_pinamevar():
943943

944944
# Variant files generation
945945
def spi_pins_variant():
946-
ss_pin = ss1_pin = ss2_pin = ss3_pin = mosi_pin = miso_pin = sck_pin = "PYn"
946+
ss_pin = ss1_pin = ss2_pin = ss3_pin = mosi_pin = miso_pin = sck_pin = "NC"
947947

948948
# Iterate to find match instance if any
949949
for mosi in spimosi_list:
@@ -968,13 +968,13 @@ def spi_pins_variant():
968968
for ss in spissel_list:
969969
ss_inst = ss[2].split("_", 1)[0]
970970
if mosi_inst == ss_inst:
971-
if "PYn" == ss_pin:
971+
if "NC" == ss_pin:
972972
ss_pin = ss[0].replace("_", "", 1)
973-
elif "PYn" == ss1_pin:
973+
elif "NC" == ss1_pin:
974974
ss1_pin = ss[0].replace("_", "", 1)
975-
elif "PYn" == ss2_pin:
975+
elif "NC" == ss2_pin:
976976
ss2_pin = ss[0].replace("_", "", 1)
977-
elif "PYn" == ss3_pin:
977+
elif "NC" == ss3_pin:
978978
ss3_pin = ss[0].replace("_", "", 1)
979979
break
980980
break
@@ -992,7 +992,7 @@ def spi_pins_variant():
992992

993993

994994
def i2c_pins_variant():
995-
sda_pin = scl_pin = "PYn"
995+
sda_pin = scl_pin = "NC"
996996
# Iterate to find match instance if any
997997
for sda in i2csda_list:
998998
sda_inst = sda[2].split("_", 1)[0]
@@ -1042,7 +1042,7 @@ def serial_pins_variant():
10421042
print("No serial instance number found!")
10431043
serialnum = "-1"
10441044
else:
1045-
serialtx_pin = serialtx_pin = "PYn"
1045+
serialtx_pin = serialtx_pin = "NC"
10461046
serialnum = "-1"
10471047
print("No serial found!")
10481048
return dict(instance=serialnum, rx=serialrx_pin, tx=serialtx_pin)

src/genpinmap/templates/variant.h

+8-4
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,12 @@ extern "C" {
4242

4343
// On-board LED pin number
4444
#ifndef LED_BUILTIN
45-
#define LED_BUILTIN PYn
45+
#define LED_BUILTIN NC
4646
#endif
4747

4848
// On-board user button
4949
#ifndef USER_BTN
50-
#define USER_BTN PYn
50+
#define USER_BTN NC
5151
#endif
5252

5353
// SPI definitions
@@ -135,8 +135,12 @@ extern "C" {
135135
//
136136
// SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX
137137
// pins are NOT connected to anything by default.
138-
#define SERIAL_PORT_MONITOR Serial
139-
#define SERIAL_PORT_HARDWARE Serial
138+
#ifndef SERIAL_PORT_MONITOR
139+
#define SERIAL_PORT_MONITOR Serial
140+
#endif
141+
#ifndef SERIAL_PORT_HARDWARE
142+
#define SERIAL_PORT_HARDWARE Serial
143+
#endif
140144
#endif
141145

142146
#endif /* _VARIANT_ARDUINO_STM32_ */

0 commit comments

Comments
 (0)