This file defines the gpio interface for libmraa
if (gpio == NULL) {
}
return 1;
}
while (running == 0) {
response = gpio->
write(1);
sleep(1);
response = gpio->
write(0);
sleep(1);
}
delete gpio;
return response;
Gpio |
( |
int |
pin, |
|
|
bool |
owner = true , |
|
|
bool |
raw = false |
|
) |
| |
|
inline |
Instanciates a Gpio object
- Parameters
-
pin | pin number to use |
owner | (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 | (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. |
Gpio object destructor, this will only unexport the gpio if we where the owner
Set the edge mode for ISR
- Parameters
-
- Returns
- Result of operation
Sets a callback to be called when pin value changes
- Parameters
-
mode | The edge mode to set |
fptr | Function pointer to function to be called when interupt is triggered |
args | Arguments passed to the interrupt handler (fptr) |
- Returns
- Result of operation
Exits callback - this call will not kill the isr thread imediatlu but only when it is out of it's critical section
- Returns
- Result of operation
Change Gpio mode
- Parameters
-
mode | The mode to change the gpio into |
- Returns
- Result of operation
Change Gpio direction
- Parameters
-
dir | The direction to change the gpio into |
- Returns
- Result of operation
Write value to Gpio
- Parameters
-
value | Value to write to Gpio |
- Returns
- Result of operation
Enable use of mmap i/o if available.
- Parameters
-
- Returns
- Result of operation
int getPin |
( |
bool |
raw = false | ) |
|
|
inline |
Get pin number of Gpio. If raw param is True will return the number as used within sysfs
- Parameters
-
raw | (optional) get the raw gpio number. |
- Returns
- Pin number
The documentation for this class was generated from the following file:
- /var/lib/jenkins/workspace/mraa-doc-stable/api/mraa/gpio.hpp