linux下i2c控制radio的问题
目前用ut6410想实现 radio的功能使用si47xx的模块 ut6410本身有提供i2c的接口和驱动 kernel linux2.6.24
硬件部份問題排除 有用示波器 sda sck脚位有讯号出来.
现在遇到的状况是想从user space透过i2c对si47xx丢cmd 但是write read回传都是-1 部份代码如下:
#define I2C_DEVICE "/dev/i2c-0"
int fd;
/* open device */
fd = open(I2C_DEVICE, O_RDWR, 0);
ioctl(fd,I2C_SLAVE, 0x22); //radio_address_w
unsigned char abDataBuf[] = {0x01,
0x81, /// Set to AM Receive. Enable interrupts.
0x05};
if((write(fd, abDataBuf, 3))!=3){
fprintf(stderr,"I2C Write Fail\n");
}
close(fd);
#./i2ctest
I2C Write Fail
请问为什么write回传是-1 为什么会写入失败? 我有哪边没有注意到?现在不知道哪边有问题卡在这很久了请好心的大大帮帮忙
i2c驱动的问题,i2c slave地址是否设对?寄存器地址是否设对,频率是否得体?
再没有数据传输的时候 SDA 和 SCL 是否都为高?
{{--
相关问答:
写了个测试程序如下
struct hostent *hp;
char AlarmDevIP[20];
int x2;
hp = gethostbyname("www.google.com");
if (hp)
{
......
#include"stdio.h"
#include"stdlib.h"
void ContrTwo(char i)
{
char str1[8];
itoa(i,str1,2);
printf("%s",str1);
}
unsigned char leftRot(char str,int i);
unsign ......
在自己的电脑上安装了ubuntu 就是想玩一下3D桌面,于是下载了
compizconfig-settings-manager
emerald
simple-ccsm
fusion
这些东西,安装完之后,我在电脑里点击了emerald ......
如题,C/C++中的execl怎么调用写好的java程序,
execl("/opt/java1.5/bin/java","MyClass",NULL);
这样的不行哦。
不会.
运行java程序
找工具查看一下那个程序的命令行
搜索下:jni ......
VC6.0不能用,VS系列太大,能不能推荐几款小巧的C/C++的IDE
没有。楼下的垃圾回答
http://topic.csdn.net/u/20100105/09/c854cc79-c8b0-4c1a-a8cf-9ab001ab13a5.html?76698
VC6.0我windows7能用
其他的
DEV ......