I am converting Arduino BNO080 library (github.com/.../SparkFun_BNO080_Arduino_Library) to nRF52832.
Specifically, this is a function for sending a SHTP packet over I2C:
_i2cPort->beginTransmission(_deviceAddress);
//Send the 4 byte packet header
_i2cPort->write(packetLength & 0xFF); //Packet length LSB
_i2cPort->write(packetLength >> 8); //Packet length MSB
_i2cPort->write(channelNumber); //Channel number
_i2cPort->write(sequenceNumber[channelNumber]++); //Send the sequence number, increments with each packet sent, different counter for each channel
//Send the user's data packet
for (uint8_t i = 0 ; i < dataLength ; i++)
{
_i2cPort->write(shtpData[i]);
}
if (_i2cPort->endTransmission() != 0)
{
return (false);
}
How do I check for a stop condition (similar to Wire->endTransmission() !=0) using nRF52832 TWI library?