/* Reads the sensor and returns the data as a sensors_event_t.  */
err_t adxl345GetSensorEvent(sensors_event_t *event)
/* Reads the sensor and returns the data as a sensors_event_t.  */
err_t adxl345GetSensorEvent(sensors_event_t *event)
{
  int16_t x, y, z;
  memset(event, 0, sizeof(sensors_event_t));
  event->version   = sizeof(sensors_event_t);
  event->sensor_id = _adxl345SensorID;
  event->type      = SENSOR_TYPE_ACCELEROMETER;
  event->timestamp = delayGetTicks();
  ASSERT_STATUS(adxl345GetXYZ(&x, &y, &z));
  event->acceleration.x = x * ADXL345_MG2G_MULTIPLIER * SENSORS_GRAVITY_STANDARD;
  event->acceleration.y = y * ADXL345_MG2G_MULTIPLIER * SENSORS_GRAVITY_STANDARD;
  event->acceleration.z = z * ADXL345_MG2G_MULTIPLIER * SENSORS_GRAVITY_STANDARD;
  return ERROR_NONE;
}