summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sensors/akm8963.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/sensors/akm8963.c b/sensors/akm8963.c
index 96d35ca..d5cad3f 100644
--- a/sensors/akm8963.c
+++ b/sensors/akm8963.c
@@ -36,11 +36,11 @@ struct akm8963_data {
struct smdk4x12_sensors_handlers *orientation_sensor;
sensors_vec_t magnetic;
- unsigned short magnetic_data[4][3];
+ short magnetic_data[4][3];
int magnetic_data_count;
int magnetic_data_index;
- unsigned short magnetic_extrema[2][3];
+ short magnetic_extrema[2][3];
unsigned char asa[3];
int ho[3];
@@ -74,8 +74,8 @@ int akm8963_magnetic_extrema(struct akm8963_data *data, int index)
return -EINVAL;
// Calculate the extrema from HO (software offset)
- data->magnetic_extrema[0][index] = (unsigned short) ((-45.0f + 0.06 * data->ho[index]) / (0.15f * (((data->asa[index] - 128) * 0.5f) / 128 + 1)));
- data->magnetic_extrema[1][index] = (unsigned short) ((45.0f + 0.06 * data->ho[index]) / (0.15f * (((data->asa[index] - 128) * 0.5f) / 128 + 1)));
+ data->magnetic_extrema[0][index] = (short) ((-45.0f + 0.06 * data->ho[index]) / (0.15f * (((data->asa[index] - 128) * 0.5f) / 128 + 1)));
+ data->magnetic_extrema[1][index] = (short) ((45.0f + 0.06 * data->ho[index]) / (0.15f * (((data->asa[index] - 128) * 0.5f) / 128 + 1)));
return 0;
}
@@ -206,7 +206,7 @@ complete:
}
int akm8963_ho_calibration(struct akm8963_data *data,
- unsigned short *magnetic_data, size_t magnetic_data_size)
+ short *magnetic_data, size_t magnetic_data_size)
{
float ho[2];
int gain_index;
@@ -286,7 +286,7 @@ void *akm8963_thread(void *thread_data)
struct input_event event;
struct timeval time;
unsigned char i2c_data[8] = { 0 };
- unsigned short magnetic_data[3] = { 0 };
+ short magnetic_data[3] = { 0 };
int index;
long int before, after;
int diff;
@@ -332,9 +332,9 @@ void *akm8963_thread(void *thread_data)
goto next;
}
- magnetic_data[0] = (unsigned short) ((i2c_data[2] << 8) | (i2c_data[1] & 0xff));
- magnetic_data[1] = (unsigned short) ((i2c_data[4] << 8) | (i2c_data[3] & 0xff));
- magnetic_data[2] = (unsigned short) ((i2c_data[6] << 8) | (i2c_data[5] & 0xff));
+ magnetic_data[0] = (short) ((i2c_data[2] << 8) | (i2c_data[1] & 0xff));
+ magnetic_data[1] = (short) ((i2c_data[4] << 8) | (i2c_data[3] & 0xff));
+ magnetic_data[2] = (short) ((i2c_data[6] << 8) | (i2c_data[5] & 0xff));
index = data->magnetic_data_index;
@@ -345,7 +345,7 @@ void *akm8963_thread(void *thread_data)
data->magnetic_data_index = (index + 1) % 4;
data->magnetic_data_count++;
- rc = akm8963_ho_calibration(data, (unsigned short *) &magnetic_data, sizeof(magnetic_data));
+ rc = akm8963_ho_calibration(data, (short *) &magnetic_data, sizeof(magnetic_data));
if (rc < 0) {
ALOGE("%s: Unable to calibrate akm8963 HO", __func__);
goto next;