嵌入式技术论坛
直播中

訾存贵

7年用户 921经验值
私信 关注
[问答]

新手求助pcf8574编译出错是什么问题呢?

../packages/pcf8574-latest/pcf8574.c: In function 'pcf8574_port_read':
../packages/pcf8574-latest/pcf8574.c:25:29: error: dereferencing pointer to incomplete type 'struct rt_i2c_bus_device'
rt_device_read(&dev->bus->parent, dev->i2c_addr, &value, 1);
^~
../packages/pca9685-latest/pca9685.c: In function 'pca9685_restart':
../packages/pca9685-latest/pca9685.c:208:22: warning: 'reg' is used uninitialized in this function [-Wuninitialized]
if ((reg & 0x80) != 0)

make: *** [packages/pcf8574-latest/subdir.mk:21: packages/pcf8574-latest/pcf8574.o] Error 1
make: *** Waiting for unfinished jobs....
"make -j20 all" terminated with exit code 2. Build might be incomplete.

里面的读写使用的是rt_device_read(&dev->bus->parent, dev->i2c_addr, &value, 1);

而不是rt_i2c_transfer((struct rt_i2c_bus_device *)dev->bus, &msgs, 1)

被遗忘更新了?


回帖(1)

贾飞小

2023-1-11 14:58:25
类型没有匹配起来, 确认下 dev 是哪个类型?rt_device_read 需要 rt_device_t 类型,也就是 struct rt_device *
举报

更多回帖

发帖
×
20
完善资料,
赚取积分