/* Sends a Byte through the SPI interface and return the Byte received from the SPI bus.  */
static uint8_t L3GD20_SendByte(uint8_t byte)
/* Sends a Byte through the SPI interface and return the Byte received from the SPI bus.  */
static uint8_t L3GD20_SendByte(uint8_t byte)
{
  L3GD20Timeout = L3GD20_FLAG_TIMEOUT;
  while (SPI_I2S_GetFlagStatus(L3GD20_SPI, SPI_I2S_FLAG_TXE) == RESET)
  {
    if((L3GD20Timeout--) == 0) return L3GD20_TIMEOUT_UserCallback();
  }
  SPI_SendData8(L3GD20_SPI, byte);
  L3GD20Timeout = L3GD20_FLAG_TIMEOUT;
  while (SPI_I2S_GetFlagStatus(L3GD20_SPI, SPI_I2S_FLAG_RXNE) == RESET)
  {
    if((L3GD20Timeout--) == 0) return L3GD20_TIMEOUT_UserCallback();
  }
  return (uint8_t)SPI_ReceiveData8(L3GD20_SPI);
}