手把手教你写Linux I2C设备驱动2
来源:互联网 发布:瓷妆口红怎么样 知乎 编辑:程序博客网 时间:2024/05/02 00:37
- extern int i2c_master_send(struct i2c_client *,const char* ,int);
- extern int i2c_master_recv(struct i2c_client *,char* ,int);
- static int tvp5158_i2c_write( struct i2c_client* client,uint8_t reg,uint8_t data)
- {
- unsigned char buffer[2];
- buffer[0] = reg;
- buffer[1] = data;
- if( 2!= i2c_master_send(client,buffer,2) ) {
- printk( KERN_ERR " tvp5158_i2c_write fail! \n" );
- return -1;
- }
- return 0;
- }
- static int tvp5158_i2c_read( struct i2c_client* client,uint8_t reg,uint8_t *data)
- {
- // write reg addr
- if( 1!= i2c_master_send(client,®,1) ) {
- printk( KERN_ERR " tvp5158_i2c_read fail! \n" );
- return -1;
- }
- // wait
- msleep(10);
- // read
- if( 1!= i2c_master_recv(client,data,1) ) {
- printk( KERN_ERR " tvp5158_i2c_read fail! \n" );
- return -1;
- }
- return 0;
- }
0 0
- 手把手教你写Linux I2C设备驱动2
- 手把手教你写Linux I2C设备驱动
- 手把手教你写Linux I2C设备驱动
- 手把手教你写Linux I2C设备驱动
- 手把手教你写Linux I2C设备驱动
- 手把手教你写Linux I2C设备驱动
- 手把手教你写Linux I2C设备驱动
- 手把手教你写Linux I2C设备驱动
- 手把手教你写Linux I2C设备驱动
- 手把手教你写linux I2C设备驱动
- 手把手教你写Linux I2C设备驱动
- 手把手教你写Linux I2C设备驱动
- 手把手教你写Linux I2C设备驱动
- 手把手教你写Linux I2C设备驱动
- 手把手教你写Linux I2C设备驱动
- 手把手教你写Linux I2C设备驱动 tvp5158
- 手把手教你写Linux I2C设备驱动
- i2c驱动(一)--- 手把手教你写i2c驱动
- onNewIntent
- LeetCode:Isomorphic Strings
- POJ 3468 线段树区间更新
- hdoj Least Common Multiple 1019 && 2028 (n个数的最小公倍数)
- Gerrit – Installation and setup
- 手把手教你写Linux I2C设备驱动2
- 单例模式——设计模式个人学习
- 时间改变一切—兄弟连IT教育
- Python & Shell:一句话的优雅
- Android layout_margin 无效的解决办法
- 覆盖的理解
- sicily 1007. To and Fro(破译密码)
- iOS联网和授权问题
- Maven简介(六)——Dependency