diff options
author | Keith Packard <keithp@keithp.com> | 2012-10-13 15:02:42 -0700 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2012-10-13 15:02:42 -0700 |
commit | 5caf56e89678637c1afa79700a2fa09aa67dea9b (patch) | |
tree | 4449555e7b82ceabf1bc1a35b6f2872ec8fd0156 /src | |
parent | 321d0f68c04a5a9c6ea7874081e6245d44c48bb4 (diff) |
altos: When missing MMA655x, create fake Z accel value
This avoids overwriting the MPU6000 y acceleration value so that other
computations using that value can work unmodified.
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/core/ao_data.h | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/core/ao_data.h b/src/core/ao_data.h index 1153d433..86acd48f 100644 --- a/src/core/ao_data.h +++ b/src/core/ao_data.h @@ -67,6 +67,9 @@ struct ao_data { #endif #if HAS_MPU6000 struct ao_mpu6000_sample mpu6000; +#if !HAS_MMA655X + int16_t z_accel; +#endif #endif #if HAS_HMC5883 struct ao_hmc5883_sample hmc5883; @@ -285,9 +288,9 @@ typedef int16_t accel_t; typedef int16_t accel_t; /* MPU6000 is hooked up so that positive y is positive acceleration */ -#define ao_data_accel(packet) ((packet)->mpu6000.accel_y) +#define ao_data_accel(packet) ((packet)->z_accel) #define ao_data_accel_cook(packet) (-(packet)->mpu6000.accel_y) -#define ao_data_set_accel(packet, accel) ((packet)->mpu6000.accel_y = (accel)) +#define ao_data_set_accel(packet, accel) ((packet)->z_accel = (accel)) #define ao_data_accel_invert(a) (-(a)) #endif |