DancingQuanta / pyusbiss

Python API for USB-ISS Multifunction USB Communications Module
MIT License
2 stars 3 forks source link

Add serial support #9

Open DancingQuanta opened 6 years ago

gwdehaan commented 5 years ago

SERIAL

Usage

from usbiss import usbiss
from usbiss import serial

Port = 'COM3'

usbissdev = usbiss.USBISS(Port)
serport = serial.SERIAL(usbissdev)

serport.serial_write('Serial write test\n')

Methods

Method Description
in_waiting Returns the number of bytes in the inputbuffer
out_waiting Returns the number of bytes in the outputbuffer
serial_write(data) Write data to the serial pins of the USBISS data - data to be send.
serial_read(size) Read size bytes from the USBISS serial size - number of bytes to read Returns - string of size bytes
readline() Read line from the USBISS serial. Returns - string up until the first \n

Extra

Tests

Test Description
testserialloopback.py Loopback test by connecting the Rx and Tx pins of the USBISS, the outputbuffer of the USBISS holds a maximum of 30 bytes. It is not possible to send more bytes in this loopback setup
testserialloopback - GPIO.py Same as testserialloopback.py but combined with the GPIO functionality of the USBISS.
testserialotherclient.py Loopback test by connecting the Rx and Tx pins to a FTDI device. This Device is used by with the SerialClient.py script to perform the loopback. With this test data that exceeds 30 bytes, the maximum size of the USBISS writebuffer, can be send and tested.
testserialotherclient - GPIO.py Same as testserialotherclient.py but combined with the GPIO functionality of the USBISS.

References

www.robot-electronics.co.uk/htm/usb_iss_serial_tech.htm https://pythonhosted.org/pyserial/