/* Reads the sensor and returns the data as a sensors_event_t.  */
err_t lsm303accelGetSensorEvent(sensors_event_t *event)
/* Reads the sensor and returns the data as a sensors_event_t.  */
err_t lsm303accelGetSensorEvent(sensors_event_t *event)
{
  memset(event, 0, sizeof(sensors_event_t));
  event->version   = sizeof(sensors_event_t);
  event->sensor_id = _lsm303accelSensorID;
  event->type      = SENSOR_TYPE_ACCELEROMETER;
  event->timestamp = delayGetTicks();
  ASSERT_STATUS(lsm303accelRead());
  event->acceleration.x = _lsm303accelData.x * _lsm303accel_MG_LSB * SENSORS_GRAVITY_STANDARD;
  event->acceleration.y = _lsm303accelData.y * _lsm303accel_MG_LSB * SENSORS_GRAVITY_STANDARD;
  event->acceleration.z = _lsm303accelData.z * _lsm303accel_MG_LSB * SENSORS_GRAVITY_STANDARD;
  return ERROR_NONE;
}