RT-Thread-Studio / sdk-bsp-stm32h750-realthread-artpi

323 stars 203 forks source link

关于ov2640基地址的问题 #169

Open fortunerains opened 3 years ago

fortunerains commented 3 years ago

手册上写的设备地址是60,为什么程序里面是0x30,求教谢谢

liukangcc commented 3 years ago

0x60 = 0x30 << 1

static rt_err_t i2c_bit_send_address(struct rt_i2c_bus_device *bus,
                                     struct rt_i2c_msg        *msg)
{
   .
   .
   .  
    else
    {
        /* 7-bit addr */
        addr1 = msg->addr << 1;
        if (flags & RT_I2C_RD)
            addr1 |= 1;
        ret = i2c_send_address(bus, addr1, retries);
        if ((ret != 1) && !ignore_nack)
            return -RT_EIO;
    }

    return RT_EOK;
}