serialport-0.3.0: System/Hardware/Serialport.hs
{-# LANGUAGE CPP #-}
-- | Example usage:
--
-- > import System.Hardware.Serialport
-- >
-- > s <- openSerial "/dev/ttyUSB0" defaultSerialSettings
-- > -- or a little different
-- > s <- openSerial "/dev/ttyUSB0" defaultSerialSettings { baudRate = B2400 }
-- >
-- > -- Sending
-- > forM_ "AT\r" $ sendChar s
-- >
-- > -- Receiving, using unfoldM from Control.Monad.Loops
-- > response <- unfoldM (recvChar s)
-- >
-- > print response
-- >
-- > closeSerial s
--
module System.Hardware.Serialport (
-- * Types
BaudRate(..)
,StopBits(..)
,Parity(..)
,FlowControl(..)
,SerialPort
-- * Configure port
-- | You don't need the get or set functions, they are used by openSerial
,SerialPortSettings(..)
,defaultSerialSettings
-- * Serial methods
,openSerial
,sendChar
,recvChar
,closeSerial
) where
#if defined(mingw32_HOST_OS)
import System.Hardware.Serialport.Windows
#elif defined(linux_HOST_OS)
import System.Hardware.Serialport.Posix
import System.Posix.Terminal
#endif
import System.Hardware.Serialport.Types