回 帖 发 新 帖 刷新版面

主题:i2c通信的读写接口函数



常用的i2c总线的读写函数有:

快速读写接口函数:(连续读写)

i2c_smbus_read_byte();

i2c_smbus_write_byte();

常用的读操作接口函数:

i2c_smbus_read_byte_data();

i2c_smbus_read_word_data();

i2c_smbus_read_block_data();

常用的写操作接口函数:

i2c_smbus_write_byte_data();

i2c_smbus_write_word_data();

i2c_smbus_write_block_data();

 

s32  i2c_smbus_read_byte_data(const struct i2c_client *client, u8 command);

函数功能:从指定的i2c从设备的指定地址空间中读取一个字节的数据

形参列表:

clienti2c客户端 -- 指定的要读取数据的i2c从设备

commandi2c从设备内部的地址空间 -- 指定要从设备的哪个地址空间中读取数据

返回值:

成功:读取到的数据(一个字节数据)

失败:负数

 

s32  i2c_smbus_write_byte_data(const struct i2c_client *client,  u8 command,  u8 value);

函数功能:向指定的i2c从设备中的指定地址空间写入一个字节的数据

形参列表:

clienti2c客户端 -- 指定要写入数据的i2c从设备

commandi2c从设备内部的地址空间 -- 把数据写入到哪个地址空间中

value:要写入的数据(一个字节数据)

返回值:

成功:0

失败:负数


回复列表 (共1个回复)

沙发

感谢分享ganbai2@donotsendemailtome.com
ganbai3@donotsendemailtome.com
ganbai4@donotsendemailtome.com
ganbai5@donotsendemailtome.com
ganyoo1@donotsendemailtome.com
ganyoo2@donotsendemailtome.com
ganyoo3@donotsendemailtome.com
ganyoo4@donotsendemailtome.com
ganyoo5@donotsendemailtome.com
dangle1@donotsendemailtome.com
dangle2@donotsendemailtome.com
dangle3@donotsendemailtome.com
dangle4@donotsendemailtome.com
dangle5@donotsendemailtome.com
proyty1@donotsendemailtome.com
proyty2@donotsendemailtome.com
proyty3@donotsendemailtome.com
proyty4@donotsendemailtome.com
proyty5@donotsendemailtome.com
moteye1@donotsendemailtome.com
moteye2@donotsendemailtome.com
moteye3@donotsendemailtome.com
moteye4@donotsendemailtome.com
moteye5@donotsendemailtome.com
youpro1@donotsendemailtome.com
youpro2@donotsendemailtome.com

我来回复

您尚未登录,请登录后再回复。点此登录或注册