summaryrefslogtreecommitdiff
path: root/README.txt
diff options
context:
space:
mode:
authorcliechti <cliechti@f19166aa-fa4f-0410-85c2-fa1106f25c8a>2002-05-26 01:20:22 +0000
committercliechti <cliechti@f19166aa-fa4f-0410-85c2-fa1106f25c8a>2002-05-26 01:20:22 +0000
commit2e34f7cb144c7959b5c12dff6e6b9a0f10e8f465 (patch)
tree810ad46a1034625f8ed49c7a03a5eac4a3d332b7 /README.txt
parente90121a5f4e3d9066acf7bdd01654cba69959c50 (diff)
downloadpyserial-2e34f7cb144c7959b5c12dff6e6b9a0f10e8f465.tar.gz
added non-blocking mode
fixed win32 version: no data is lost when a timeout occours typos in the docs git-svn-id: http://svn.code.sf.net/p/pyserial/code/trunk/pyserial@32 f19166aa-fa4f-0410-85c2-fa1106f25c8a
Diffstat (limited to 'README.txt')
-rw-r--r--README.txt46
1 files changed, 37 insertions, 9 deletions
diff --git a/README.txt b/README.txt
index 1717024..d3022a9 100644
--- a/README.txt
+++ b/README.txt
@@ -1,9 +1,9 @@
pySerial
--------
This module capsulates the access for the serial port. It provides backends
-for stadard Python running on Windows, Linux, BSD (possibly any POSIX
+for standard Python running on Windows, Linux, BSD (possibly any POSIX
compilant system) and Jython. The module named "serial" automaticaly selects
-the appropriate backed.
+the appropriate backend.
It is released under a free software license, see LICENSE.txt for more
details.
@@ -15,12 +15,12 @@ Project Homepage: pyserial.sourceforge.net
Features
--------
- same class based interface on all supported platforms
-- port numbering starts at zero, no need to know the port name in the user
- program
-- port string can be specified if access through numbering is inappropriate
-- support for diffrent bytesizes, stopbits, parity and flow control
+- port numbering starts at zero, no need to know the platform dependant port
+ name in the user program
+- port name can be specified if access through numbering is inappropriate
+- support for different bytesizes, stopbits, parity and flow control
with RTS/CTS and/or xon/xoff
-- working with or without receive timeout
+- working with or without receive timeout, blocking or non-blocking
- file like API with "read" and "write" ("readline" etc. also supported)
- The files in this package are 100% pure Python.
They depend on non standard but common packages on Windows (win32all) and
@@ -56,14 +56,20 @@ Open port 0 at 9600,8,N,1, no timeout
>>> ser.write("hello") #write a string
>>> ser.close() #close port
-Open port at 19200,8,N,1, 1s timeout
+Open named port at 19200,8,N,1, 1s timeout
>>> ser = serial.Serial('/dev/ttyS1', 19200, timeout=1)
>>> x = ser.read() #read one byte
>>> s = ser.read(10) #read up to ten bytes (timeout)
>>> line = ser.readline() #read a \n terminated line
>>> ser.close()
-Be carfully when using "readline" do specify a timeout when
+Open second port at 38400,8,E,1, non blocking HW handshaking
+>>> ser = serial.Serial(1, 38400, timeout=0,
+... parity=serial.PARITY_EVEN, rtscts=1)
+>>> s = ser.read(100) #read up to one hunded bytes
+... #or as much is in the buffer
+
+Be carefully when using "readline". Do specify a timeout when
opening the serial port otherwise it could block forever if
no newline character is received. Also note that "readlines" only
works with a timeout. "readlines" depends on having a timeout
@@ -87,6 +93,28 @@ ser = serial.Serial(
rtscts=0, #enable RTS/CTS flow control
)
+The port is immediatley opened on object creation. Options:
+timeout=None # wait forever
+timeout=0 #non-blocking mode (return immediately on read)
+timeout=x #set timeout to x seconds (float allowed)
+
+Serial object Methods
+---------------------
+close() #close port immediately
+setBaudrate(baudrate) #change baudarte on an open port
+inWaiting() #return the number of chars in the receive buffer
+read(size=1) #read "size" characters
+write(s) #write the string to the port
+flushInput() #flush input buffer
+flushOutput() #flush output buffer
+sendBreak() #send break condition
+setRTS(level=1) #set RTS line to specified logic level
+setDTR(level=1) #set DTR line to specified logic level
+getCTS() #return the state of the CTS line
+getDSR() #return the state of the DSR line
+getRI() #return the state of the RI line
+getCD() #return the state of the CD line
+
Constants
---------
parity: