serialport-0.2.0: Cross platform serial port library.

System.Hardware.Serialport.Posix

Synopsis

Documentation

data StopBits Source

Constructors

One 
Two 

data Parity Source

Constructors

Even 
Odd 
NoParity 

data SerialPort Source

Constructors

SerialPort 

Fields

handle :: Handle
 
timeout :: Int
 

hOpenSerialSource

Arguments

:: String

The filename of the serial port, such as /dev/ttyS0 or /dev/ttyUSB0

-> BaudRate 
-> Word8

The number of bits per word, typically 8

-> StopBits

Almost always One unless you're talking to a printer

-> Parity

Error checking

-> FlowControl 
-> IO Handle 

Open and configure a serial port and return a Handle

openSerialSource

Arguments

:: String

The filename of the serial port, such as /dev/ttyS0 or /dev/ttyUSB0

-> BaudRate 
-> Word8

The number of bits per word, typically 8

-> StopBits

Almost always One unless you're talking to a printer

-> Parity 
-> FlowControl 
-> Int

Receive timeout in milliseconds

-> IO SerialPort 

Open and configure a serial port

recvChar :: SerialPort -> IO (Maybe Char)Source

Possibly receive a character unless the timeout given in openSerial is exceeded.

sendChar :: SerialPort -> Char -> IO ()Source

Send a character

closeSerial :: SerialPort -> IO ()Source

Close the serial port