diff options
author | Lorenz Meier <lm@inf.ethz.ch> | 2012-08-27 09:48:16 +0200 |
---|---|---|
committer | Lorenz Meier <lm@inf.ethz.ch> | 2012-08-27 09:48:16 +0200 |
commit | 967c0869a962f9288a54926b5eec9587f9c11df3 (patch) | |
tree | d5369276886843b4232ca5a9a38c61ffbffdb67b /apps/drivers/mpu6000/mpu6000.cpp | |
parent | 248bb11d933cae03d7e57f0b746fd416204c2b3d (diff) | |
download | px4-firmware-967c0869a962f9288a54926b5eec9587f9c11df3.tar.gz px4-firmware-967c0869a962f9288a54926b5eec9587f9c11df3.tar.bz2 px4-firmware-967c0869a962f9288a54926b5eec9587f9c11df3.zip |
Cleaned up MPU driver slightly
Diffstat (limited to 'apps/drivers/mpu6000/mpu6000.cpp')
-rw-r--r-- | apps/drivers/mpu6000/mpu6000.cpp | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/apps/drivers/mpu6000/mpu6000.cpp b/apps/drivers/mpu6000/mpu6000.cpp index 3987e13cc..6060a80f8 100644 --- a/apps/drivers/mpu6000/mpu6000.cpp +++ b/apps/drivers/mpu6000/mpu6000.cpp @@ -818,28 +818,22 @@ MPU6000::measure() /* * Convert from big to little endian */ - // report.accel_x = ((int16_t)(mpu_report.accel_x[0]) << 8); - // report.accel_x |= mpu_report.accel_x[1]; - // report.accel_y = ((int16_t)(mpu_report.accel_y[0]) << 8); - // report.accel_y |= mpu_report.accel_y[1]; - // report.accel_z = ((int16_t)(mpu_report.accel_z[0]) << 8); - // report.accel_z |= mpu_report.accel_z[1]; report.accel_x = int16_t_from_bytes(mpu_report.accel_x); report.accel_y = int16_t_from_bytes(mpu_report.accel_y); report.accel_z = int16_t_from_bytes(mpu_report.accel_z); - report.temp = (((int16_t)mpu_report.temp[0]) << 8) | mpu_report.temp[1]; + report.temp = int16_t_from_bytes(mpu_report.temp); report.gyro_x = int16_t_from_bytes(mpu_report.gyro_x); - report.gyro_y = ((int16_t)(mpu_report.gyro_y[0]) << 8) | mpu_report.gyro_y[1]; - report.gyro_z = ((int16_t)(mpu_report.gyro_z[0]) << 8) | mpu_report.gyro_z[1]; + report.gyro_y = int16_t_from_bytes(mpu_report.gyro_y); + report.gyro_z = int16_t_from_bytes(mpu_report.gyro_z); /* * Swap axes and negate y */ int16_t accel_xt = report.accel_y; - int16_t accel_yt = report.accel_x;//((report.accel_x == -32768) ? 32767 : -report.accel_x); + int16_t accel_yt = ((report.accel_x == -32768) ? 32767 : -report.accel_x); int16_t gyro_xt = report.gyro_y; int16_t gyro_yt = ((report.gyro_x == -32768) ? 32767 : -report.gyro_x); |