bpod_core.com.SerialDevice
- class bpod_core.com.SerialDevice
Bases:
AbstractContextManagerClass that interfaces with a USB serial device.
- __init__(port, serial_device_name='serial_device', *, open_connection=True, **kwargs) None
Initialize the serial device.
- Parameters:
port (
str) – The serial port device path (e.g., ‘/dev/ttyUSB0’ or ‘COM3’).serial_device_name (
str, optional) – Name used to identify this device in log messages, by default'serial_device'.open_connection (
bool, optional) – Whether to open the connection immediately, by default True.**kwargs (
Any) – Additional arguments for compatibility with subclasses.
- Raises:
serial.SerialException – If the specified port does not exist.
- Return type:
None
- close() None
Close the serial connection.
If the connection is already closed, this method does nothing.
- Raises:
serial.SerialException – If the connection cannot be closed.
- Return type:
- open() None
Open the serial connection.
If the connection is already open, this method does nothing.
- Raises:
serial.SerialException – If the connection cannot be opened.
- Return type: