SerialMux¶
- class serial_mux.serial_mux.SerialMux(device, baudrate=9600, wait=2, log=None)¶
Serial multiplexer.
- Parameters
device (
str
) – Device name.baudrate (
int
) – Baud rate.wait (
int
) – Time in seconds before communication starts.log (
Optional
[BinaryIO
]) – Open writeable handle to a log file.
- read(size)¶
Read from the serial device.
- Size
Number of bytes to read.
- Return type
bytes
- Returns
Virtual serial port and data.
- send(port, data)¶
Send data from a virtual serial device to the serial device.
- Parameters
port (
int
) – Virtual serial port.data (
bytes
) – Data.
- Return type
None
- update()¶
Receive serial data and send it to the corresponding virtual serial device.
- Return type
None