Skip to content

Commit

Permalink
[genpinmap] Set to NC by default
Browse files Browse the repository at this point in the history
This allows to build the file without any modification
  • Loading branch information
fpistm committed Feb 19, 2021
1 parent 4d1f280 commit f922774
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
14 changes: 7 additions & 7 deletions src/genpinmap/genpinmap_arduino.py
Original file line number Diff line number Diff line change
Expand Up @@ -943,7 +943,7 @@ def print_pinamevar():

# Variant files generation
def spi_pins_variant():
ss_pin = ss1_pin = ss2_pin = ss3_pin = mosi_pin = miso_pin = sck_pin = "PYn"
ss_pin = ss1_pin = ss2_pin = ss3_pin = mosi_pin = miso_pin = sck_pin = "NC"

# Iterate to find match instance if any
for mosi in spimosi_list:
Expand All @@ -968,13 +968,13 @@ def spi_pins_variant():
for ss in spissel_list:
ss_inst = ss[2].split("_", 1)[0]
if mosi_inst == ss_inst:
if "PYn" == ss_pin:
if "NC" == ss_pin:
ss_pin = ss[0].replace("_", "", 1)
elif "PYn" == ss1_pin:
elif "NC" == ss1_pin:
ss1_pin = ss[0].replace("_", "", 1)
elif "PYn" == ss2_pin:
elif "NC" == ss2_pin:
ss2_pin = ss[0].replace("_", "", 1)
elif "PYn" == ss3_pin:
elif "NC" == ss3_pin:
ss3_pin = ss[0].replace("_", "", 1)
break
break
Expand All @@ -992,7 +992,7 @@ def spi_pins_variant():


def i2c_pins_variant():
sda_pin = scl_pin = "PYn"
sda_pin = scl_pin = "NC"
# Iterate to find match instance if any
for sda in i2csda_list:
sda_inst = sda[2].split("_", 1)[0]
Expand Down Expand Up @@ -1042,7 +1042,7 @@ def serial_pins_variant():
print("No serial instance number found!")
serialnum = "-1"
else:
serialtx_pin = serialtx_pin = "PYn"
serialtx_pin = serialtx_pin = "NC"
serialnum = "-1"
print("No serial found!")
return dict(instance=serialnum, rx=serialrx_pin, tx=serialtx_pin)
Expand Down
12 changes: 8 additions & 4 deletions src/genpinmap/templates/variant.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ extern "C" {

// On-board LED pin number
#ifndef LED_BUILTIN
#define LED_BUILTIN PYn
#define LED_BUILTIN NC
#endif

// On-board user button
#ifndef USER_BTN
#define USER_BTN PYn
#define USER_BTN NC
#endif

// SPI definitions
Expand Down Expand Up @@ -135,8 +135,12 @@ extern "C" {
//
// SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX
// pins are NOT connected to anything by default.
#define SERIAL_PORT_MONITOR Serial
#define SERIAL_PORT_HARDWARE Serial
#ifndef SERIAL_PORT_MONITOR
#define SERIAL_PORT_MONITOR Serial
#endif
#ifndef SERIAL_PORT_HARDWARE
#define SERIAL_PORT_HARDWARE Serial
#endif
#endif

#endif /* _VARIANT_ARDUINO_STM32_ */

0 comments on commit f922774

Please sign in to comment.