Tizen RT Public API  v1.1 D4

Provides APIs for I2C (Inter Integrated Circuit) More...

Collaboration diagram for I2C:

Files

file  iotbus_i2c.h
 Iotbus APIs for I2C.
 

Typedefs

typedef struct _iotbus_i2c_s * iotbus_i2c_context_h
 Pointer definition to the internal struct _iotbus_i2c_s. More...
 

Enumerations

enum  iotbus_i2c_mode_e { IOTBUS_I2C_STD = 0, IOTBUS_I2C_FAST = 1, IOTBUS_I2C_HIGH = 2 }
 Enumeration of I2C frequency mode. More...
 

Functions

iotbus_i2c_context_h iotbus_i2c_init (int bus)
 initializes i2c_context. More...
 
int iotbus_i2c_stop (iotbus_i2c_context_h hnd)
 closes i2c_context. More...
 
int iotbus_i2c_set_frequency (iotbus_i2c_context_h hnd, iotbus_i2c_mode_e mode)
 sets the i2c frequency. More...
 
int iotbus_i2c_set_address (iotbus_i2c_context_h hnd, uint8_t address)
 sets the i2c slave address. More...
 
int iotbus_i2c_read (iotbus_i2c_context_h hnd, uint8_t *data, size_t length)
 reads from i2c device. More...
 
int iotbus_i2c_write (iotbus_i2c_context_h hnd, const uint8_t *data, size_t length)
 writes to i2c device. More...
 

Detailed Description

Provides APIs for I2C (Inter Integrated Circuit)

Typedef Documentation

◆ iotbus_i2c_context_h

typedef struct _iotbus_i2c_s* iotbus_i2c_context_h

Pointer definition to the internal struct _iotbus_i2c_s.

Definition at line 42 of file iotbus_i2c.h.

Enumeration Type Documentation

◆ iotbus_i2c_mode_e

Enumeration of I2C frequency mode.

Enumeration Details:
IOTBUS_I2C_STD = 0, < up to 100Khz
IOTBUS_I2C_FAST = 1, < up to 400Khz
IOTBUS_I2C_HIGH = 2, < up to 3.4Mhz

Enumerator
IOTBUS_I2C_STD 

up to 100Khz

IOTBUS_I2C_FAST 

up to 400Khz

IOTBUS_I2C_HIGH 

up to 3.4Mhz

Definition at line 52 of file iotbus_i2c.h.

Function Documentation

◆ iotbus_i2c_init()

iotbus_i2c_context_h iotbus_i2c_init ( int  bus)

initializes i2c_context.

#include <iotbus/iotbus_i2c.h>

Parameters
[in]busi2c bus number
Returns
On success, handle of i2c_context is returned. On failure, NULL is returned.
Since
Tizen RT v1.0

◆ iotbus_i2c_read()

int iotbus_i2c_read ( iotbus_i2c_context_h  hnd,
uint8_t *  data,
size_t  length 
)

reads from i2c device.

#include <iotbus/iotbus_i2c.h>

Parameters
[in]hndhandle of i2c_context
[in]datathe pointer of data buffer
[in]lengthsize to read
Returns
On success, 0 is returned. On failure, a negative value is returned.
Since
Tizen RT v1.0

◆ iotbus_i2c_set_address()

int iotbus_i2c_set_address ( iotbus_i2c_context_h  hnd,
uint8_t  address 
)

sets the i2c slave address.

#include <iotbus/iotbus_i2c.h>

Parameters
[in]hndhandle of i2c_context
[in]addressi2c address
Returns
On success, 0 is returned. On failure, a negative value is returned.
Since
Tizen RT v1.0

◆ iotbus_i2c_set_frequency()

int iotbus_i2c_set_frequency ( iotbus_i2c_context_h  hnd,
iotbus_i2c_mode_e  mode 
)

sets the i2c frequency.

#include <iotbus/iotbus_i2c.h>

Parameters
[in]hndhandle of i2c_context
[in]modei2c frequency mode
Returns
On success, 0 is returned. On failure, a negative value is returned.
Since
Tizen RT v1.0

◆ iotbus_i2c_stop()

int iotbus_i2c_stop ( iotbus_i2c_context_h  hnd)

closes i2c_context.

#include <iotbus/iotbus_i2c.h>

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

◆ iotbus_i2c_write()

int iotbus_i2c_write ( iotbus_i2c_context_h  hnd,
const uint8_t *  data,
size_t  length 
)

writes to i2c device.

#include <iotbus/iotbus_i2c.h>

Parameters
[in]hndhandle of i2c_context
[in]datathe pointer of data buffer
[in]lengthsize to write
Returns
On success, size is returned. On failure, a negative value is returned.
Since
Tizen RT v1.0