diff options
author | Kyle Repinski <repinski23@gmail.com> | 2015-12-02 13:48:02 -0600 |
---|---|---|
committer | Ziyan <jaraidaniel@gmail.com> | 2016-01-17 22:41:00 +0100 |
commit | 2f7955bc68164c19978120ab7c67a9061ced72a5 (patch) | |
tree | 4720ebd5e166d480c39391d55f078726d137a07e /libsensors | |
parent | 649bf08fa6d1246b0fdee2e5816afb0ffebda54d (diff) | |
download | device_samsung_tuna-2f7955bc68164c19978120ab7c67a9061ced72a5.zip device_samsung_tuna-2f7955bc68164c19978120ab7c67a9061ced72a5.tar.gz device_samsung_tuna-2f7955bc68164c19978120ab7c67a9061ced72a5.tar.bz2 |
sensors: Fill in MPL sensor structs by default.
Since we're not checking which sensor models we have,
we don't need to dynamically do this.
Diffstat (limited to 'libsensors')
-rw-r--r-- | libsensors/MPLSensor.cpp | 75 |
1 files changed, 22 insertions, 53 deletions
diff --git a/libsensors/MPLSensor.cpp b/libsensors/MPLSensor.cpp index 23c67c7..bbdcf3a 100644 --- a/libsensors/MPLSensor.cpp +++ b/libsensors/MPLSensor.cpp @@ -73,26 +73,33 @@ extern "C" { static struct sensor_t sSensorList[] = { {"MPL Gyroscope", "Invensense", 1, SENSORS_GYROSCOPE_HANDLE, - SENSOR_TYPE_GYROSCOPE, 2000.0f, 1.0f, 0.5f, 10000, 0, 0, - SENSOR_STRING_TYPE_GYROSCOPE, "", 0, SENSOR_FLAG_CONTINUOUS_MODE, {}}, + SENSOR_TYPE_GYROSCOPE, GYRO_MPU3050_RANGE, GYRO_MPU3050_RESOLUTION, + GYRO_MPU3050_POWER, 10000, 0, 0, SENSOR_STRING_TYPE_GYROSCOPE, "", + 0, SENSOR_FLAG_CONTINUOUS_MODE, {}}, {"MPL Accelerometer", "Invensense", 1, SENSORS_ACCELERATION_HANDLE, - SENSOR_TYPE_ACCELEROMETER, 10240.0f, 1.0f, 0.5f, 10000, 0, 0, - SENSOR_STRING_TYPE_ACCELEROMETER, "", 0, SENSOR_FLAG_CONTINUOUS_MODE, {}}, + SENSOR_TYPE_ACCELEROMETER, ACCEL_BMA250_RANGE, ACCEL_BMA250_RESOLUTION, + ACCEL_BMA250_POWER, 10000, 0, 0, SENSOR_STRING_TYPE_ACCELEROMETER, "", + 0, SENSOR_FLAG_CONTINUOUS_MODE, {}}, {"MPL Magnetic Field", "Invensense", 1, SENSORS_MAGNETIC_FIELD_HANDLE, - SENSOR_TYPE_MAGNETIC_FIELD, 10240.0f, 1.0f, 0.5f, 10000, 0, 0, - SENSOR_STRING_TYPE_MAGNETIC_FIELD, "", 0, SENSOR_FLAG_CONTINUOUS_MODE, {}}, + SENSOR_TYPE_MAGNETIC_FIELD, COMPASS_YAS530_RANGE, COMPASS_YAS530_RESOLUTION, + COMPASS_YAS530_POWER, 10000, 0, 0, SENSOR_STRING_TYPE_MAGNETIC_FIELD, "", + 0, SENSOR_FLAG_CONTINUOUS_MODE, {}}, {"MPL Orientation", "Invensense", 1, SENSORS_ORIENTATION_HANDLE, - SENSOR_TYPE_ORIENTATION, 360.0f, 1.0f, 9.7f, 10000, 0, 0, - SENSOR_STRING_TYPE_ORIENTATION, "", 0, SENSOR_FLAG_CONTINUOUS_MODE, {}}, + SENSOR_TYPE_ORIENTATION, NINEAXIS_ORIENTATION_RANGE, NINEAXIS_ORIENTATION_RESOLUTION, + NINEAXIS_ORIENTATION_POWER, 10000, 0, 0, SENSOR_STRING_TYPE_ORIENTATION, "", + 0, SENSOR_FLAG_CONTINUOUS_MODE, {}}, {"MPL Rotation Vector", "Invensense", 1, SENSORS_ROTATION_VECTOR_HANDLE, - SENSOR_TYPE_ROTATION_VECTOR, 10240.0f, 1.0f, 0.5f, 10000, 0, 0, - SENSOR_STRING_TYPE_ORIENTATION, "", 0, SENSOR_FLAG_CONTINUOUS_MODE, {}}, + SENSOR_TYPE_ROTATION_VECTOR, NINEAXIS_ROTATION_VECTOR_RANGE, NINEAXIS_ROTATION_VECTOR_RESOLUTION, + NINEAXIS_ROTATION_VECTOR_POWER, 10000, 0, 0, SENSOR_STRING_TYPE_ORIENTATION, "", + 0, SENSOR_FLAG_CONTINUOUS_MODE, {}}, {"MPL Linear Acceleration", "Invensense", 1, SENSORS_LINEAR_ACCEL_HANDLE, - SENSOR_TYPE_LINEAR_ACCELERATION, 10240.0f, 1.0f, 0.5f, 10000, 0, 0, - SENSOR_STRING_TYPE_LINEAR_ACCELERATION, "", 0, SENSOR_FLAG_CONTINUOUS_MODE, {}}, + SENSOR_TYPE_LINEAR_ACCELERATION, NINEAXIS_LINEAR_ACCEL_RANGE, NINEAXIS_LINEAR_ACCEL_RESOLUTION, + NINEAXIS_LINEAR_ACCEL_POWER, 10000, 0, 0, SENSOR_STRING_TYPE_LINEAR_ACCELERATION, "", + 0, SENSOR_FLAG_CONTINUOUS_MODE, {}}, {"MPL Gravity", "Invensense", 1, SENSORS_GRAVITY_HANDLE, - SENSOR_TYPE_GRAVITY, 10240.0f, 1.0f, 0.5f, 10000, 0, 0, - SENSOR_STRING_TYPE_GRAVITY, "", 0, SENSOR_FLAG_CONTINUOUS_MODE, {}}, + SENSOR_TYPE_GRAVITY, NINEAXIS_GRAVITY_RANGE, NINEAXIS_GRAVITY_RESOLUTION, + NINEAXIS_GRAVITY_POWER, 10000, 0, 0, SENSOR_STRING_TYPE_GRAVITY, "", + 0, SENSOR_FLAG_CONTINUOUS_MODE, {}}, }; static unsigned long long irq_timestamp = 0; @@ -1048,46 +1055,8 @@ int MPLSensor::populateSensorList(struct sensor_t *list, size_t len) /* fill in the base values */ memcpy(list, sSensorList, sizeof (struct sensor_t) * 7); - /* first add gyro, accel and compass to the list */ - - /* fill in accel values */ - list[Accelerometer].maxRange = ACCEL_BMA250_RANGE; - list[Accelerometer].resolution = ACCEL_BMA250_RESOLUTION; - list[Accelerometer].power = ACCEL_BMA250_POWER; - - /* fill in compass values */ - list[MagneticField].maxRange = COMPASS_YAS530_RANGE; - list[MagneticField].resolution = COMPASS_YAS530_RESOLUTION; - list[MagneticField].power = COMPASS_YAS530_POWER; - - /* fill in gyro values */ - list[Gyro].maxRange = GYRO_MPU3050_RANGE; - list[Gyro].resolution = GYRO_MPU3050_RESOLUTION; - list[Gyro].power = GYRO_MPU3050_POWER; - - if(mNineAxisEnabled) - { + if (mNineAxisEnabled) { numsensors = 7; - /* all sensors will be added to the list */ - /* fill in orientation values */ - list[Orientation].maxRange = NINEAXIS_ORIENTATION_RANGE; - list[Orientation].resolution = NINEAXIS_ORIENTATION_RESOLUTION; - list[Orientation].power = NINEAXIS_ORIENTATION_POWER; - - /* fill in rotation vector values */ - list[RotationVector].maxRange = NINEAXIS_ROTATION_VECTOR_RANGE; - list[RotationVector].resolution = NINEAXIS_ROTATION_VECTOR_RESOLUTION; - list[RotationVector].power = NINEAXIS_ROTATION_VECTOR_POWER; - - /* fill in gravity values */ - list[Gravity].maxRange = NINEAXIS_GRAVITY_RANGE; - list[Gravity].resolution = NINEAXIS_GRAVITY_RESOLUTION; - list[Gravity].power = NINEAXIS_GRAVITY_POWER; - - /* fill in Linear accel values */ - list[LinearAccel].maxRange = NINEAXIS_LINEAR_ACCEL_RANGE; - list[LinearAccel].resolution = NINEAXIS_LINEAR_ACCEL_RESOLUTION; - list[LinearAccel].power = NINEAXIS_LINEAR_ACCEL_POWER; } else { /* no 9-axis sensors, zero fill that part of the list */ numsensors = 3; |