-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Access GPIO pins on Raspberry Pi via wiringPi library -- -- This is a Haskell binding to the wiringPi library, which allows -- you to interface with the GPIO pins on the Raspberry Pi. Unlike -- some other solutions for using the Raspberry Pi's GPIO pins, wiringPi -- provides access to more advanced features, such as enabling the -- internal pull-up or pull-down resistors. @package wiringPi @version 1.0 -- | This is a Haskell binding to the wiringPi library. The -- functions here (mostly) correspond directly to the functions in the C -- library, except for how initialization and pin numbering are handled. -- To use this library, you must either run as root, or set the -- WIRINGPI_GPIOMEM environment variable. However, if you set -- WIRINGPI_GPIOMEM, then PWM does not work, so to use -- PWM you must be root. module System.Hardware.WiringPi -- | Represents a pin number. The constructor determines which one -- of the three pin numbering schemes is used. data Pin -- | use wiringPi pin number Wpi :: Int -> Pin -- | use BCM_GPIO numbering (these are the numbers on the Adafruit -- cobbler). Gpio :: Int -> Pin -- | use physical pin numbers on P1 connector Phys :: Int -> Pin -- | Digital logic level. data Value LOW :: Value HIGH :: Value -- | Pin mode, used with pinMode. data Mode -- | digital input INPUT :: Mode -- | digital output OUTPUT :: Mode -- | pulse-width modulation; only supported on wiringPi pin 1 PWM_OUTPUT :: Mode -- | clock output; only supported on wiringPi pin 7 GPIO_CLOCK :: Mode -- | Use with pullUpDnControl to enable internal pull-up or -- pull-down resistor. data Pud -- | disable pull-up/pull-down PUD_OFF :: Pud -- | enable pull-down resistor PUD_DOWN :: Pud -- | enable pull-up resistor PUD_UP :: Pud -- | Argument to pwmSetMode to set "balanced" mode or "mark-space" -- mode. data PwmMode -- | balanced mode PWM_MODE_BAL :: PwmMode -- | mark-space mode PWM_MODE_MS :: PwmMode -- | Value used with pwmWrite. Typically ranges from 0-1024, but the -- range can be increased up to 4096 by calling pwmSetRange. type PwmValue = Word16 -- | Initialize the wiringPi library. This is optional, because it will -- automatically be called on the first use of a wiringPi function. -- Raises an exception if the underlying C function returns an error -- code. However, in practice, the C function wiringPiSetupGpio -- terminates the program on error. Setting the environment variable -- WIRINGPI_CODES is supposed to change this behavior, but in my -- experience it doesn't, and the program is still terminated on error. wiringPiSetupGpio :: IO () pinMode :: Pin -> Mode -> IO () pullUpDnControl :: Pin -> Pud -> IO () digitalRead :: Pin -> IO Value digitalWrite :: Pin -> Value -> IO () -- | Default range is 0-1024, but it can be changed with -- pwmSetRange. pwmWrite :: Pin -> PwmValue -> IO () -- | Write 8 bits to the 8 pins that have wiringPi pin numbers 0-7. digitalWriteByte :: Word8 -> IO () pwmSetMode :: PwmMode -> IO () -- | Change the range used by pwmWrite. Default is 1024. Maxium -- is 4096. pwmSetRange :: PwmValue -> IO () -- | Change the PWM divisor. Range is 2-4095. pwmSetClock :: PwmValue -> IO () piBoardRev :: IO Int -- | Converts a pin to its "Broadcom GPIO" number. This relies on -- unsafePerformIO internally, because the pin mapping depends on -- the board revision. Returns Nothing if the pin number is -- invalid; e. g. it is out of range or is a power or ground pin on the -- physical connector. pinToBcmGpio :: Pin -> Maybe Int instance GHC.Read.Read System.Hardware.WiringPi.Pin instance GHC.Show.Show System.Hardware.WiringPi.Pin instance GHC.Classes.Ord System.Hardware.WiringPi.Pin instance GHC.Classes.Eq System.Hardware.WiringPi.Pin