libgpio
Enumerations | Functions
gpio.h File Reference

GPIO Helper Library API. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Enumerations

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...
 

Functions

int gpio_get_fd (void *gpio_handle, int *fdp)
 Get file descriptor associated with GPIO. More...
 
int gpio_set_polarity (void *gpio_handle, enum gpio_polarity polarity)
 Set GPIO polarity. More...
 
int gpio_set_edge (void *gpio_handle, enum gpio_edge edge)
 Set GPIO edge. More...
 
int gpio_set_direction (void *gpio_handle, enum gpio_direction dir)
 Set GPIO direction. More...
 
int gpio_read (void *gpio_handle, char *cp)
 Get value of GPIO. More...
 
int gpio_write (void *gpio_handle, char c)
 Set value of GPIO. More...
 
int gpio_init (char *gpio_num, void **gpio_handlep)
 Initialize a handle that provides access to specified GPIO. More...
 
int gpio_destroy (void *gpio_handle)
 Destroy resource allocated by gpio_init() More...
 

Detailed Description

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.

Enumeration Type Documentation

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

enum gpio_edge

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

Function Documentation

int gpio_destroy ( void *  gpio_handle)

Destroy resource allocated by gpio_init()

Parameters
[in]gpio_handleHandle returned by gpio_init()
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_handleHandle returned by gpio_init()
[out]fdpPointer 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_numNumber of GPIO
[out]gpio_handlepPointer 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_handleHandle returned by gpio_init()
[out]cpPointer 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_handleHandle returned by gpio_init()
[in]dirDirection 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_handleHandle returned by gpio_init()
[in]edgeEdge 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_handleHandle returned by gpio_init()
[in]polarityPolarity 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_handleHandle returned by gpio_init()
[in]cValue to set GPIO to
Returns
0 on success, negative errno on failure