MCPcopy Create free account
hub / github.com/FastLED/FastLED / create_serial_interface

Function create_serial_interface

ci/util/serial_interface.py:243–275  ·  view source on GitHub ↗

Factory function to create the appropriate serial interface. Args: port: Serial port path (e.g., "/dev/ttyUSB0", "COM3") baud_rate: Serial baud rate (default: 115200) use_pyserial: If True, use pyserial directly instead of fbuild auto_reconnect: Enable auto-recon

(
    port: str,
    baud_rate: int = 115200,
    use_pyserial: bool = False,
    auto_reconnect: bool = True,
    verbose: bool = False,
)

Source from the content-addressed store, hash-verified

241
242
243def create_serial_interface(
244 port: str,
245 baud_rate: int = 115200,
246 use_pyserial: bool = False,
247 auto_reconnect: bool = True,
248 verbose: bool = False,
249) -> SerialInterface:
250 """Factory function to create the appropriate serial interface.
251
252 Args:
253 port: Serial port path (e.g., "/dev/ttyUSB0", "COM3")
254 baud_rate: Serial baud rate (default: 115200)
255 use_pyserial: If True, use pyserial directly instead of fbuild
256 auto_reconnect: Enable auto-reconnect (passed to underlying monitor)
257 verbose: Enable verbose debug output
258
259 Returns:
260 SerialInterface implementation (PySerialAdapter or FbuildSerialAdapter)
261 """
262 if use_pyserial:
263 return PySerialAdapter(
264 port=port,
265 baud_rate=baud_rate,
266 auto_reconnect=auto_reconnect,
267 verbose=verbose,
268 )
269 else:
270 return FbuildSerialAdapter(
271 port=port,
272 baud_rate=baud_rate,
273 auto_reconnect=auto_reconnect,
274 verbose=verbose,
275 )

Callers 5

connectMethod · 0.90
main_asyncFunction · 0.90
main_asyncFunction · 0.90
run_sweepFunction · 0.90

Calls 2

PySerialAdapterClass · 0.85
FbuildSerialAdapterClass · 0.85

Tested by 2

main_asyncFunction · 0.72
main_asyncFunction · 0.72