2020-05-31 10:32 AM
I have array unsigned char data[1024] in RAM , and I need to send them to the display on I2C, this is not problem HAL_I2C_Master_Transmit( data ) works fine.
Now I need to send the same data, but so that the sequence starts with a control byte.
is IT possible to use two function calls
HAL_I2C_Master_Transmit(Control_byte):
HAL_I2C_Master_Transmit(data);
Respectively, the result on i2C will be the same as when I send
dataWithCB=Control_byte+data;
HAL_I2C_Master_Transmit(dataWithCB):
or how else to send the data so that the result is the same
Thanks for info.
2020-05-31 11:37 AM
What specifically does the display data sheet say it needs?
Some connect to the I2C slave, send an address, and then a byte stream. The internal address may be 1 or 2 bytes wide.
One could presumably use two calls, copy to a temp buffer, or daisy chain from a scatter-gather list using the interrupt versions.
See HAL_I2C_Mem_Write() forms
2020-06-03 08:05 PM
HAL_I2C_Master_Seq_Transmit_IT(&hi2c, I2C_ADDR, &control_byte, 1, I2C_FIRST_FRAME);
/* wait transmit complete */
while (HAL_I2C_GetState(&hi2c) != HAL_I2C_STATE_READY);
HAL_I2C_Master_Seq_Transmit_IT(&hi2c, I2C_ADDR, data, sizeof(data), I2C_LAST_FRAME);
/* wait transmit complete */
while (HAL_I2C_GetState(&hi2c) != HAL_I2C_STATE_READY);
don't know if this works for you