Serial provides access to serial ports on POSIX compatible
systems. The utility functions in System.Serial are in
line-at-a-time mode by default, but you can set other, more raw
hSetBuffering from System.IO. The serial port
managers in System.Serial.Manager and
System.Serial.BlockingManager only work with line-at-a-time mode.
Most devices hanging off of serial ports today work by reading and writing commands. In many cases, commands are non-blocking and you can send additional commands before you receive the response to the last one. System.Serial.SerialManager provides a wrapper around this access which tries to match up responses to waiting functions which have called it.
The only function here is
openSerial, since thereafter the normal
functions from System.IO such as
hPutStr work normally. Just be sure you send the right end of
line sequence for your hardware! Some devices want CR-LF, others
just LF, others just CR, and they may return their results using a
different end of line than they accept.
The filename of the serial port, such as
The number of bits per word, typically 8
|-> IO Handle|
openSerial opens the serial port and sets the options the user
passes, makes its buffering line oriented, and returns the handle
to control it. For example, an Olympus IX-81 microscope attached
to the first serial port on Linux would be opened with
openSerial "/dev/ttyS0" B19200 8 One Even Software
Serial lets the user set the number of stop bits, the parity,
flow control (there is no hardware flow control, since it isn't
supported in the System.Posix.IO library), number of bits per
byte, and the baud rate. The baud rate is declared by the
BaudRate in System.Posix.Terminal.
FlowControl are defined here.