Copyright | (c) 2016 Drew Hess |
---|---|
License | BSD3 |
Maintainer | Drew Hess <src@drewhess.com> |
Stability | experimental |
Portability | non-portable |
Safe Haskell | Safe |
Language | Haskell2010 |
Types used by the various Linux sysfs
GPIO implementations.
- data SysfsEdge
- toPinInterruptMode :: SysfsEdge -> PinInterruptMode
- toSysfsEdge :: PinInterruptMode -> SysfsEdge
- data SysfsException
- = SysfsNotPresent
- | SysfsError
- | SysfsPermissionDenied
- | PermissionDenied Pin
- | InvalidOperation Pin
- | AlreadyExported Pin
- | InvalidPin Pin
- | NotExported Pin
- | UnsupportedInputMode PinInputMode Pin
- | UnsupportedOutputMode PinOutputMode Pin
- | NoDirectionAttribute Pin
- | NoEdgeAttribute Pin
- | UnexpectedDirection Pin String
- | UnexpectedValue Pin String
- | UnexpectedEdge Pin String
- | UnexpectedActiveLow Pin String
- | UnexpectedContents FilePath String
- | InternalError String
sysfs
-specific types
Linux GPIO pins that can be configured to generate inputs have an
edge
attribute in the sysfs
GPIO filesystem. This type
represents the values that the edge
attribute can take.
Note that in Linux sysfs
GPIO, the signal edge referred to by the
edge
attribute refers to the signal's logical value; i.e., it
takes into account the value of the pin's active_low
attribute.
This type is isomorphic to the PinInterruptMode
type. See
toPinInterruptMode
and toSysfsEdge
.
toPinInterruptMode :: SysfsEdge -> PinInterruptMode Source #
Convert a SysfsEdge
value to its equivalent PinInterruptMode
value.
>>>
toPinInterruptMode None
Disabled>>>
toPinInterruptMode Rising
RisingEdge>>>
toPinInterruptMode Falling
FallingEdge>>>
toPinInterruptMode Both
Level
toSysfsEdge :: PinInterruptMode -> SysfsEdge Source #
Convert a PinInterruptMode
value to its equivalent SysfsEdge
value.
>>>
toSysfsEdge Disabled
None>>>
toSysfsEdge RisingEdge
Rising>>>
toSysfsEdge FallingEdge
Falling>>>
toSysfsEdge Level
Both
Exceptions
data SysfsException Source #
Exceptions that can be thrown by sysfs
computations (in
addition to standard IOError
exceptions, of
course).
The UnexpectedX
values are truly exceptional and mean that, while
the sysfs
attribute for the given pin exists, the contents of the
attribute do not match any expected value for that attribute, which
probably means that the package is incompatible with the sysfs
filesystem due to a kernel-level change.
SysfsNotPresent | The |
SysfsError | Something in the |
SysfsPermissionDenied | The |
PermissionDenied Pin | The operation on the specified pin is not permitted, either due to insufficient permissions, or because the pin's attribute cannot be modified (e.g., trying to write to a pin that's configured for input) |
InvalidOperation Pin | The operation is invalid for the specified pin, or in the specified pin's current configuration |
AlreadyExported Pin | The pin has already been exported |
InvalidPin Pin | The specified pin does not exist |
NotExported Pin | The pin has been un-exported or does not exist |
UnsupportedInputMode PinInputMode Pin | The pin does not support the specified input mode |
UnsupportedOutputMode PinOutputMode Pin | The pin does not support the specified output mode |
NoDirectionAttribute Pin | The pin does not have a |
NoEdgeAttribute Pin | The pin does not have an |
UnexpectedDirection Pin String | An unexpected value was read from the pin's |
UnexpectedValue Pin String | An unexpected value was read from the pin's |
UnexpectedEdge Pin String | An unexpected value was read from the pin's |
UnexpectedActiveLow Pin String | An unexpected value was read from the pin's |
UnexpectedContents FilePath String | An unexpected value was read from the specified file |
InternalError String | An internal error has occurred in the interpreter, something which should "never happen" and should be reported to the package maintainer |