def Serial(baudrate, port='/dev/ttyACM1', timeout=1): if (port is '/dev/ttyACM1'): # Switch GPIO to UART on WeIO, this is not necessary if some other port is asked initSerial() return serial.Serial(port, baudrate, timeout=timeout)
def __init__(self): dev = "/dev/lpcUart" ser = initSerial(dev, 9600) ser.close() self.bus = UART_Adapter(dev)
def Serial(baudrate, port='/dev/ttyACM1', timeout=1): if (port is '/dev/ttyACM1'): # Switch GPIO to UART on WeIO, this is not necessary if some other port is asked return initSerial(port, baudrate, timeout=timeout) else : return serial.Serial(port, baudrate, timeout=timeout)