summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMathias Agopian <mathias@google.com>2010-11-08 14:39:47 -0800
committerAndroid Git Automerger <android-git-automerger@android.com>2010-11-08 14:39:47 -0800
commitbdbd4761dc3466d374e6b3855644e5c57ff6c0a5 (patch)
tree3b02d8b1b7264bb6217edf9464ddf04a260bb490
parent250b4bd145cf2c9795d10b65ac0a24601f4f70d4 (diff)
parent6d510f9d7d40e17a6705f2ed19f1c91f518513a6 (diff)
downloaddevice_samsung_crespo-bdbd4761dc3466d374e6b3855644e5c57ff6c0a5.zip
device_samsung_crespo-bdbd4761dc3466d374e6b3855644e5c57ff6c0a5.tar.gz
device_samsung_crespo-bdbd4761dc3466d374e6b3855644e5c57ff6c0a5.tar.bz2
am 6d510f9d: clean-up how sensor data are reported or calculated.
* commit '6d510f9d7d40e17a6705f2ed19f1c91f518513a6': clean-up how sensor data are reported or calculated.
-rw-r--r--libsensors/sensors.cpp8
-rw-r--r--libsensors/sensors.h3
2 files changed, 7 insertions, 4 deletions
diff --git a/libsensors/sensors.cpp b/libsensors/sensors.cpp
index 7f342d0..a7e79e6 100644
--- a/libsensors/sensors.cpp
+++ b/libsensors/sensors.cpp
@@ -70,15 +70,15 @@ static const struct sensor_t sSensorList[] = {
{ "KR3DM 3-axis Accelerometer",
"STMicroelectronics",
1, SENSORS_ACCELERATION_HANDLE,
- SENSOR_TYPE_ACCELEROMETER, 2*GRAVITY_EARTH, (2*GRAVITY_EARTH)/(256*8), 0.23f, 0, { } },
+ SENSOR_TYPE_ACCELEROMETER, RANGE_A, RESOLUTION_A, 0.23f, 0, { } },
{ "AK8973 3-axis Magnetic field sensor",
"Asahi Kasei Microdevices",
1, SENSORS_MAGNETIC_FIELD_HANDLE,
- SENSOR_TYPE_MAGNETIC_FIELD, 2000.0f, 1.0f/256, 6.8f, 0, { } },
+ SENSOR_TYPE_MAGNETIC_FIELD, 2000.0f, CONVERT_M, 6.8f, 0, { } },
{ "AK8973 Orientation sensor",
"Asahi Kasei Microdevices",
1, SENSORS_ORIENTATION_HANDLE,
- SENSOR_TYPE_ORIENTATION, 360.0f, 1.0f/64.0f, 7.8f, 0, { } },
+ SENSOR_TYPE_ORIENTATION, 360.0f, CONVERT_O, 7.8f, 0, { } },
{ "GP2A Light sensor",
"Sharp",
1, SENSORS_LIGHT_HANDLE,
@@ -90,7 +90,7 @@ static const struct sensor_t sSensorList[] = {
{ "K3G Gyroscope sensor",
"STMicroelectronics",
1, SENSORS_GYROSCOPE_HANDLE,
- SENSOR_TYPE_GYROSCOPE, 2000*M_PI/180.0f, (70.0f/1000.0f)*((float)M_PI/180.0f), 6.1f, 0, { } },
+ SENSOR_TYPE_GYROSCOPE, RANGE_GYRO, CONVERT_GYRO, 6.1f, 0, { } },
};
diff --git a/libsensors/sensors.h b/libsensors/sensors.h
index 606ff18..384d423 100644
--- a/libsensors/sensors.h
+++ b/libsensors/sensors.h
@@ -84,6 +84,8 @@ __BEGIN_DECLS
#define NUMOFACCDATA 8
// conversion of acceleration data to SI units (m/s^2)
+#define RANGE_A (2*GRAVITY_EARTH)
+#define RESOLUTION_A (RANGE_A/(256*NUMOFACCDATA))
#define CONVERT_A (GRAVITY_EARTH / LSG / NUMOFACCDATA)
#define CONVERT_A_X (CONVERT_A)
#define CONVERT_A_Y (-CONVERT_A)
@@ -102,6 +104,7 @@ __BEGIN_DECLS
#define CONVERT_O_R (-CONVERT_O)
// conversion of gyro data to SI units (radian/sec)
+#define RANGE_GYRO (2000.0f*(float)M_PI/180.0f)
#define CONVERT_GYRO ((70.0f / 1000.0f) * ((float)M_PI / 180.0f))
#define CONVERT_GYRO_X (CONVERT_GYRO)
#define CONVERT_GYRO_Y (-CONVERT_GYRO)