added subsystem makefiles for aspirin v1.0 and v1.5

See github issue #96 and plese report other channel/sign problems with other aspirin versions.
Please replace <subsystem name="imu" type="aspirin"/> with <subsystem name="imu" type="aspirin_v1.0"/> (or aspirin_v1.5) in your airframe file.
This commit is contained in:
Felix Ruess
2011-12-06 19:39:56 +01:00
parent 3269a1f7c7
commit bc8e4e7bcf
5 changed files with 170 additions and 70 deletions
@@ -1,66 +1,3 @@
# include $(CFG_SHARED)/imu_aspirin_v1.0.makefile
# Aspirin IMU
#
#
# required xml:
# <section name="IMU" prefix="IMU_">
#
# <define name="GYRO_X_NEUTRAL" value="33924"/>
# <define name="GYRO_Y_NEUTRAL" value="33417"/>
# <define name="GYRO_Z_NEUTRAL" value="32809"/>
#
# <define name="GYRO_X_SENS" value="1.01" integer="16"/>
# <define name="GYRO_Y_SENS" value="1.01" integer="16"/>
# <define name="GYRO_Z_SENS" value="1.01" integer="16"/>
#
# <define name="ACCEL_X_NEUTRAL" value="32081"/>
# <define name="ACCEL_Y_NEUTRAL" value="33738"/>
# <define name="ACCEL_Z_NEUTRAL" value="32441"/>
#
# <define name="ACCEL_X_SENS" value="2.50411474" integer="16"/>
# <define name="ACCEL_Y_SENS" value="2.48126183" integer="16"/>
# <define name="ACCEL_Z_SENS" value="2.51396167" integer="16"/>
#
# <define name="MAG_X_NEUTRAL" value="2358"/>
# <define name="MAG_Y_NEUTRAL" value="2362"/>
# <define name="MAG_Z_NEUTRAL" value="2119"/>
#
# <define name="MAG_X_SENS" value="3.4936416" integer="16"/>
# <define name="MAG_Y_SENS" value="3.607713" integer="16"/>
# <define name="MAG_Z_SENS" value="4.90788848" integer="16"/>
#
# </section>
#
#
# imu aspirin $(warning The imu_aspirin subsystem has been split up into different versions, please replace <subsystem name="imu" type="aspirin"/> with <subsystem name="imu" type="aspirin_v1.0"/> (or aspirin_v1.5) in your airframe file.)
IMU_ASPIRIN_CFLAGS = -DUSE_IMU
IMU_ASPIRIN_CFLAGS += -DIMU_TYPE_H=\"imu/imu_aspirin.h\" -DIMU_OVERRIDE_CHANNELS
IMU_ASPIRIN_SRCS = $(SRC_SUBSYSTEMS)/imu.c \
$(SRC_SUBSYSTEMS)/imu/imu_aspirin.c \
$(SRC_ARCH)/subsystems/imu/imu_aspirin_arch.c
# Magnetometer
IMU_ASPIRIN_SRCS += peripherals/hmc5843.c $(SRC_ARCH)/peripherals/hmc5843_arch.c
IMU_ASPIRIN_CFLAGS += -DUSE_I2C2
ifeq ($(ARCH), lpc21)
#TODO
else ifeq ($(ARCH), stm32)
IMU_ASPIRIN_CFLAGS += -DUSE_EXTI15_10_IRQ # Gyro Int on PC14
IMU_ASPIRIN_CFLAGS += -DUSE_EXTI9_5_IRQ # Mag Int on PB5
IMU_ASPIRIN_CFLAGS += -DUSE_EXTI2_IRQ # Accel Int on PD2
IMU_ASPIRIN_CFLAGS += -DUSE_DMA1_C4_IRQ # SPI2 Rx DMA
endif
# Keep CFLAGS/Srcs for imu in separate expression so we can assign it to other targets
# see: conf/autopilot/subsystems/lisa_passthrough/imu_b2_v1.1.makefile for example
ap.CFLAGS += $(IMU_ASPIRIN_CFLAGS)
ap.srcs += $(IMU_ASPIRIN_SRCS)
# sim not done yet
#sim.CFLAGS += $(IMU_ASPIRIN_CFLAGS)
#sim.srcs += $(IMU_ASPIRIN_SRCS)
@@ -0,0 +1,58 @@
# Hey Emacs, this is a -*- makefile -*-
#
# Common part for all Aspirin IMUs
#
#
# required xml:
# <section name="IMU" prefix="IMU_">
#
# <define name="GYRO_X_NEUTRAL" value="33924"/>
# <define name="GYRO_Y_NEUTRAL" value="33417"/>
# <define name="GYRO_Z_NEUTRAL" value="32809"/>
#
# <define name="GYRO_X_SENS" value="1.01" integer="16"/>
# <define name="GYRO_Y_SENS" value="1.01" integer="16"/>
# <define name="GYRO_Z_SENS" value="1.01" integer="16"/>
#
# <define name="ACCEL_X_NEUTRAL" value="32081"/>
# <define name="ACCEL_Y_NEUTRAL" value="33738"/>
# <define name="ACCEL_Z_NEUTRAL" value="32441"/>
#
# <define name="ACCEL_X_SENS" value="2.50411474" integer="16"/>
# <define name="ACCEL_Y_SENS" value="2.48126183" integer="16"/>
# <define name="ACCEL_Z_SENS" value="2.51396167" integer="16"/>
#
# <define name="MAG_X_NEUTRAL" value="2358"/>
# <define name="MAG_Y_NEUTRAL" value="2362"/>
# <define name="MAG_Z_NEUTRAL" value="2119"/>
#
# <define name="MAG_X_SENS" value="3.4936416" integer="16"/>
# <define name="MAG_Y_SENS" value="3.607713" integer="16"/>
# <define name="MAG_Z_SENS" value="4.90788848" integer="16"/>
#
# </section>
#
#
# imu aspirin
IMU_ASPIRIN_CFLAGS = -DUSE_IMU
IMU_ASPIRIN_CFLAGS += -DIMU_TYPE_H=\"imu/imu_aspirin.h\" -DIMU_OVERRIDE_CHANNELS
IMU_ASPIRIN_SRCS = $(SRC_SUBSYSTEMS)/imu.c \
$(SRC_SUBSYSTEMS)/imu/imu_aspirin.c \
$(SRC_ARCH)/subsystems/imu/imu_aspirin_arch.c
# Magnetometer
IMU_ASPIRIN_SRCS += peripherals/hmc5843.c $(SRC_ARCH)/peripherals/hmc5843_arch.c
IMU_ASPIRIN_CFLAGS += -DUSE_I2C2
ifeq ($(ARCH), lpc21)
#TODO
else ifeq ($(ARCH), stm32)
IMU_ASPIRIN_CFLAGS += -DUSE_EXTI15_10_IRQ # Gyro Int on PC14
IMU_ASPIRIN_CFLAGS += -DUSE_EXTI9_5_IRQ # Mag Int on PB5
IMU_ASPIRIN_CFLAGS += -DUSE_EXTI2_IRQ # Accel Int on PD2
IMU_ASPIRIN_CFLAGS += -DUSE_DMA1_C4_IRQ # SPI2 Rx DMA
endif
@@ -0,0 +1,46 @@
# Hey Emacs, this is a -*- makefile -*-
#
# Aspirin IMU v1.0
#
#
# required xml:
# <section name="IMU" prefix="IMU_">
#
# <define name="GYRO_X_NEUTRAL" value="33924"/>
# <define name="GYRO_Y_NEUTRAL" value="33417"/>
# <define name="GYRO_Z_NEUTRAL" value="32809"/>
#
# <define name="GYRO_X_SENS" value="1.01" integer="16"/>
# <define name="GYRO_Y_SENS" value="1.01" integer="16"/>
# <define name="GYRO_Z_SENS" value="1.01" integer="16"/>
#
# <define name="ACCEL_X_NEUTRAL" value="32081"/>
# <define name="ACCEL_Y_NEUTRAL" value="33738"/>
# <define name="ACCEL_Z_NEUTRAL" value="32441"/>
#
# <define name="ACCEL_X_SENS" value="2.50411474" integer="16"/>
# <define name="ACCEL_Y_SENS" value="2.48126183" integer="16"/>
# <define name="ACCEL_Z_SENS" value="2.51396167" integer="16"/>
#
# <define name="MAG_X_NEUTRAL" value="2358"/>
# <define name="MAG_Y_NEUTRAL" value="2362"/>
# <define name="MAG_Z_NEUTRAL" value="2119"/>
#
# <define name="MAG_X_SENS" value="3.4936416" integer="16"/>
# <define name="MAG_Y_SENS" value="3.607713" integer="16"/>
# <define name="MAG_Z_SENS" value="4.90788848" integer="16"/>
#
# </section>
#
#
# imu aspirin
include $(CFG_SHARED)/imu_aspirin_common.makefile
IMU_ASPIRIN_CFLAGS += -DIMU_ASPIRIN_VERSION_1_0
# Keep CFLAGS/Srcs for imu in separate expression so we can assign it to other targets
# see: conf/autopilot/subsystems/lisa_passthrough/imu_b2_v1.1.makefile for example
ap.CFLAGS += $(IMU_ASPIRIN_CFLAGS)
ap.srcs += $(IMU_ASPIRIN_SRCS)
@@ -0,0 +1,46 @@
# Hey Emacs, this is a -*- makefile -*-
#
# Aspirin IMU v1.5
#
#
# required xml:
# <section name="IMU" prefix="IMU_">
#
# <define name="GYRO_X_NEUTRAL" value="33924"/>
# <define name="GYRO_Y_NEUTRAL" value="33417"/>
# <define name="GYRO_Z_NEUTRAL" value="32809"/>
#
# <define name="GYRO_X_SENS" value="1.01" integer="16"/>
# <define name="GYRO_Y_SENS" value="1.01" integer="16"/>
# <define name="GYRO_Z_SENS" value="1.01" integer="16"/>
#
# <define name="ACCEL_X_NEUTRAL" value="32081"/>
# <define name="ACCEL_Y_NEUTRAL" value="33738"/>
# <define name="ACCEL_Z_NEUTRAL" value="32441"/>
#
# <define name="ACCEL_X_SENS" value="2.50411474" integer="16"/>
# <define name="ACCEL_Y_SENS" value="2.48126183" integer="16"/>
# <define name="ACCEL_Z_SENS" value="2.51396167" integer="16"/>
#
# <define name="MAG_X_NEUTRAL" value="2358"/>
# <define name="MAG_Y_NEUTRAL" value="2362"/>
# <define name="MAG_Z_NEUTRAL" value="2119"/>
#
# <define name="MAG_X_SENS" value="3.4936416" integer="16"/>
# <define name="MAG_Y_SENS" value="3.607713" integer="16"/>
# <define name="MAG_Z_SENS" value="4.90788848" integer="16"/>
#
# </section>
#
#
# imu aspirin
include $(CFG_SHARED)/imu_aspirin_common.makefile
IMU_ASPIRIN_CFLAGS += -DIMU_ASPIRIN_VERSION_1_5
# Keep CFLAGS/Srcs for imu in separate expression so we can assign it to other targets
# see: conf/autopilot/subsystems/lisa_passthrough/imu_b2_v1.1.makefile for example
ap.CFLAGS += $(IMU_ASPIRIN_CFLAGS)
ap.srcs += $(IMU_ASPIRIN_SRCS)
+18 -5
View File
@@ -32,9 +32,27 @@
#include "peripherals/hmc5843.h" #include "peripherals/hmc5843.h"
#include "peripherals/adxl345.h" #include "peripherals/adxl345.h"
#ifdef IMU_ASPIRIN_VERSION_1_0
#define IMU_MAG_X_CHAN 0 #define IMU_MAG_X_CHAN 0
#define IMU_MAG_Y_CHAN 1 #define IMU_MAG_Y_CHAN 1
#define IMU_MAG_Z_CHAN 2 #define IMU_MAG_Z_CHAN 2
#if !defined IMU_MAG_X_SIGN & !defined IMU_MAG_Y_SIGN & !defined IMU_MAG_Z_SIGN
#define IMU_MAG_X_SIGN 1
#define IMU_MAG_Y_SIGN 1
#define IMU_MAG_Z_SIGN 1
#endif
#endif
#ifdef IMU_ASPIRIN_VERSION_1_5
#define IMU_MAG_X_CHAN 2
#define IMU_MAG_Y_CHAN 0
#define IMU_MAG_Z_CHAN 1
#if !defined IMU_MAG_X_SIGN & !defined IMU_MAG_Y_SIGN & !defined IMU_MAG_Z_SIGN
#define IMU_MAG_X_SIGN 1
#define IMU_MAG_Y_SIGN -1
#define IMU_MAG_Z_SIGN 1
#endif
#endif
#if !defined IMU_GYRO_P_SIGN & !defined IMU_GYRO_Q_SIGN & !defined IMU_GYRO_R_SIGN #if !defined IMU_GYRO_P_SIGN & !defined IMU_GYRO_Q_SIGN & !defined IMU_GYRO_R_SIGN
#define IMU_GYRO_P_SIGN 1 #define IMU_GYRO_P_SIGN 1
@@ -46,11 +64,6 @@
#define IMU_ACCEL_Y_SIGN 1 #define IMU_ACCEL_Y_SIGN 1
#define IMU_ACCEL_Z_SIGN 1 #define IMU_ACCEL_Z_SIGN 1
#endif #endif
#if !defined IMU_MAG_X_SIGN & !defined IMU_MAG_Y_SIGN & !defined IMU_MAG_Z_SIGN
#define IMU_MAG_X_SIGN 1
#define IMU_MAG_Y_SIGN 1
#define IMU_MAG_Z_SIGN 1
#endif
enum AspirinStatus enum AspirinStatus
{ AspirinStatusUninit, { AspirinStatusUninit,