GPIO Helper Library API.
More...
Go to the source code of this file.
|
enum | gpio_polarity { GPIO_POLARITY_INVALID,
GPIO_POLARITY_ACTIVE_LOW,
GPIO_POLARITY_ACTIVE_HIGH
} |
| GPIO Polarity types. More...
|
|
enum | gpio_edge {
GPIO_EDGE_INVALID,
GPIO_EDGE_NONE,
GPIO_EDGE_RISING,
GPIO_EDGE_FALLING,
GPIO_EDGE_BOTH
} |
| GPIO Edge types. More...
|
|
enum | gpio_direction {
GPIO_DIRECTION_INVALID,
GPIO_DIRECTION_IN,
GPIO_DIRECTION_OUT,
GPIO_DIRECTION_OUT_LOW,
GPIO_DIRECTION_OUT_HIGH
} |
| GPIO Direction types. More...
|
|
GPIO Helper Library API.
- Author
- Mark Greer mgree.nosp@m.r@an.nosp@m.imalc.nosp@m.reek.nosp@m..com
Set of routines to provide easy-to-use ways to perform common Linux(tm) GPIO operations.
GPIO Direction types.
Types used to specify the GPIO direction.
Enumerator |
---|
GPIO_DIRECTION_INVALID |
Invalid type (forces initialization)
|
GPIO_DIRECTION_IN |
Input
|
GPIO_DIRECTION_OUT |
Output (default)
|
GPIO_DIRECTION_OUT_LOW |
Output with initial low value
|
GPIO_DIRECTION_OUT_HIGH |
Output with initial high value
|
GPIO Edge types.
Types used to specify the GPIO edge(s).
Enumerator |
---|
GPIO_EDGE_INVALID |
Invalid type (forces initialization)
|
GPIO_EDGE_NONE |
No edge
|
GPIO_EDGE_RISING |
Rising edge
|
GPIO_EDGE_FALLING |
Falling edge
|
GPIO_EDGE_BOTH |
Rising and falling edge
|
GPIO Polarity types.
Types used to specify the GPIO polarity.
Enumerator |
---|
GPIO_POLARITY_INVALID |
Invalid type (forces initialization)
|
GPIO_POLARITY_ACTIVE_LOW |
Active low
|
GPIO_POLARITY_ACTIVE_HIGH |
Active high
|
int gpio_destroy |
( |
void * |
gpio_handle | ) |
|
Destroy resource allocated by gpio_init()
- Parameters
-
- Returns
- 0 on success, negative errno on failure
int gpio_get_fd |
( |
void * |
gpio_handle, |
|
|
int * |
fdp |
|
) |
| |
Get file descriptor associated with GPIO.
- Parameters
-
[in] | gpio_handle | Handle returned by gpio_init() |
[out] | fdp | Pointer to area where file descriptor is placed |
- Returns
- 0 on success, negative errno on failure
int gpio_init |
( |
char * |
gpio_num, |
|
|
void ** |
gpio_handlep |
|
) |
| |
Initialize a handle that provides access to specified GPIO.
- Parameters
-
[in] | gpio_num | Number of GPIO |
[out] | gpio_handlep | Pointer to handle to use for GPIO operations |
- Returns
- 0 on success, negative errno on failure
int gpio_read |
( |
void * |
gpio_handle, |
|
|
char * |
cp |
|
) |
| |
Get value of GPIO.
- Parameters
-
[in] | gpio_handle | Handle returned by gpio_init() |
[out] | cp | Pointer to where value is placed |
- Returns
- 0 on success, negative errno on failure
int gpio_set_direction |
( |
void * |
gpio_handle, |
|
|
enum gpio_direction |
dir |
|
) |
| |
Set GPIO direction.
- Parameters
-
[in] | gpio_handle | Handle returned by gpio_init() |
[in] | dir | Direction to set GPIO to |
- Returns
- 0 on success, negative errno on failure
int gpio_set_edge |
( |
void * |
gpio_handle, |
|
|
enum gpio_edge |
edge |
|
) |
| |
Set GPIO edge.
- Parameters
-
[in] | gpio_handle | Handle returned by gpio_init() |
[in] | edge | Edge to set GPIO to |
- Returns
- 0 on success, negative errno on failure
int gpio_set_polarity |
( |
void * |
gpio_handle, |
|
|
enum gpio_polarity |
polarity |
|
) |
| |
Set GPIO polarity.
- Parameters
-
[in] | gpio_handle | Handle returned by gpio_init() |
[in] | polarity | Polarity to set GPIO to |
- Returns
- 0 on success, negative errno on failure
int gpio_write |
( |
void * |
gpio_handle, |
|
|
char |
c |
|
) |
| |
Set value of GPIO.
- Parameters
-
[in] | gpio_handle | Handle returned by gpio_init() |
[in] | c | Value to set GPIO to |
- Returns
- 0 on success, negative errno on failure