projects
/
fw
/
altos
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
6a973f7
)
altos: Conditional byte swapping in mpu6000 driver
author
Keith Packard
<keithp@keithp.com>
Tue, 8 May 2012 06:14:14 +0000
(23:14 -0700)
committer
Keith Packard
<keithp@keithp.com>
Sat, 19 May 2012 03:19:00 +0000
(20:19 -0700)
Only needed on LSB machines.
Signed-off-by: Keith Packard <keithp@keithp.com>
src/drivers/ao_mpu6000.c
patch
|
blob
|
history
diff --git
a/src/drivers/ao_mpu6000.c
b/src/drivers/ao_mpu6000.c
index d27c42b04c83187bab6c0d5e0c8a1c8f3d3d5f4b..eb4044be225ebd257aa058eaaf7615fe193f560a 100644
(file)
--- a/
src/drivers/ao_mpu6000.c
+++ b/
src/drivers/ao_mpu6000.c
@@
-73,11
+73,13
@@
ao_mpu6000_sample(struct ao_mpu6000_sample *sample)
int i = sizeof (*sample) / 2;
ao_mpu6000_read(MPU6000_ACCEL_XOUT_H, sample, sizeof (*sample));
- /* byte swap (sigh) */
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+ /* byte swap */
while (i--) {
uint16_t t = *d;
*d++ = (t >> 8) | (t << 8);
}
+#endif
}
#define G 981 /* in cm/s² */