Serial Port IO Interface

The serial port IO interface.

class larpix.io.serialport.SerialPort(port=None, baudrate=1000000, timeout=0)[source]

Wrapper for various serial port interfaces across platforms.

Automatically loads correct driver based on the supplied port name:

  • '/dev/anything' ==> Linux ==> pySerial
  • 'scan-ftdi' ==> MacOS ==> libFTDI
static encode(packets)[source]

Encodes a list of packets into a list of bytestream messages

static decode(msgs)[source]

Decodes a list of serial port bytestreams to packets

send(packets)[source]

Format the packets as a bytestream and send it to the FPGA and on to the LArPix ASICs.

start_listening()[source]

Start listening for incoming LArPix data by opening the serial port.

stop_listening()[source]

Stop listening for LArPix data by closing the serial port.

empty_queue()[source]

Empty the incoming data buffer and return (packets, bytestream).

larpix.io.serialport.enable_logger(filename=None)[source]

Enable serial data logger

larpix.io.serialport.disable_logger()[source]

Disable serial data logger

larpix.io.serialport.flush_logger()[source]

Flush serial data logger data to output file