Skip to content

Commit

Permalink
Merge pull request #183 from kajusK/spi
Browse files Browse the repository at this point in the history
Added spi and fixed FSMC alternate setup
  • Loading branch information
fpoussin committed Feb 11, 2019
2 parents 4bb8aeb + e0e7b42 commit b82dd2d
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tools/mx2board.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,11 @@ def read_project(gpio, filename):
elif 'GPIO_Input' == prop_value:
pads[pad_port][pad_num]["MODER"] = PIN_MODE_INPUT
else:
# workaround for different names in project and gpio defs
if "FSMC" in prop_value:
prop_value = re.sub(r"FSMC_D([0-9]+)_DA[0-9]+",
r"FSMC_D\1", prop_value)

pads[pad_port][pad_num]["SIGNAL"] = prop_value
pads[pad_port][pad_num]["MODER"] = PIN_MODE_ALTERNATE
pads[pad_port][pad_num]["OSPEEDR"] = PIN_OSPEED_MEDIUM
Expand Down Expand Up @@ -316,6 +321,11 @@ def gen_defines(project):
defines['I2C_' + label] = match.group(1)
continue

match = re.search(r"SPI(\d)_(MOSI|MISO|SCK|NSS)", signal)
if match:
defines['SPI_' + label] = match.group(1)
continue

match = re.search(r"CAN(\d*)_[RT]X", signal)
if match:
can = match.group(1)
Expand Down

0 comments on commit b82dd2d

Please sign in to comment.