@@ -36,13 +36,19 @@ def getDefineForDevice(device_id, familyDefines):
36
36
deviceDefines .sort (key = lambda d : (d [:minlen ], d [minlen :]))
37
37
38
38
# 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 ())
40
43
if device_id .family == "l1" :
41
44
# Map STM32L1xxQC and STM32L1xxZC -> STM32L162QCxA variants
42
45
if device_id .pin in ["q" , "z" ] and device_id .size == "c" :
43
46
devNameMatch += "A"
44
47
else :
45
48
devNameMatch += device_id .variant .upper ()
49
+ elif device_id .family == "h7" :
50
+ if device_id .variant :
51
+ devNameMatch += device_id .variant .upper ()
46
52
for define in deviceDefines :
47
53
if devNameMatch <= define :
48
54
return define
@@ -120,7 +126,7 @@ def common_header_file(env):
120
126
define = None
121
127
122
128
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 )
124
130
define = getDefineForDevice (device .identifier , match )
125
131
if define is None or match is None :
126
132
raise ValidateException ("No device define found for '{}'!" .format (device .partname ))
0 commit comments