Paparazzi UAS  v5.8.2_stable-0-g6260b7c
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
Test module for the mpu9250 with I2C

Module XML file: imu_mpu9250.xml

Report RAW values on telemetry

Example for airframe file

This example contains all possible configuration options, not all of them are mandatory!

1 <modules>
2  <load name="imu_mpu9250.xml">
3  <define name="IMU_MPU9250_ADDR" value="MPU9250_ADDR|MPU9250_ADDR_ALT" />
4  <configure name="IMU_MPU9250_I2C_DEV" value="i2c1" />
5  </load>
6 </modules>

Module configuration options

Configure Options

  • name: IMU_MPU9250_I2C_DEV value: i2c1
    Description: I2C device to use (e.g. i2c1)

Define Options

  • name: IMU_MPU9250_ADDR value: MPU9250_ADDR|MPU9250_ADDR_ALT
    Description: Use regular or alternate I2C address

Module functions

Init Functions

These initialization functions are called once on startup.

Event Functions

These event functions are called in each cycle of the module event loop.

Periodic Functions

These functions are called periodically at the specified frequency from the module periodic loop.

  • imu_mpu9250_periodic()
    • Running at maximum module frequency.
    • Autorun: LOCK
      Periodic function automatically starts after init and can't be stopped.
  • imu_mpu9250_report()
    • Frequency in Hz: 10
    • Autorun: TRUE
      Periodic function automatically starts after init.

Files

Header Files

The following headers are automatically included in modules.h

Source Files

Raw imu_mpu9250.xml file:

<!DOCTYPE module SYSTEM "module.dtd">
<module name="imu_mpu9250" dir="sensors">
<doc>
<description>
Test module for the mpu9250 with I2C
Report RAW values on telemetry
</description>
<configure name="IMU_MPU9250_I2C_DEV" value="i2c1" description="I2C device to use (e.g. i2c1)"/>
<define name="IMU_MPU9250_ADDR" value="MPU9250_ADDR|MPU9250_ADDR_ALT" description="Use regular or alternate I2C address"/>
</doc>
<header>
<file name="imu_mpu9250.h"/>
</header>
<init fun="imu_mpu9250_init()"/>
<periodic fun="imu_mpu9250_periodic()"/>
<periodic fun="imu_mpu9250_report()" freq="10" autorun="TRUE"/>
<event fun="imu_mpu9250_event()"/>
<makefile>
<raw>
IMU_MPU9250_I2C_DEV ?= i2c1
IMU_MPU9250_I2C_DEV_LOWER=$(shell echo $(IMU_MPU9250_I2C_DEV) | tr A-Z a-z)
IMU_MPU9250_I2C_DEV_UPPER=$(shell echo $(IMU_MPU9250_I2C_DEV) | tr a-z A-Z)
</raw>
<define name="USE_$(IMU_MPU9250_I2C_DEV_UPPER)"/>
<define name="IMU_MPU9250_I2C_DEV" value="$(IMU_MPU9250_I2C_DEV_LOWER)"/>
<file name="imu_mpu9250.c"/>
<file name="mpu9250.c" dir="peripherals"/>
<file name="mpu9250_i2c.c" dir="peripherals"/>
<file name="ak8963.c" dir="peripherals"/>
</makefile>
</module>