/* Polls the device for a new X/Y/Z reading.  */
err_t lis3dhPoll(lis3dhData_t *data)
/* Polls the device for a new X/Y/Z reading.  */
err_t lis3dhPoll(lis3dhData_t *data)
{
  uint8_t timeout = 0;
  uint8_t buffer = 0x00;
  if (!_lis3dhInitialised)
  {
    ASSERT_STATUS(lis3dhInit());
  }
  do
  {
    ASSERT_STATUS(lis3dhRead8(LIS3DH_REGISTER_STATUS_REG_AUX, &buffer));
    ASSERT(timeout++ <= LIS3DH_POLL_TIMEOUT, ERROR_OPERATIONTIMEDOUT);
  } while (!(buffer & LIS3DH_STATUS_REG_ZYXDA));
  ASSERT_STATUS(lis3dhRead48(LIS3DH_REGISTER_OUT_X_L, &(data->x), &(data->y), &(data->z)));
  return ERROR_NONE;
}