- data BaudRate
- data StopBits
- data Parity
- data FlowControl
- data SerialPort
- data SerialPortSettings = SerialPortSettings {
- baudRate :: BaudRate
- bitsPerWord :: Word8
- stopb :: StopBits
- parity :: Parity
- flowControl :: FlowControl
- timeout :: Int
- defaultSerialSettings :: SerialPortSettings
- openSerial :: FilePath -> SerialPortSettings -> IO SerialPort
- sendChar :: SerialPort -> Char -> IO ()
- recvChar :: SerialPort -> IO (Maybe Char)
- closeSerial :: SerialPort -> IO ()
- setDTR :: SerialPort -> Bool -> IO ()
Types
data BaudRate
data SerialPort Source
Configure port
You don't need the get or set functions, they are used by openSerial
data SerialPortSettings Source
SerialPortSettings | |
|
defaultSerialSettings :: SerialPortSettingsSource
Most commonly used configuration
- 9600 baud
- 8 data bits
- 1 stop bit
- no parity
- no flow control
- 0.1 millisecond receive timeout
Serial methods
:: FilePath | The filename of the serial port, such as |
-> SerialPortSettings | |
-> 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.
closeSerial :: SerialPort -> IO ()Source
Close the serial port