資源簡介
i2c測試代碼,由于lm75溫度傳感器測試
代碼片段和文件信息
#include?
#include?
#include?
#include?
#include?
?
#define?I2C_SLAVE 0x0703
int?main(int?argcchar?**argv)
{
int?fd;
int?addr?=?0x48;?/*?The?I2C?address?*/
char?register_addr?=?0x0;?/*?Device?register?to?access?0x0*/
char?rbuf[10];
fd?=?open(“/dev/i2c-0“?O_RDWR);
if?(fd?0)?{
/*?ERROR?HANDLING;?you?can?check?errno?to?see?what?went?wrong?*/
perror(“open?failed“);
exit(1);
}
/*發器件地址*/
if?(ioctl(fd?I2C_SLAVE?addr)?0)?{
/*?ERROR?HANDLING;?you?can?check?errno?to?see?what?went?wrong?*/
perro
- 上一篇:sniffer.zip
- 下一篇:原版官方穩定版本Lwip1.4.1
評論
共有 條評論