hey i am using ADS1292 for my own project, and myself is confused with SPI protocol.
i found some code on the internet and i found it sends and receive at one time.
for example, i want to send 0xFF to slave device.
then it sends the data first and wait for a receive.
And when receiving data, it sends a dummy byte and then receive.
Anyone please explain why they do this?
uint8_t sEE_ReadByte(void)
{
return (sEE_SendByte(sEE_DUMMY_BYTE));
}
uint8_t sEE_SendByte(uint8_t byte)
{
/*!< Loop while DR register in not empty */
while (SPI_I2S_GetFlagStatus(sEE_SPI, SPI_I2S_FLAG_TXE) == RESET);
/*!< Send byte through the SPI peripheral */
SPI_SendData(sEE_SPI, byte);
/*!< Wait to receive a byte => I do not understand this point*/
while (SPI_I2S_GetFlagStatus(sEE_SPI, SPI_I2S_FLAG_RXNE) == RESET);
/*!< Return the byte read from the SPI bus */
return (uint8_t)SPI_ReceiveData(sEE_SPI);
}