Tizen RT Public API  v1.1 D4
GPIO

Provides APIs for GPIO (General Purpose Input/Output) More...

Collaboration diagram for GPIO:

Files

file  iotbus_gpio.h
 Iotbus APIs for GPIO.
 

Typedefs

typedef struct _iotbus_gpio_s * iotbus_gpio_context_h
 Pointer definition to the internal struct iotbus_gpio_s. More...
 

Enumerations

enum  iotbus_gpio_drive_e
 Enumeration of Gpio output mode. More...
 
enum  iotbus_gpio_direction_e
 Enumeration of Gpio direction options. More...
 
enum  iotbus_gpio_edge_e
 Enumeration of Gpio edge type for interrupt. More...
 

Functions

iotbus_gpio_context_h iotbus_gpio_open (int gpiopin)
 initializes gpio_context based on gpio pin. More...
 
int iotbus_gpio_close (iotbus_gpio_context_h dev)
 closes the gpio_context. More...
 
int iotbus_gpio_set_direction (iotbus_gpio_context_h dev, iotbus_gpio_direction_e dir)
 sets gpio direction. More...
 
int iotbus_gpio_set_edge_mode (iotbus_gpio_context_h dev, iotbus_gpio_edge_e edge)
 sets the edge mode on the gpio. More...
 
int iotbus_gpio_set_drive_mode (iotbus_gpio_context_h dev, iotbus_gpio_drive_e drive)
 sets gpio output mode. More...
 
int iotbus_gpio_register_cb (iotbus_gpio_context_h dev, iotbus_gpio_edge_e edge, gpio_isr_cb isr_cb, void *user_data)
 registers event handler callback for interrupt. More...
 
int iotbus_gpio_unregister_cb (iotbus_gpio_context_h dev)
 unregisters event handler callback for interrupt. More...
 
int iotbus_gpio_read (iotbus_gpio_context_h dev)
 reads the gpio value. More...
 
int iotbus_gpio_write (iotbus_gpio_context_h dev, int value)
 writes to the gpio value. More...
 
int iotbus_gpio_get_direction (iotbus_gpio_context_h dev, iotbus_gpio_direction_e *dir)
 gets a direction of the gpio. More...
 
int iotbus_gpio_get_pin (iotbus_gpio_context_h dev)
 gets a pin number of the gpio. More...
 
int iotbus_gpio_get_edge_mode (iotbus_gpio_context_h dev, iotbus_gpio_edge_e *edge)
 gets a edge mode of the gpio. More...
 
int iotbus_gpio_get_drive_mode (iotbus_gpio_context_h dev, iotbus_gpio_drive_e *drive)
 gets a drive mode of the gpio. More...
 

Detailed Description

Provides APIs for GPIO (General Purpose Input/Output)

Typedef Documentation

◆ iotbus_gpio_context_h

typedef struct _iotbus_gpio_s* iotbus_gpio_context_h

Pointer definition to the internal struct iotbus_gpio_s.

Definition at line 83 of file iotbus_gpio.h.

Enumeration Type Documentation

◆ iotbus_gpio_direction_e

Enumeration of Gpio direction options.

Enumeration Details:
IOTBUS_GPIO_DIRECTION_NONE = 0, No set any state
IOTBUS_GPIO_DIRECTION_OUT = 1, Output Direction
IOTBUS_GPIO_DIRECTION_IN = 2, Input Direction

Definition at line 56 of file iotbus_gpio.h.

◆ iotbus_gpio_drive_e

Enumeration of Gpio output mode.

Enumeration Details:
IOTBUS_GPIO_DRIVE_PULLUP = 0, Resistive High
IOTBUS_GPIO_DRIVE_PULLDOWN = 1, Resistive Low
IOTBUS_GPIO_DRIVE_FLOAT = 2, Float

Definition at line 42 of file iotbus_gpio.h.

◆ iotbus_gpio_edge_e

Enumeration of Gpio edge type for interrupt.

Enumeration Details:
IOTBUS_GPIO_EDGE_NONE = 0, No interrupt on Gpio
IOTBUS_GPIO_EDGE_BOTH = 1, Interrupt on rising and falling edge
IOTBUS_GPIO_EDGE_RISING = 2, Interrupt on rising edge only
IOTBUS_GPIO_EDGE_FALLING = 3, Interrupt on falling edge only

Definition at line 71 of file iotbus_gpio.h.

Function Documentation

◆ iotbus_gpio_close()

int iotbus_gpio_close ( iotbus_gpio_context_h  dev)

closes the gpio_context.

#include <iotbus/iotbus_gpio.h>

Parameters
[in]devhandle of gpio_context
Returns
On success, 0 is returned. On failure, a negative value is returned.
Since
Tizen RT v1.0

◆ iotbus_gpio_get_direction()

int iotbus_gpio_get_direction ( iotbus_gpio_context_h  dev,
iotbus_gpio_direction_e dir 
)

gets a direction of the gpio.

#include <iotbus/iotbus_gpio.h>

Parameters
[in]devhandle of gpio_context
[out]dircurrent gpio direction
Returns
On success, 0 is returned. On failure, a negative value is returned.
Since
Tizen RT v1.0

