diff --git a/conf/autopilot/subsystems/rotorcraft/imu_aspirin.makefile b/conf/autopilot/subsystems/rotorcraft/imu_aspirin.makefile index d328823c55..bcaacda6b3 100644 --- a/conf/autopilot/subsystems/rotorcraft/imu_aspirin.makefile +++ b/conf/autopilot/subsystems/rotorcraft/imu_aspirin.makefile @@ -60,3 +60,7 @@ imu_CFLAGS += -DUSE_I2C2 -DUSE_EXTI9_5_IRQ # see: conf/autopilot/subsystems/lisa_passthrough/imu_b2_v1.1.makefile for example ap.CFLAGS += $(imu_CFLAGS) ap.srcs += $(imu_srcs) + + +sim.CFLAGS += $(imu_CFLAGS) +sim.srcs += $(imu_srcs) diff --git a/sw/airborne/arch/sim/peripherals/hmc5843_arch.c b/sw/airborne/arch/sim/peripherals/hmc5843_arch.c new file mode 100644 index 0000000000..7c3b6c5b95 --- /dev/null +++ b/sw/airborne/arch/sim/peripherals/hmc5843_arch.c @@ -0,0 +1,26 @@ +/* + * Copyright (C) 2011 The Paparazzi Team + * + * This file is part of paparazzi. + * + * paparazzi is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * paparazzi is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with paparazzi; see the file COPYING. If not, write to + * the Free Software Foundation, 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#include "peripherals/hmc5843.h" + +void hmc5843_arch_init( void ) {} + +void hmc5843_read( void ) {} diff --git a/sw/airborne/arch/sim/peripherals/hmc5843_arch.h b/sw/airborne/arch/sim/peripherals/hmc5843_arch.h new file mode 100644 index 0000000000..5934753575 --- /dev/null +++ b/sw/airborne/arch/sim/peripherals/hmc5843_arch.h @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2011 The Paparazzi Team + * + * This file is part of paparazzi. + * + * paparazzi is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * paparazzi is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with paparazzi; see the file COPYING. If not, write to + * the Free Software Foundation, 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +/* + * + * simulator plug for hmc5843 + * + */ + +#ifndef HMC5843_HW_H +#define HMC5843_HW_H + + +#endif /* HMC5843_HW_H */ diff --git a/sw/airborne/arch/sim/subsystems/imu/imu_aspirin_arch.c b/sw/airborne/arch/sim/subsystems/imu/imu_aspirin_arch.c new file mode 100644 index 0000000000..383dd78880 --- /dev/null +++ b/sw/airborne/arch/sim/subsystems/imu/imu_aspirin_arch.c @@ -0,0 +1,58 @@ +/* + * $Id$ + * + * Copyright (C) 2008-2009 Antoine Drouin + * + * This file is part of paparazzi. + * + * paparazzi is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * paparazzi is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with paparazzi; see the file COPYING. If not, write to + * the Free Software Foundation, 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#include "subsystems/imu.h" + +#include "generated/airframe.h" + +void imu_aspirin_arch_init(void) { + +} + +void imu_periodic(void) { + +} + +#include "nps_sensors.h" + +void imu_feed_gyro_accel(void) { + + /* do something similar to this, fill imu_aspirin.i2c_trans_gyro and + * imu_aspirin.accel_rx_buf + */ + max1168_values[IMU_GYRO_P_CHAN] = sensors.gyro.value.x; + max1168_values[IMU_GYRO_Q_CHAN] = sensors.gyro.value.y; + max1168_values[IMU_GYRO_R_CHAN] = sensors.gyro.value.z; + max1168_values[IMU_ACCEL_X_CHAN] = sensors.accel.value.x; + max1168_values[IMU_ACCEL_Y_CHAN] = sensors.accel.value.y; + max1168_values[IMU_ACCEL_Z_CHAN] = sensors.accel.value.z; + max1168_status = STA_MAX1168_DATA_AVAILABLE; +} + + +void imu_feed_mag(void) { + hmc5843.data.value[IMU_MAG_X_CHAN] = sensors.mag.value.x; + hmc5843.data.value[IMU_MAG_Y_CHAN] = sensors.mag.value.y; + hmc5843.data.value[IMU_MAG_Z_CHAN] = sensors.mag.value.z; + hmc5843.data_available = TRUE; +} diff --git a/sw/airborne/arch/sim/subsystems/imu/imu_aspirin_arch.h b/sw/airborne/arch/sim/subsystems/imu/imu_aspirin_arch.h new file mode 100644 index 0000000000..ca9896b01a --- /dev/null +++ b/sw/airborne/arch/sim/subsystems/imu/imu_aspirin_arch.h @@ -0,0 +1,37 @@ +/* + * $Id$ + * + * Copyright (C) 2008-2009 Antoine Drouin + * + * This file is part of paparazzi. + * + * paparazzi is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * paparazzi is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with paparazzi; see the file COPYING. If not, write to + * the Free Software Foundation, 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +/* + * + * simulator plug for the booz2 v1 imu arch dependant functions + * + */ +#ifndef IMU_ASPIRIN_ARCH_H +#define IMU_ASPIRIN_ARCH_H + + +extern void imu_feed_gyro_accel(void); +extern void imu_feed_mag(void); + + +#endif /* IMU_ASPIRIN_ARCH_H */