| Copyright | (c) 2018 Drew Hess |
|---|---|
| License | BSD3 |
| Maintainer | Drew Hess <src@drewhess.com> |
| Stability | experimental |
| Portability | non-portable |
| Safe Haskell | Trustworthy |
| Language | Haskell2010 |
System.GPIO.Types
Description
Basic GPIO types.
Synopsis
- newtype Pin = Pin Int
- data PinInputMode
- data PinOutputMode
- data PinCapabilities = PinCapabilities {}
- data PinDirection
- data PinActiveLevel
- data PinValue
- data PinInterruptMode
- pinNumber :: Pin -> Int
- invertDirection :: PinDirection -> PinDirection
- invertValue :: PinValue -> PinValue
- valueToBool :: PinValue -> Bool
- boolToValue :: Bool -> PinValue
- data SomeGpioException = Exception e => SomeGpioException e
- gpioExceptionToException :: Exception e => e -> SomeException
- gpioExceptionFromException :: Exception e => SomeException -> Maybe e
GPIO pins
A GPIO pin, identified by pin number.
Note that GPIO pin numbering is platform- and runtime-dependent. See the documentation for your particular platform for an explanation of how pin numbers are assigned to physical pins.
Instances
| Bounded Pin Source # | |
| Enum Pin Source # | |
| Eq Pin Source # | |
| Data Pin Source # | |
Defined in System.GPIO.Types Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Pin -> c Pin # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Pin # dataTypeOf :: Pin -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Pin) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Pin) # gmapT :: (forall b. Data b => b -> b) -> Pin -> Pin # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Pin -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Pin -> r # gmapQ :: (forall d. Data d => d -> u) -> Pin -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Pin -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Pin -> m Pin # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Pin -> m Pin # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Pin -> m Pin # | |
| Ord Pin Source # | |
| Read Pin Source # | |
| Show Pin Source # | |
| Ix Pin Source # | |
| Generic Pin Source # | |
| Arbitrary Pin Source # | |
| type Rep Pin Source # | |
Defined in System.GPIO.Types | |
data PinInputMode Source #
GPIO pins may support a number of different physical configurations when used as a digital input.
Pins that are capable of input will at least support the
InputDefault mode. InputDefault mode is special in that, unlike
the other input modes, it does not represent a unique physical
configuration, but is simply a pseudonym for another (actual) input
mode. Exactly which mode is used by the hardware when
InputDefault mode is specified is platform-dependent. By using
InputDefaut mode, you are saying that you don't care about the
pin's actual configuration, other than the fact that it's being
used for input.
Constructors
| InputDefault | The pin's default input mode, i.e., the mode used when a more specific mode is not specified |
| InputFloating | A floating / high-impedance / tri-state mode which uses little power, but when disconnected, may cause the pin's value to be indeterminate |
| InputPullUp | The pin is connected to an internal pull-up resistor such
that, when the pin is disconnected or connected to a floating /
high-impedance node, its physical value will be |
| InputPullDown | The pin is connected to an internal pull-down resistor such
that, when the pin is disconnected or connected to a floating /
high-impedance node, its physical value will be |
Instances
data PinOutputMode Source #
GPIO pins may support a number of different physical configurations when used as a digital output.
Pins that are capable of output will at least support the
OutputDefault mode. OutputDefault mode is special in that,
unlike the other output modes, it does not represent a unique
physical configuration, but is simply a pseudonym for another
(actual) output mode. Exactly which mode is used by the hardware
when OutputDefault mode is specified is platform-dependent. By
using OutputDefaut mode, you are saying that you don't care about
the pin's actual configuration, other than the fact that it's being
used for output.
Constructors
| OutputDefault | The pin's default output mode, i.e., the mode used when a more specific mode is not specified |
| OutputPushPull | |
| OutputOpenDrain | The output actively drives the |
| OutputOpenDrainPullUp | The output actively drives the |
| OutputOpenSource | The output actively drives the |
| OutputOpenSourcePullDown | The output actively drives the |
Instances
data PinCapabilities Source #
Catalog a pin's capabilities.
Constructors
| PinCapabilities | |
Fields
| |
Instances
data PinDirection Source #
A pin's direction (input/output).
Instances
data PinActiveLevel Source #
A pin's active level (active-high/active-low).
Constructors
| ActiveLow | |
| ActiveHigh |
Instances
A pin's signal level as a binary value.
Instances
data PinInterruptMode Source #
A pin's interrupt mode.
Note that the pin's interrupt mode is defined in terms of the pin's
logical signal value; i.e., when the pin is configured for
active-low logic, RisingEdge refers to the physical signal's
trailing edge, and FallingEdge refers to the physical signal's
rising edge.
Constructors
| Disabled | Interrupts are disabled |
| RisingEdge | Interrupt on the pin's (logical) rising edge |
| FallingEdge | Interrupt on the pin's (logical) falling edge |
| Level | Interrupt on any change to the pin's signal level |
Instances
Convenience functions
invertDirection :: PinDirection -> PinDirection Source #
Invert a PinDirection value.
>>>invertDirection InOut>>>invertDirection OutIn
invertValue :: PinValue -> PinValue Source #
Invert a PinValue.
>>>invertValue HighLow>>>invertValue LowHigh
PinValue conversion to/from Bool
valueToBool :: PinValue -> Bool Source #
Convert a PinValue to its logical boolean equivalent.
>>>valueToBool HighTrue>>>valueToBool LowFalse
boolToValue :: Bool -> PinValue Source #
GPIO exceptions
data SomeGpioException Source #
The top level of the GPIO exception hierarchy.
Constructors
| Exception e => SomeGpioException e |
Instances
| Show SomeGpioException Source # | |
Defined in System.GPIO.Types Methods showsPrec :: Int -> SomeGpioException -> ShowS # show :: SomeGpioException -> String # showList :: [SomeGpioException] -> ShowS # | |
| Exception SomeGpioException Source # | |
Defined in System.GPIO.Types Methods toException :: SomeGpioException -> SomeException # | |
gpioExceptionToException :: Exception e => e -> SomeException Source #
Convert SomeGpioException to SomeException.
gpioExceptionFromException :: Exception e => SomeException -> Maybe e Source #
Ask whether an exception is SomeGpioException.