/* Polls the device for a new X/Y/Z reading.  */
err_t l3gd20Poll(l3gd20Data_t *data)
/* Polls the device for a new X/Y/Z reading.  */
err_t l3gd20Poll(l3gd20Data_t *data)
{
  uint8_t timeout = 0;
  uint8_t buffer;
  if (!_l3gd20Initialised)
  {
    ASSERT_STATUS(l3gd20Init());
  }
  do
  {
    ASSERT_STATUS(l3gd20Read8(L3GD20_REGISTER_STATUS_REG, &buffer));
    ASSERT(timeout++ <= L3GD20_POLL_TIMEOUT, ERROR_OPERATIONTIMEDOUT);
  } while (!(buffer & (1<<3)));
  ASSERT_STATUS(l3gd20Read48(L3GD20_REGISTER_OUT_X_L | (1<<7), &(data->x), &(data->y), &(data->z)));
  return ERROR_NONE;
}