uint32_t librpipTransactionMsgVarSet(struct librpip_tx* t, char var, void* txbuf, uint16_t len);


Sets a previously created variable message segment prior to sending the transaction. Variable segments are used when the data to transfer is unknown at transaction creation time or changes throughout the life of a transaction. e.g. writing characters to a LCD screen.

The variable segment needs to be set at least once, but can be reset as often as needed by rerunning librpipTransactionMsgVarSet().


  • struct librpip_tx* t
    A pointer to a transaction that is to have the variable message segment updated. This will have been created from a previous librpipTransactionCreate().
  • char var
    The variable name to update. This needs to match the name set when the message segment was created in librpipTransactionMsgVarAdd().
  • void* txbuf
    A pointer to an 8bit buffer of some sort containing data to send. LIBRPIP_TX_MSG_RX (receive) messages should pass a zero. Data provided is copied into an internal data structure so once this call has been made, txbuf can be freed, changed, zeroed etc.
  • uint16_t len
    The length of the buffer. For LIBRPIP_TX_MSG_RX (receive) messages this is the length of the receive buffer.


0 on failure or 1 on success.


Create a transaction to write to a LCD display over I2C:

uint8_t cmd;
struct librpip_tx* WriteLCD;
WriteLCD=librpipTransactionCreate(LIBRPIP_TX_MODE_I2C, 8);
librpipTransactionMsgAdd(WriteLCD, LIBRPIP_TX_MSG_TX, &cmd, 1);
librpipTransactionMsgVarAdd(WriteLCD, LIBRPIP_TX_MSG_TX, '1');
librpipTransactionMsgAdd(WriteLCD, LIBRPIP_TX_MSG_TX, &cmd, 1);
librpipTransactionMsgVarAdd(WriteLCD, LIBRPIP_TX_MSG_TX, '2');

librpipTransactionMsgVarSet(WriteLCD, '1', "Hello - LCD line 1  ", 20);
librpipTransactionMsgVarSet(WriteLCD, '2', "Hello - LCD line 2  ", 20);
librpipTransactionSend(WriteLCD, 0, 0x31);


librpipTransactionMsgVarSet(WriteLCD, '1', "Something different ", 20);
librpipTransactionMsgVarSet(WriteLCD, '2', "is on the LCD now   ", 20);
librpipTransactionSend(WriteLCD, 0, 0x31);


(Note this example is just that – an example. To see and actual I2C LCD being driven by librpip see this code)