I2C interface device

Discussion about Parallella (and Epiphany) Software Development

Moderators: amylaar, jeremybennett, simoncook

I2C interface device

Postby Collaborative » Tue Nov 03, 2015 2:15 pm

Dear all,

I am trying to implement I2C communication between Parallella (master) and Arduino (slave).
What it is not clear for me is the write function:

/* Using I2C Write, equivalent of
i2c_smbus_write_word_data(file, reg, 0x6543) */
buf[0] = reg;
buf[1] = 0x43;
buf[2] = 0x65;
if (write(file, buf, 3) != 3) {
/* ERROR HANDLING: i2c transaction failed */
}

my question is: what are exactly buf[0],buf[1],buf[2]?
Is it buf[0] the register of Arduino where I would like to write?
Are buf[1] and buf[2] the data to send from Parallella to Arduino?

Thanks! :mrgreen:
Collaborative
 
Posts: 3
Joined: Thu Oct 29, 2015 9:23 am

Return to Programming Q & A

Who is online

Users browsing this forum: No registered users and 7 guests

cron