Go to the source code of this file.
Data Structures | |
struct | i2c_t |
Typedefs | |
typedef unsigned int | i2c_dev_t |
Functions | |
int | i2c_open (i2c_t *i2c, const char *device) |
void | i2c_close (i2c_t *i2c) |
int | i2c_llread (i2c_t *i2c, i2c_dev_t dev, char *buf, unsigned int len) |
int | i2c_llwrite (i2c_t *i2c, i2c_dev_t dev, const char *buf, unsigned int len) |
int | i2c_lltransfer (i2c_t *i2c, i2c_dev_t dev, const char *write_buf, unsigned int write_len, char *read_buf, unsigned int read_len) |
int | i2c_exists (i2c_t *i2c, i2c_dev_t dev) |
int | i2c_scan (i2c_t *i2c, int(*callback)(i2c_t *i2c, i2c_dev_t dev, void *context), void *context) |
Definition in file i2ccom.h.
typedef unsigned int i2c_dev_t |
void i2c_close | ( | i2c_t * | i2c | ) |
This procedure closes an I²C Bus.
i2c | I²C Bus Handle |
Definition at line 87 of file i2ccom.c.
References i2c_t::fd.
Referenced by knet_i2c_exit(), and knet_i2c_init().
This function verifies the existance of a given device on a given I²C Bus.
i2c | I²C Bus Handle. | |
dev | I²C Device Address. This value contains only the I²C address bits (7-bit or 10-bit). |
Definition at line 243 of file i2ccom.c.
References i2c_t::fd.
Referenced by knet_i2c_open().
This function is the primitive to read data from a given device on a given I²C Bus.
i2c | I²C Bus Handle | |
dev | I²C Device Address. This value contains only the I²C address bits (7-bit or 10-bit). | |
buf | Pointer to the buffer that will receive the data bytes. | |
len | Size of the buffer in bytes. |
Definition at line 138 of file i2ccom.c.
References i2c_t::fd, and i2c_priv_select_device().
Referenced by knet_i2c_read().
int i2c_lltransfer | ( | i2c_t * | i2c, | |
i2c_dev_t | dev, | |||
const char * | write_buf, | |||
unsigned int | write_len, | |||
char * | read_buf, | |||
unsigned int | read_len | |||
) |
This function is the primitive to write data to and then read data from a given device on a given I²C Bus.
i2c | I²C Bus Handle. | |
dev | I²C Device Address. This value contains only the I²C address bits (7-bit or 10-bit). | |
write_buf | Pointer to the buffer that contains the data to be written. | |
write_len | Number of bytes to write. The data are in the write buffer. | |
read_buf | Pointer to the buffer that will receive the data. | |
read_len | Size of the read buffer in bytes. |
Definition at line 202 of file i2ccom.c.
References i2c_t::fd.
Referenced by knet_i2c_transfer().
This function is the primitive to write data to a given device on a given I²C Bus.
i2c | I²C Bus Handle | |
dev | I²C Device Address. This value contains only the I²C address bits (7-bit or 10-bit). | |
buf | Pointer to the buffer that will be written. | |
len | Number of bytes to write |
Definition at line 166 of file i2ccom.c.
References i2c_t::fd, and i2c_priv_select_device().
Referenced by knet_i2c_write().
int i2c_open | ( | i2c_t * | i2c, | |
char const * | device | |||
) |
This function opens an I²C Bus.
i2c | Pointer to I²C Bus Descriptor. This descriptor must be allocated by the caller. | |
device | A string representing the device name. A NULL should be used for default I²C Bus. (e.g. /dev/i2c/0) |
Definition at line 66 of file i2ccom.c.
References i2c_t::dev, and i2c_t::fd.
Referenced by knet_i2c_init().
int i2c_scan | ( | i2c_t * | i2c, | |
int(*)(i2c_t *i2c, i2c_dev_t dev, void *context) | callback, | |||
void * | context | |||
) |
This function scans a given I²C Bus to find devices
i2c | I²C Bus Handle. | |
callback | A callback function called when a device is found. If this callback function returns a value <0 the bus scan stops immedialety and the value is used as return value by i2c_scan. | |
context | A value or a pointer passed to the callback function. |
Definition at line 280 of file i2ccom.c.
References i2c_t::fd.
Referenced by knet_i2c_init().