Hallo,
I am using "Adafruit_7-Segment LEDBackpack" with "Arduino-UNO". Everything works perfect.
But just need to know about "Wire.endTransmission()" its in "Adafruit_LEDBackpack.cpp" file . coz, I want to do same project with "efm8bb10f8g" microcontroller.
So, Wire.endTransmission() --> goes in "wire.cpp" file and calls
uint8_t TwoWire::endTransmission(void) ---> and then calls
That is one of the most ridiculous Web links I have ever seen!
It appears to be one version of explanation of the I2C protocol, but not the usual one.
You are correct about sending several successive data frames in one transaction, but as far as I can tell, the only way to cease sending frames without a STOP code is to stop the clock. If you do that, it will cause a time out fault and yes, you are locking up the bus in the meantime.
The value is that it increases performance because you don't have to go through the extra overhead of start and end bus negotiations between each byte transfer.
It can also reduce overall i2c bus utilization and reduce CPU overhead.
The Wire library supports multiple write() functions.
write(data);
write(ptr, count);
Ideally if you have all the bytes ready in a buffer you can use the write() call that allows passing a pointer to the data buffer and a count.
If not, you can call the other version for write() to send the bytes 1 at a time before you call the endTransmission() function.
Just be aware that the write() that uses a count can not send more than 32 bytes a time.
I do exactly what you are talking about in a hd44780 LCD backpack library I've written.
For something like a hd44780 LCD which uses a PCF8574 of MCP32008 i/o expander it means you can send out multiple i2c bytes to the i/o port in the same bus acquisition.
I do this for sending each lcd byte to the hd44780 display through the i2c i/o expander as each lcd byte being sent to the LCD requires sending multiple i2c bytes to the i/o expander.
Each lcd byte sent to the display must be broken into nibbles and each nibble requires sending two i2c data bytes to the i/o port.
So each lcd byte sent to the hd44780 interface needs 8 i2c bytes sent to the hd44780 i/o port.
Each i2c byte could be sent separately but instead, I grab the bus, send the 8 i2c bytes, and let go.