The TWI transaction manager library provides functions to create and execute transactions consisting of one or more data transfers via the two-wire interface (TWI).
Transactions can be run in the background or in blocking mode:
Transactions can be requested from different contexts, including interrupt handlers. The library takes care of proper synchronization.
You can suppress the generation of a stop condition for selected transfers. In this case, the following transfer will start with a repeated start condition. The following example code shows how to first write one byte (for example, an register address) and then read 4 bytes, without a stop condition in between:
The API for this module is available here: TWI transaction manager. See the TWI Transaction Manager Example for a usage example.