rt_size_t rt_i2c_transfer(struct rt_i2c_bus_device *bus,
struct rt_i2c_msg msgs[],
rt_uint32_t num)
{
rt_size_t ret;
if (bus->ops->master_xfer)
{
#ifdef RT_I2C_DEBUG
for (ret = 0; ret < num; ret++)
{
i2c_dbg("msgs[%d] %c, addr=0x%02x, len=%d\n", ret,
(msgs[ret].flags & RT_I2C_RD) ? 'R' : 'W',
msgs[ret].addr, msgs[ret].len);
}
#endif
rt_mutex_take(&bus->lock, RT_WAITING_FOREVER);
ret = bus->ops->master_xfer(bus, msgs, num);
rt_mutex_release(&bus->lock);
return ret;
}
else
{
i2c_dbg("I2C bus operation not supported\n");
return 0;
}
}
ret = bus->ops->master_xfer(bus, msgs, num);
bus这个变量又通过好几层的参数传过来,有没有什么编辑器可以方便查看到他的付值的,或有什么好方法? |