uint32_t librpipTransactionRead(struct librpip_tx* t, void* result, uint16_t len);


Reads received data from a transaction. If a transaction contains multiple RX message segments then librpipTransactionRead() is called multiple times, one for each segment.

Reading a unset transaction will just return zeros.


  • struct librpip_tx* t
    A pointer to a transaction that is to be read. This will have been created from a previous librpipTransactionCreate() and should have been sent using librpipTransactionSend().
  • void* result
    A buffer to hold the result in.
  • uint16_t len
    The length of the buffer. The buffer should be large enough to hold the result but will just get truncated if not.


0 on failure or 1 on success.


Create a transaction to read several registers over I2C and print them out:

uint8_t[2] result;
struct librpip_tx* readAccel;
readAccel = librpipTransactionCreate(LIBRPIP_TX_MODE_I2C,8);
librpipTransactionMsgAddRegRead(readAccel, 0x3b, 2);
librpipTransactionMsgAddRegRead(readAccel, 0x3d, 2);
librpipTransactionMsgAddRegRead(readAccel, 0x3f, 2);

librpipTransactionSend(readAccel, 0, 0x31); //i2c0,client 0x31

librpipTransactionRead(readAccel, &result[0], sizeof(result));
fprintf(stdout,"Reg 0x3b has values %x%x\n",result[0],result[1]);

librpipTransactionRead(readAccel, &result[0], sizeof(result));
fprintf(stdout,"Reg 0x3d has values %x%x\n",result[0],result[1]);

librpipTransactionRead(readAccel, &result[0], sizeof(result));
fprintf(stdout,"Reg 0x3f has values %x%x\n",result[0],result[1]);