Test module for the mpu9250 with I2C
Report RAW values on telemetry
Example for airframe file
Add to your firmware section: This example contains all possible configuration options, not all of them are mandatory!
1 <module name="imu_mpu9250">
2 <define name="IMU_MPU9250_ADDR" value="MPU9250_ADDR|MPU9250_ADDR_ALT" />
3 <configure name="IMU_MPU9250_I2C_DEV" value="i2c1" />
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>
<configure name="IMU_MPU9250_I2C_DEV" default="i2c1" case="upper|lower"/>
<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>