◆ iotbus_gpio_get_drive_mode()

int iotbus_gpio_get_drive_mode ( iotbus_gpio_context_h  dev,
iotbus_gpio_drive_e drive 
)

gets a drive mode of the gpio.

#include <iotbus/iotbus_gpio.h>

Parameters
[in]devhandle of gpio_context
[out]drivecurrent drive type
Returns
On success, 0 is returned. On failure, a negative value is returned.
Since
Tizen RT v1.0

◆ iotbus_gpio_get_edge_mode()

int iotbus_gpio_get_edge_mode ( iotbus_gpio_context_h  dev,
iotbus_gpio_edge_e edge 
)

gets a edge mode of the gpio.

#include <iotbus/iotbus_gpio.h>

Parameters
[in]devhandle of gpio_context
[out]edgecurrent gpio edge type
Returns
On success, 0 is returned. On failure, a negative value is returned.
Since
Tizen RT v1.0

◆ iotbus_gpio_get_pin()

int iotbus_gpio_get_pin ( iotbus_gpio_context_h  dev)

gets a pin number of the gpio.

#include <iotbus/iotbus_gpio.h>

Parameters
[in]devhandle of gpio_context
Returns
On success, gpio pin number is returned. On failure, a negative value is returned.
Since
Tizen RT v1.0

◆ iotbus_gpio_open()

iotbus_gpio_context_h iotbus_gpio_open ( int  gpiopin)

initializes gpio_context based on gpio pin.

#include <iotbus/iotbus_gpio.h>

Parameters
[in]gpiopingpio pin number
Returns
On success, handle of gpio_context is returned. On failure, NULL is returned.
Since
Tizen RT v1.0

◆ iotbus_gpio_read()

int iotbus_gpio_read ( iotbus_gpio_context_h  dev)

reads the gpio value.

#include <iotbus/iotbus_gpio.h>

Parameters
[in]devhandle of gpio_context
Returns
On success, 0 or 1 is returned. (0: signal low, 1: signal high) On failure, a nagative value is returned.
Since
Tizen RT v1.0

◆ iotbus_gpio_register_cb()

int iotbus_gpio_register_cb ( iotbus_gpio_context_h  dev,
iotbus_gpio_edge_e  edge,
gpio_isr_cb  isr_cb,
void *  user_data 
)

registers event handler callback for interrupt.

#include <iotbus/iotbus_gpio.h>
isr_cb is called when following situation occured.
the gpio value is changed from 0 to 1 on IOTBUS_GPIO_EDGE_RISING mode.
the gpio value is changed from 1 to 0 on IOTBUS_GPIO_EDGE_FALLING mode.

Parameters
[in]devhandle of gpio_context
[in]edgegpio edge type
[in]isr_cbthe pointer of isr callback function
[in]user_dataisr function parameter
Returns
On success, 0 is returned. On failure, a negative value is returned.
Since
Tizen RT v1.0

◆ iotbus_gpio_set_direction()

int iotbus_gpio_set_direction ( iotbus_gpio_context_h  dev,
iotbus_gpio_direction_e  dir 
)

sets gpio direction.

#include <iotbus/iotbus_gpio.h>

Parameters
[in]devhandle of gpio_context
[in]dirgpio direction type
Returns
On success, 0 is returned. On failure, a negative value is returned.
Since
Tizen RT v1.0

◆ iotbus_gpio_set_drive_mode()

int iotbus_gpio_set_drive_mode ( iotbus_gpio_context_h  dev,
iotbus_gpio_drive_e  drive 
)

sets gpio output mode.

#include <iotbus/iotbus_gpio.h>

Parameters
[in]devhandle of gpio_context
[in]drivegpio drive type
Returns
On success, 0 is returned. On failure, a negative value is returned.
Since
Tizen RT v1.0

◆ iotbus_gpio_set_edge_mode()

int iotbus_gpio_set_edge_mode ( iotbus_gpio_context_h  dev,
iotbus_gpio_edge_e  edge 
)

sets the edge mode on the gpio.

#include <iotbus/iotbus_gpio.h>

Parameters
[in]devhandle of gpio_context
[in]edgegpio edge type
Returns
On success, 0 is returned. On failure, a negative value is returned.
Since
Tizen RT v1.0

◆ iotbus_gpio_unregister_cb()

int iotbus_gpio_unregister_cb ( iotbus_gpio_context_h  dev)

unregisters event handler callback for interrupt.

#include <iotbus/iotbus_gpio.h>

Parameters
[in]devhandle of gpio_context
Returns
On success, 0 is returned. On failure, a negative value is returned.
Since
Tizen RT v1.0

◆ iotbus_gpio_write()

int iotbus_gpio_write ( iotbus_gpio_context_h  dev,
int  value 
)

writes to the gpio value.

#include <iotbus/iotbus_gpio.h>

Parameters
[in]devhandle of gpio_context
[in]valuesignal value
Returns
On success, 0 is returned. On failure, a negative value is returned.
Since
Tizen RT v1.0