<!DOCTYPE module SYSTEM "module.dtd">

<module name="imu_px4fmu_v2.4" dir="imu">
  <doc>
    <description>
      PX4 Pixhawk IMU via SPI.
      Consists of two (internal) IMU's and one internal magneto. Also an optional external magneto.
      L3GD20 +  LSM303D
    </description>
    <configure name="IMU_PX4FMU_SPI_DEV" value="spi1" description="SPI device to use"/>
    <configure name="IMU_L3G_SPI_SLAVE_IDX" value="SPI_SLAVE0" description="slave select pin for the L3GD20"/>
    <configure name="IMU_LSM_SPI_SLAVE_IDX" value="SPI_SLAVE1" description="slave select pin for the LSM303D"/>
    <define name="IMU_PX4_DISABLE_MAG" value="FALSE" description="define to TRUE to disable the mag on the Pixhawk"/>
  </doc>
  <autoload name="imu_common"/>
  <autoload name="imu_nps"/>
  <header>
    <file name="imu_px4fmu_v2.4.h" dir="subsystems/imu"/>
  </header>
  <init fun="imu_px4_init()"/>
  <periodic fun="imu_px4_periodic()"/>
  <event fun="imu_px4_event()"/>
  <makefile target="!sim|nps|fbw">
    <configure name="IMU_PX4FMU_SPI_DEV" default="spi1" case="lower|upper"/>
    <define name="IMU_PX4FMU_SPI_DEV" value="$(IMU_PX4FMU_SPI_DEV_LOWER)"/>
    <define name="USE_$(IMU_PX4FMU_SPI_DEV_UPPER)"/>
    <!-- L3GD20 -->
    <configure name="IMU_L3G_SPI_SLAVE_IDX" default="SPI_SLAVE0"/>
    <define name="USE_$(IMU_L3G_SPI_SLAVE_IDX)"/>
    <define name="IMU_L3G_SPI_SLAVE_IDX" value="$(IMU_L3G_SPI_SLAVE_IDX)"/>
    <!-- LSM303d -->
    <configure name="IMU_LSM_SPI_SLAVE_IDX" default="SPI_SLAVE1"/>
    <define name="USE_$(IMU_LSM_SPI_SLAVE_IDX)"/>
    <define name="IMU_LSM_SPI_SLAVE_IDX" value="$(IMU_LSM_SPI_SLAVE_IDX)"/>

    <define name="IMU_TYPE_H" value="imu/imu_px4fmu_v2.4.h" type="string"/>

    <file name="l3gd20_spi.c" dir="peripherals"/>
    <file name="lsm303d_spi.c" dir="peripherals"/>
    <file name="hmc58xx.c" dir="peripherals"/>
    <file name="imu_px4fmu_v2.4.c" dir="subsystems/imu"/>
    <raw>
      include $(CFG_SHARED)/spi_master.makefile
    </raw>
  </makefile>
</module>
