Extract reusable device protocols, ports and logic analyzers from SETGUI
This commit is contained in:
18
python/set_devices/shared_protocol.py
Normal file
18
python/set_devices/shared_protocol.py
Normal file
@@ -0,0 +1,18 @@
|
||||
"""Optional native SETProtocol backend, configured by SETPROTOCOL_LIBRARY."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
def _load():
|
||||
try:
|
||||
from protocan.native import NativeProtocol
|
||||
return NativeProtocol()
|
||||
except (ImportError, OSError, RuntimeError):
|
||||
return None
|
||||
|
||||
|
||||
SHARED_PROTOCOL = _load()
|
||||
|
||||
|
||||
def get_shared_protocol():
|
||||
"""Return SETProtocol, or None for source/test fallback builds."""
|
||||
return SHARED_PROTOCOL
|
||||
Reference in New Issue
Block a user