![]() |
i2c
1.4.2
RoadNarrows Robotics I2C Package
|
System Management Bus (SMBus) over I2C communication interface. More...
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/errno.h>
#include <sys/ioctl.h>
#include "rnr/rnrconfig.h"
#include "rnr/i2c-dev.h"
#include "rnr/smbus.h"
Go to the source code of this file.
Functions | |
int | i2c_smbus_access (int fd, byte_t read_write, byte_t command, int size, i2c_smbus_data_t *data) |
Execute an SMBus IOCTL. More... | |
int | i2c_smbus_write_quick (int fd, byte_t value) |
Write a quick value to the SMBus. More... | |
int | i2c_smbus_read_byte (int fd) |
Read an immediate byte from the SMBus. More... | |
int | i2c_smbus_write_byte (int fd, byte_t value) |
Write an immediate byte to the SMBus. More... | |
int | i2c_smbus_read_byte_data (int fd, byte_t command) |
Read a data byte from the SMBus. More... | |
int | i2c_smbus_write_byte_data (int fd, byte_t command, byte_t value) |
Write a data byte to the SMBus. More... | |
int | i2c_smbus_read_word_data (int fd, byte_t command) |
Read a data 2-byte word from the SMBus. More... | |
int | i2c_smbus_write_word_data (int fd, byte_t command, ushort_t value) |
Write a data 2-byte word to the SMBus. More... | |
int | i2c_smbus_process_call (int fd, byte_t command, ushort_t value) |
Issue a 2-byte word process call (write/read) to the SMBus. More... | |
int | i2c_smbus_read_block_data (int fd, byte_t command, byte_t *values) |
Read a block of data from the SMBus. More... | |
int | i2c_smbus_write_block_data (int fd, byte_t command, byte_t length, const byte_t *values) |
Write a data block to the SMBus. More... | |
int | i2c_smbus_read_i2c_block_data (int fd, byte_t command, byte_t *values) |
Read a block of data from the SMBus via low-level I2C. More... | |
int | i2c_smbus_write_i2c_block_data (int fd, byte_t command, byte_t length, const byte_t *values) |
Write a block of data to the SMBus via low-level I2C. More... | |
int | i2c_smbus_block_process_call (int fd, byte_t command, byte_t length, byte_t *values) |
Issue a block process call (write/read) to the SMBus. More... | |
System Management Bus (SMBus) over I2C communication interface.
Definition in file smbus.c.
int i2c_smbus_access | ( | int | fd, |
byte_t | read_write, | ||
byte_t | command, | ||
int | size, | ||
i2c_smbus_data_t * | data | ||
) |
Execute an SMBus IOCTL.
fd | File descriptor to opened SMBus device. | |
read_write | Operation access type. | |
command | Operation command or immediate data. | |
size | Data size. | |
[in,out] | data | Read/write/control data |
Definition at line 81 of file smbus.c.
References i2c_smbus_ioctl_data_struct::command, i2c_smbus_ioctl_data_struct::data, I2C_SMBUS, i2c_smbus_ioctl_data_struct::read_write, and i2c_smbus_ioctl_data_struct::size.
Referenced by i2c_smbus_block_process_call(), i2c_smbus_process_call(), i2c_smbus_read_block_data(), i2c_smbus_read_byte(), i2c_smbus_read_byte_data(), i2c_smbus_read_i2c_block_data(), i2c_smbus_read_word_data(), i2c_smbus_write_block_data(), i2c_smbus_write_byte(), i2c_smbus_write_byte_data(), i2c_smbus_write_i2c_block_data(), i2c_smbus_write_quick(), and i2c_smbus_write_word_data().
int i2c_smbus_block_process_call | ( | int | fd, |
byte_t | command, | ||
byte_t | length, | ||
byte_t * | values | ||
) |
Issue a block process call (write/read) to the SMBus.
fd | File descriptor to opened SMBus device. | |
command | Command to SMBus device. | |
length | Length of buffer (bytes) to write. | |
[in,out] | values | Buffer of data to write and to hold the block of read byte values. Must be large enough to receive the data. |
Definition at line 396 of file smbus.c.
References i2c_smbus_data_union::block, i2c_smbus_access(), I2C_SMBUS_BLOCK_MAX, I2C_SMBUS_BLOCK_PROC_CALL, and I2C_SMBUS_WRITE.
int i2c_smbus_process_call | ( | int | fd, |
byte_t | command, | ||
ushort_t | value | ||
) |
Issue a 2-byte word process call (write/read) to the SMBus.
fd | File descriptor to opened SMBus device. |
command | Command to SMBus device. |
value | Word value to write. |
Definition at line 238 of file smbus.c.
References i2c_smbus_access(), I2C_SMBUS_PROC_CALL, I2C_SMBUS_WRITE, and i2c_smbus_data_union::word.
int i2c_smbus_read_block_data | ( | int | fd, |
byte_t | command, | ||
byte_t * | values | ||
) |
Read a block of data from the SMBus.
fd | File descriptor to opened SMBus device. | |
command | Command to SMBus device. | |
[out] | values | Buffer to hold the block of read byte values. Must be large enough to receive the data. |
Definition at line 264 of file smbus.c.
References i2c_smbus_data_union::block, i2c_smbus_access(), I2C_SMBUS_BLOCK_DATA, and I2C_SMBUS_READ.
int i2c_smbus_read_byte | ( | int | fd | ) |
Read an immediate byte from the SMBus.
fd | File descriptor to opened SMBus device. |
Definition at line 118 of file smbus.c.
References i2c_smbus_data_union::byte, I2C_NOCMD, i2c_smbus_access(), I2C_SMBUS_BYTE, and I2C_SMBUS_READ.
int i2c_smbus_read_byte_data | ( | int | fd, |
byte_t | command | ||
) |
Read a data byte from the SMBus.
fd | File descriptor to opened SMBus device. |
command | Command to SMBus device. |
Definition at line 153 of file smbus.c.
References i2c_smbus_data_union::byte, i2c_smbus_access(), I2C_SMBUS_BYTE_DATA, and I2C_SMBUS_READ.
int i2c_smbus_read_i2c_block_data | ( | int | fd, |
byte_t | command, | ||
byte_t * | values | ||
) |
Read a block of data from the SMBus via low-level I2C.
fd | File descriptor to opened SMBus device. | |
command | Command to SMBus device. | |
[out] | values | Buffer to hold the block of read byte values. Must be large enough to receive the data. |
Definition at line 330 of file smbus.c.
References i2c_smbus_data_union::block, i2c_smbus_access(), I2C_SMBUS_I2C_BLOCK_DATA, and I2C_SMBUS_READ.
int i2c_smbus_read_word_data | ( | int | fd, |
byte_t | command | ||
) |
Read a data 2-byte word from the SMBus.
fd | File descriptor to opened SMBus device. |
command | Command to SMBus device. |
Definition at line 195 of file smbus.c.
References i2c_smbus_access(), I2C_SMBUS_READ, I2C_SMBUS_WORD_DATA, and i2c_smbus_data_union::word.
int i2c_smbus_write_block_data | ( | int | fd, |
byte_t | command, | ||
byte_t | length, | ||
const byte_t * | values | ||
) |
Write a data block to the SMBus.
fd | File descriptor to opened SMBus device. | |
command | Command to SMBus device. | |
length | Length of buffer (bytes) to write. | |
[in] | values | Buffer of data to write. |
Definition at line 297 of file smbus.c.
References i2c_smbus_data_union::block, i2c_smbus_access(), I2C_SMBUS_BLOCK_DATA, I2C_SMBUS_BLOCK_MAX, and I2C_SMBUS_WRITE.
int i2c_smbus_write_byte | ( | int | fd, |
byte_t | value | ||
) |
Write an immediate byte to the SMBus.
fd | File descriptor to opened SMBus device. |
value | Byte value to write. |
Definition at line 138 of file smbus.c.
References i2c_smbus_access(), I2C_SMBUS_BYTE, and I2C_SMBUS_WRITE.
int i2c_smbus_write_byte_data | ( | int | fd, |
byte_t | command, | ||
byte_t | value | ||
) |
Write a data byte to the SMBus.
fd | File descriptor to opened SMBus device. |
command | Command to SMBus device. |
value | Byte value to write. |
Definition at line 175 of file smbus.c.
References i2c_smbus_data_union::byte, i2c_smbus_access(), I2C_SMBUS_BYTE_DATA, and I2C_SMBUS_WRITE.
int i2c_smbus_write_i2c_block_data | ( | int | fd, |
byte_t | command, | ||
byte_t | length, | ||
const byte_t * | values | ||
) |
Write a block of data to the SMBus via low-level I2C.
fd | File descriptor to opened SMBus device. | |
command | Command to SMBus device. | |
length | Length of buffer (bytes) to write. | |
[in] | values | Buffer of data to write. |
Definition at line 361 of file smbus.c.
References i2c_smbus_data_union::block, i2c_smbus_access(), I2C_SMBUS_I2C_BLOCK_DATA, I2C_SMBUS_I2C_BLOCK_MAX, and I2C_SMBUS_WRITE.
int i2c_smbus_write_quick | ( | int | fd, |
byte_t | value | ||
) |
Write a quick value to the SMBus.
fd | File descriptor to opened SMBus device. |
value | Value to write |
Definition at line 104 of file smbus.c.
References I2C_NOCMD, i2c_smbus_access(), and I2C_SMBUS_QUICK.
int i2c_smbus_write_word_data | ( | int | fd, |
byte_t | command, | ||
ushort_t | value | ||
) |
Write a data 2-byte word to the SMBus.
fd | File descriptor to opened SMBus device. |
command | Command to SMBus device. |
value | Word value to write. |
Definition at line 217 of file smbus.c.
References i2c_smbus_access(), I2C_SMBUS_WORD_DATA, I2C_SMBUS_WRITE, and i2c_smbus_data_union::word.