/* Sends a Byte through the SPI interface and return the Byte received from the SPI bus.  */
static uint8_t LIS302DL_SendByte(uint8_t byte)
/* Sends a Byte through the SPI interface and return the Byte received from the SPI bus.  */
static uint8_t LIS302DL_SendByte(uint8_t byte)
{
  LIS302DLTimeout = LIS302DL_FLAG_TIMEOUT;
  while (SPI_I2S_GetFlagStatus(LIS302DL_SPI, SPI_I2S_FLAG_TXE) == RESET)
  {
    printf("wait reset SPI_I2S_FLAG_TXE\n");
  }
  SPI_I2S_SendData(LIS302DL_SPI, byte);
  LIS302DLTimeout = LIS302DL_FLAG_TIMEOUT;
  while (SPI_I2S_GetFlagStatus(LIS302DL_SPI, SPI_I2S_FLAG_RXNE) == RESET)
  {
    printf("wait reset SPI_I2S_FLAG_RXNE\n");
  }
  return (uint8_t)SPI_I2S_ReceiveData(LIS302DL_SPI);
}