libicsc  1.0.0
 All Data Structures Files Functions Modules
Macros | Functions
Gpio

Helper functions to make working with GPIO easier. More...

Macros

#define ICSC_GPIO_OUTPUT   0
 
#define ICSC_GPIO_INPUT   1
 

Functions

int icsc_gpio_open (int num, int mode)
 Open a GPIO device in either input or output mode. Exports the GPIO node. More...
 
int icsc_gpio_read (int num)
 Read the value of a GPIO. More...
 
int icsc_gpio_write (int num, int level)
 Set a GPIO to high or low. More...
 
int icsc_gpio_close (int num)
 Close a GPIO. Unexports the GPIO node. More...
 

Detailed Description

Helper functions to make working with GPIO easier.

Function Documentation

int icsc_gpio_close ( int  num)

Close a GPIO. Unexports the GPIO node.

Parameters
numGPIO number
Returns
0 on success or -1 on error.
int icsc_gpio_open ( int  num,
int  mode 
)

Open a GPIO device in either input or output mode. Exports the GPIO node.

Parameters
numGPIO number
modeEither ICSC_GPIO_INPUT or ICSC_GPIO_OUTPUT
Returns
0 on success or -1 on error.
int icsc_gpio_read ( int  num)

Read the value of a GPIO.

Parameters
numGPIO number
Returns
1 if the GPIO reads high, 0 if it reads low, or -1 on an error.
int icsc_gpio_write ( int  num,
int  level 
)

Set a GPIO to high or low.

Parameters
numGPIO number
level1 for logic high or 0 for logic low
Returns
0 on success or -1 on error.