Hi, I would like to know if there's a way to change the size of a transfer with the app_twi library.
For example if in a function I have this code :
static app_twi_transfer_t const transfers[] =
{
APP_TWI_WRITE(device_address, ®ister_address, 1, APP_TWI_NO_STOP),
APP_TWI_READ (device_address, p_buffer, 4, 0)
};
static app_twi_transaction_t const transaction =
{
.callback = transaction_callback,
.p_user_data = NULL,
.p_transfers = transfers,
.number_of_transfers = sizeof(transfers)/sizeof(transfers[0])
};
APP_ERROR_CHECK(app_twi_schedule(&m_app_twi, &transaction));
I want to be able to change the 4 in the APP_TWI_READ for a variable that is received by the function.
I want to read more than one register at a time with i2c but not always the same number and I don't know how to resize a static or a constant variable.