55from collections import defaultdict
66from ...html import Document
77from ...utils import cache_path , ext_path
8- from .datasheet import DatasheetMicro , DatasheetSensor
8+ from .datasheet_stm32 import DatasheetStm32
9+ from .datasheet_sensor import DatasheetSensor
910from .reference import ReferenceManual
1011from ...owl import DeviceIdentifier
1112from ...owl .stmicro import did_from_string
@@ -27,15 +28,15 @@ def load_documents() -> list:
2728 # FIXME: Better detection that DS13252 is a STM32WB55 module, not a chip!
2829 if any ("STM32" in h .html for h in chap [0 ].headings ()) and \
2930 "DS13252" not in doc .name and "DS14096" not in doc .name :
30- documents [doc .name ][doc .version ] = DatasheetMicro (path )
31+ documents [doc .name ][doc .version ] = DatasheetStm32 (path )
3132 else :
3233 documents [doc .name ][doc .version ] = DatasheetSensor (path )
3334 elif "RM" in doc .name :
3435 documents [doc .name ][doc .version ] = ReferenceManual (path )
3536 return documents
3637
3738
38- def load_document_devices (use_cached = True ) -> tuple [dict [DeviceIdentifier , DatasheetMicro ],
39+ def load_document_devices (use_cached = True ) -> tuple [dict [DeviceIdentifier , DatasheetStm32 ],
3940 dict [DeviceIdentifier , ReferenceManual ]]:
4041 global DOCUMENT_CACHE
4142 if DOCUMENT_CACHE is not None :
@@ -48,7 +49,7 @@ def load_document_devices(use_cached=True) -> tuple[dict[DeviceIdentifier, Datas
4849
4950 docs = {}
5051 for path in set (json_data ["ds" ].values ()):
51- docs [path ] = DatasheetMicro (path )
52+ docs [path ] = DatasheetStm32 (path )
5253 for path in set (json_data ["rm" ].values ()):
5354 docs [path ] = ReferenceManual (path )
5455 datasheets = {did_from_string (did ): docs [path ]
@@ -63,7 +64,7 @@ def load_document_devices(use_cached=True) -> tuple[dict[DeviceIdentifier, Datas
6364 doc = list (versions .values ())[- 1 ]
6465 # print(doc.path_pdf.relative_to(Path().cwd()), doc.path.relative_to(Path().cwd()))
6566 # print(doc.devices)
66- if isinstance (doc , DatasheetMicro ):
67+ if isinstance (doc , DatasheetStm32 ):
6768 if not doc .devices :
6869 raise ValueError (f"{ doc } has no associated devices!" )
6970 for dev in doc .devices :
@@ -120,7 +121,7 @@ def _document_for_device(did: DeviceIdentifier, documents):
120121 return None
121122
122123
123- def datasheet_for_device (did : DeviceIdentifier ) -> DatasheetMicro :
124+ def datasheet_for_device (did : DeviceIdentifier ) -> DatasheetStm32 :
124125 datasheets , _ = load_document_devices ()
125126 return _document_for_device (did , datasheets )
126127
0 commit comments