i2c_master_send()函数实例

ssize_t mt6326_write_byte(u8 cmd, u8 writeData)
{
    char    write_data[2] = {0};
    int    ret=0;
    
    write_data[0] = cmd;         // ex. 0x81
    write_data[1] = writeData;// ex. 0x44
    
    ret = i2c_master_send(new_client, write_data, 2);   //可以看   ret = i2c_master_send(new_client, write_data, 2);   向client 发送write_data[0] = cmd;         // ex. 0x81
                                                                            //   write_data[1] = writeData;// ex. 0x44  先发命令  后数据。   2表示发送的大小。
    if (ret < 0) {  ret = i2c_master_send(new_client, write_data, 2);
        #ifdef CONFIG_TESTCASE_MSG
        printk("sends command error!! \n");
        #endif
        return 0;
    }
    
    return 1;
}


你可能感兴趣的:(i2c_master_send()函数实例)