[sim] some preliminary fixes for simulating aspirin imu

This commit is contained in:
Felix Ruess
2012-05-29 18:29:45 +02:00
parent 2b0b033451
commit fedf204245
2 changed files with 16 additions and 2 deletions
@@ -26,7 +26,7 @@
#include "generated/airframe.h"
void imu_aspirin_arch_init(void) {
imu_aspirin.status = AspirinStatusIdle;
}
@@ -35,7 +35,7 @@ void imu_aspirin_arch_init(void) {
void imu_feed_gyro_accel(void) {
#if 1
#if 0
// the high byte is in buf[0], low byte in buf[1], etc.
imu_aspirin.i2c_trans_gyro.buf[0] = ((int16_t)sensors.gyro.value.x) >> 8;
imu_aspirin.i2c_trans_gyro.buf[1] = ((int16_t)sensors.gyro.value.x) & 0xff;
+14
View File
@@ -234,8 +234,22 @@ static inline void imu_aspirin_event(void (* _gyro_handler)(void), void (* _acce
}
#ifndef SITL
#define ImuEvent(_gyro_handler, _accel_handler, _mag_handler) do { \
imu_aspirin_event(_gyro_handler, _accel_handler, _mag_handler); \
} while(0);
#else
#define ImuEvent(_gyro_handler, _accel_handler, _mag_handler) { \
if (imu_aspirin.accel_available) { \
imu_aspirin.accel_available = FALSE; \
_accel_handler(); \
} \
if (imu_aspirin.gyro_available_blaaa) { \
imu_aspirin.gyro_available_blaaa = FALSE; \
_gyro_handler(); \
} \
ImuMagEvent(_mag_handler); \
}
#endif
#endif /* IMU_ASPIRIN_H */