parport-0.0.0: Simply interfacing the parallel port on linux

System.Hardware.Parport

Contents

Description

Interfacing the parallel port (currently only implemented for linux). This library is supposed to be thread-safe.

Synopsis

Data types

data PP Source

The type of a claimed parallel port. Internally it holds an MVar for threading.

data DD Source

Description of the data-direction for the pins of the data register

Constructors

Input 
Output 

Claiming and releasing the parallel port

claim :: String -> IO PPSource

claim "/dev/parport0" claims the parallel port exclusively and returns a handle.

release :: PP -> IO ()Source

Release a previously claimed parport.

Input/Output

writePin :: PP -> Int -> Bool -> IO ()Source

writePin pp i b sets or clears pin i on pp, depending on the value of b.

writePins :: PP -> [(Int, Bool)] -> IO ()Source

writePins pp l is equal to sequence (map ((i, b) -> writePin pp i b) l) but it is faster.

readPin :: PP -> Int -> IO BoolSource

readPin pp i reads the value of pin i on pp and returns it in the IO monad.

readPins :: PP -> [Int] -> IO [Bool]Source

readPins pp l is equal to sequence (map (readPin pp) l) but it is faster.

Setup

dataDirection :: PP -> DD -> IO ()Source

Set the data direction of the data pins (pin 2-9). On my system, i get an error "bad address". Please mail your experiences to me.

Test/example function

test :: IO ()Source

Run a simple test. View the source for an application example.