Gpio Class
This file defines the gpio interface for libmraa
Item Index
Methods
Gpio
-
pin -
owner -
raw
Instantiates a Gpio object
Parameters:
-
pinNumberpin number to use
-
ownerBoolean(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
-
rawBoolean(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:
-
modeEnum EdgeThe edge mode to set
Returns:
Result of operation
isr
-
mode -
func
Sets a callback to be called when pin value changes
Parameters:
-
modeEnum EdgeThe edge mode to set
-
funcFunctionFunction 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:
-
modeEnum ModeThe mode to change the gpio into
Returns:
Result of operation
dir
-
dir
Change Gpio direction
Parameters:
-
dirEnum 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:
-
valueNumberValue to write to Gpio
Returns:
Result of operation
useMmap
-
enable
Enable use of mmap i/o if available.
Parameters:
-
enableBooleantrue 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:
-
rawBoolean(optional) get the raw gpio number.
Returns:
Pin number
inputMode
-
mode
Change Gpio input mode
Parameters:
-
modeEnum InputModeThe mode to change the gpio input
Returns:
Result of operation
outputMode
-
mode
Change Gpio output driver mode
Parameters:
-
modeEnum OutputModeSet output driver mode
Returns:
Result of operation