Okay, I will do my best to keep this question succinct and understandable! Thanks in advance for any advice.
I have been working on a project involving the bno055 IMU board from bosch. I managed to successfully talk with the board via UART but am switching to I2C in order to use the BoschSensorTec bno055 Driver Library. And it's additional functionality. This has proved challenging, though. I am not nearly as familiar with I2C as I am with UART but I have been reading up and watching video tutorials to understand its protocol.
The library is a .c file and a .h file, but in order to integrate the library into my project I have to write I2C driver bus read and bus write functions and link them to communication function pointers in the bosch API. What I am trying to make sure of is that the Tivaware I2C functions will function in a way that is compatible with the bno055. The picture below is from page 92 of the bno055 datasheet.
Let's focus on the simpler "Write" sequence for now, at the top of the picture. If I write this chunk of code, will it correctly do this?
void bno_write(u8 dev_address, u8 reg_address){ I2CMasterSlaveAddrSet(I2C0_BASE, dev_address, false); I2CMasterDataPut(I2C0_BASE, reg_address); I2CMasterControl(I2C0_BASE, I2C_MASTER_CMD_SINGLE_SEND); while(I2CMasterBusy(I2C0_BASE)); if (I2CMasterErr(I2C0_BASE) == true){ printf("Write Error. \n"); } }
I'm not sure what's happening when I call these big I2C functions. If I set the slave address, load in the data to be sent, then call the I2CMasterControl single send command, will it do what the bno055 requires in the picture? Such as wait for acks from the bno055 before continuing from address to register address to data? My biggest problem is that I am unsure of what the I2C functions that I write - BNO055_I2C_bus_read and bus_write in the picture I included - need to be doing.
I apologize if this question is incorrectly phrased. I am still sorting out the truckload of concepts here, and my mind is a bit frazzled from pouring through 6 PDFs (three on the bno055, two on the tiva, and one on i2c communication).
Thank you!