Skip to content

Commit 06ce8f0

Browse files
chris-durandsalkinium
authored andcommitted
[st] Select correct header for STM32H7 devices
1 parent eb97711 commit 06ce8f0

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

ext/st/module.lb

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,19 @@ def getDefineForDevice(device_id, familyDefines):
3636
deviceDefines.sort(key=lambda d: (d[:minlen], d[minlen:]))
3737

3838
# now we match for the size-id (and variant-id if applicable).
39-
devNameMatch = devName + "x{}".format(device_id.size.upper())
39+
if device_id.family == "h7":
40+
devNameMatch = devName + "xx"
41+
else:
42+
devNameMatch = devName + "x{}".format(device_id.size.upper())
4043
if device_id.family == "l1":
4144
# Map STM32L1xxQC and STM32L1xxZC -> STM32L162QCxA variants
4245
if device_id.pin in ["q", "z"] and device_id.size == "c":
4346
devNameMatch += "A"
4447
else:
4548
devNameMatch += device_id.variant.upper()
49+
elif device_id.family == "h7":
50+
if device_id.variant:
51+
devNameMatch += device_id.variant.upper()
4652
for define in deviceDefines:
4753
if devNameMatch <= define:
4854
return define
@@ -120,7 +126,7 @@ def common_header_file(env):
120126
define = None
121127

122128
content = Path(localpath(folder, family_header)).read_text(encoding="utf-8", errors="replace")
123-
match = re.findall(r"if defined\((?P<define>STM32[F|L|G][\w\d]+)\)", content)
129+
match = re.findall(r"if defined\((?P<define>STM32[FLGH][\w\d]+)\)", content)
124130
define = getDefineForDevice(device.identifier, match)
125131
if define is None or match is None:
126132
raise ValidateException("No device define found for '{}'!".format(device.partname))

0 commit comments

Comments
 (0)