Gpio Class
This file defines the gpio interface for libmraa
Item Index
Methods
Gpio
-
pin
-
owner
-
raw
Instantiates a Gpio object
Parameters:
-
pin
Numberpin number to use
-
owner
Boolean(optional) Set pin owner, default behaviour is to 'own' the pin if we exported it. This means we will close it on destruct. Otherwise it will get left open. This is only valid in sysfs use cases
-
raw
Boolean(optional) Raw pins will use gpiolibs pin numbering from the kernel module. Note that you will not get any muxers set up for you so this may not always work as expected.
Returns:
edge
-
mode
Set the edge mode for ISR
Parameters:
-
mode
Enum EdgeThe edge mode to set
Returns:
Result of operation
isr
-
mode
-
func
Sets a callback to be called when pin value changes
Parameters:
-
mode
Enum EdgeThe edge mode to set
-
func
FunctionFunction to be called when interrupt is triggered
Returns:
Result of operation
isrExit
()
Enum Result
Exits callback - this call will not kill the isr thread immediately but only when it is out of it's critical section
Returns:
Result of operation
mode
-
mode
Change Gpio mode
Parameters:
-
mode
Enum ModeThe mode to change the gpio into
Returns:
Result of operation
dir
-
dir
Change Gpio direction
Parameters:
-
dir
Enum DirThe direction to change the gpio into
Returns:
Result of operation
readDir
()
Enum Dir
Read Gpio direction
Returns:
Result of operation
read
()
Number
Read value from Gpio
Returns:
Gpio value
write
-
value
Write value to Gpio
Parameters:
-
value
NumberValue to write to Gpio
Returns:
Result of operation
useMmap
-
enable
Enable use of mmap i/o if available.
Parameters:
-
enable
Booleantrue to use mmap
Returns:
Result of operation
getPin
-
raw
Get pin number of Gpio . If raw param is True will return the number as used within sysfs. Invalid will return -1.
Parameters:
-
raw
Boolean(optional) get the raw gpio number.
Returns:
Pin number
inputMode
-
mode
Change Gpio input mode
Parameters:
-
mode
Enum InputModeThe mode to change the gpio input
Returns:
Result of operation
outputMode
-
mode
Change Gpio output driver mode
Parameters:
-
mode
Enum OutputModeSet output driver mode
Returns:
Result of operation