serialport 0.4.1 → 0.4.2
raw patch · 4 files changed
+26/−3 lines, 4 filesdep ~base
Dependency ranges changed: base
Files
- System/Hardware/Serialport.hs +11/−0
- System/Hardware/Serialport/Posix.hsc +6/−0
- System/Hardware/Serialport/Windows.hs +6/−0
- serialport.cabal +3/−3
System/Hardware/Serialport.hs view
@@ -28,11 +28,13 @@ -- ** Device ,openSerial ,closeSerial+ ,withSerial -- ** Sending & receiving ,sendChar ,sendString ,recvChar ,recvString+ ,flush -- ** Line control ,setDTR ,setRTS@@ -44,3 +46,12 @@ import System.Hardware.Serialport.Posix #endif import System.Hardware.Serialport.Types+++-- |Safer device function, so you don't forget to close the device+withSerial :: String -> SerialPortSettings -> ( SerialPort -> IO a ) -> IO a+withSerial dev settings f = do+ s <- openSerial dev settings+ res <- f s+ closeSerial s+ return res
System/Hardware/Serialport/Posix.hsc view
@@ -51,6 +51,12 @@ fdWrite fd' s >> return () +-- |Flush buffers+flush :: SerialPort -> IO ()+flush (SerialPort fd' _) =+ discardData fd' BothQueues++ -- |Close the serial port closeSerial :: SerialPort -> IO () closeSerial (SerialPort fd' _ ) =
System/Hardware/Serialport/Windows.hs view
@@ -75,6 +75,12 @@ overlapped = Nothing +-- |Flush buffers+flush :: SerialPort -> IO ()+flush (SerialPort h _) =+ flushFileBuffers h++ -- |Close the serial port closeSerial :: SerialPort -> IO () closeSerial (SerialPort h _) =
serialport.cabal view
@@ -1,10 +1,10 @@ Name: serialport-Version: 0.4.1+Version: 0.4.2 Cabal-Version: >= 1.6 Build-Type: Custom license: BSD3 license-file: LICENSE-copyright: (c) 2009 Joris Putcuyps+copyright: (c) 2009-2011 Joris Putcuyps author: Joris Putcuyps maintainer: Joris.Putcuyps@gmail.com homepage: https://github.com/jputcu/serialport@@ -20,7 +20,7 @@ Library Exposed-Modules: System.Hardware.Serialport Other-Modules: System.Hardware.Serialport.Types- Build-Depends: base >= 4, base < 5+ Build-Depends: base >= 4 && < 5 ghc-options: -Wall if !os(windows)