Paparazzi UAS  v4.0.4_stable-3-gf39211a
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
imu_aspirin.h File Reference
#include "generated/airframe.h"
#include "subsystems/imu.h"
#include "mcu_periph/i2c.h"
#include "peripherals/itg3200.h"
#include "peripherals/hmc5843.h"
#include "peripherals/adxl345.h"
#include "subsystems/imu/imu_aspirin_arch.h"
+ Include dependency graph for imu_aspirin.h:

Go to the source code of this file.

Data Structures

struct  ImuAspirin
 

Macros

#define IMU_GYRO_P_SIGN   1
 
#define IMU_GYRO_Q_SIGN   1
 
#define IMU_GYRO_R_SIGN   1
 
#define IMU_ACCEL_X_SIGN   1
 
#define IMU_ACCEL_Y_SIGN   1
 
#define IMU_ACCEL_Z_SIGN   1
 
#define IMU_GYRO_P_SENS   4.973
 default gyro sensitivy and neutral from the datasheet ITG3200 has 14.375 LSB/(deg/s) sens = 1/14.375 * pi/180 * 2^INT32_RATE_FRAC sens = 1/14.375 * pi/180 * 4096 = 4.973126 More...
 
#define IMU_GYRO_P_SENS_NUM   4973
 
#define IMU_GYRO_P_SENS_DEN   1000
 
#define IMU_GYRO_Q_SENS   4.973
 
#define IMU_GYRO_Q_SENS_NUM   4973
 
#define IMU_GYRO_Q_SENS_DEN   1000
 
#define IMU_GYRO_R_SENS   4.973
 
#define IMU_GYRO_R_SENS_NUM   4973
 
#define IMU_GYRO_R_SENS_DEN   1000
 
#define IMU_ACCEL_X_SENS   37.91
 default accel sensitivy from the ADXL345 datasheet sensitivity of x & y axes depends on supply voltage: More...
 
#define IMU_ACCEL_X_SENS_NUM   3791
 
#define IMU_ACCEL_X_SENS_DEN   100
 
#define IMU_ACCEL_Y_SENS   37.91
 
#define IMU_ACCEL_Y_SENS_NUM   3791
 
#define IMU_ACCEL_Y_SENS_DEN   100
 
#define IMU_ACCEL_Z_SENS   39.24
 
#define IMU_ACCEL_Z_SENS_NUM   3924
 
#define IMU_ACCEL_Z_SENS_DEN   100
 
#define ASPIRIN_GYRO_TIMEOUT   3
 
#define ASPIRIN_ACCEL_TIMEOUT   3
 
#define foo_handler()   {}
 
#define ImuMagEvent(_mag_handler)
 
#define ImuEvent(_gyro_handler, _accel_handler, _mag_handler)
 

Enumerations

enum  AspirinStatus { AspirinStatusUninit, AspirinStatusIdle, AspirinStatusReadingGyro, AspirinStatusReadingMag }
 

Functions

void imu_aspirin_arch_init (void)
 
static void gyro_read_i2c (void)
 
static void gyro_copy_i2c (void)
 
static void accel_copy_spi (void)
 
static void imu_aspirin_event (void(*_gyro_handler)(void), void(*_accel_handler)(void), void(*_mag_handler)(void))
 

Variables

struct ImuAspirin imu_aspirin
 

Macro Definition Documentation

#define ASPIRIN_ACCEL_TIMEOUT   3

Definition at line 150 of file imu_aspirin.h.

Referenced by imu_periodic().

#define ASPIRIN_GYRO_TIMEOUT   3

Definition at line 149 of file imu_aspirin.h.

Referenced by imu_aspirin_event().

#define foo_handler ( )    {}

Definition at line 152 of file imu_aspirin.h.

#define IMU_ACCEL_X_SENS   37.91

default accel sensitivy from the ADXL345 datasheet sensitivity of x & y axes depends on supply voltage:

  • 256 LSB/g @ 2.5V
  • 265 LSB/g @ 3.3V z sensitivity stays at 256 LSB/g fixed point sens: 9.81 [m/s^2] / 256 [LSB/g] * 2^INT32_ACCEL_FRAC x/y sens = 9.81 / 265 * 1024 = 37.91 z sens = 9.81 / 256 * 1024 = 39.24

what about the offset at 3.3V?

Definition at line 115 of file imu_aspirin.h.

#define IMU_ACCEL_X_SENS_DEN   100

Definition at line 117 of file imu_aspirin.h.

#define IMU_ACCEL_X_SENS_NUM   3791

Definition at line 116 of file imu_aspirin.h.

#define IMU_ACCEL_X_SIGN   1

Definition at line 63 of file imu_aspirin.h.

#define IMU_ACCEL_Y_SENS   37.91

Definition at line 118 of file imu_aspirin.h.

#define IMU_ACCEL_Y_SENS_DEN   100

Definition at line 120 of file imu_aspirin.h.

#define IMU_ACCEL_Y_SENS_NUM   3791

Definition at line 119 of file imu_aspirin.h.

#define IMU_ACCEL_Y_SIGN   1

Definition at line 64 of file imu_aspirin.h.

#define IMU_ACCEL_Z_SENS   39.24

Definition at line 121 of file imu_aspirin.h.

#define IMU_ACCEL_Z_SENS_DEN   100

Definition at line 123 of file imu_aspirin.h.

#define IMU_ACCEL_Z_SENS_NUM   3924

Definition at line 122 of file imu_aspirin.h.

#define IMU_ACCEL_Z_SIGN   1

Definition at line 65 of file imu_aspirin.h.

#define IMU_GYRO_P_SENS   4.973

default gyro sensitivy and neutral from the datasheet ITG3200 has 14.375 LSB/(deg/s) sens = 1/14.375 * pi/180 * 2^INT32_RATE_FRAC sens = 1/14.375 * pi/180 * 4096 = 4.973126

Definition at line 90 of file imu_aspirin.h.

#define IMU_GYRO_P_SENS_DEN   1000

Definition at line 92 of file imu_aspirin.h.

#define IMU_GYRO_P_SENS_NUM   4973

Definition at line 91 of file imu_aspirin.h.

#define IMU_GYRO_P_SIGN   1

Definition at line 58 of file imu_aspirin.h.

#define IMU_GYRO_Q_SENS   4.973

Definition at line 93 of file imu_aspirin.h.

#define IMU_GYRO_Q_SENS_DEN   1000

Definition at line 95 of file imu_aspirin.h.

#define IMU_GYRO_Q_SENS_NUM   4973

Definition at line 94 of file imu_aspirin.h.

#define IMU_GYRO_Q_SIGN   1

Definition at line 59 of file imu_aspirin.h.

#define IMU_GYRO_R_SENS   4.973

Definition at line 96 of file imu_aspirin.h.

#define IMU_GYRO_R_SENS_DEN   1000

Definition at line 98 of file imu_aspirin.h.

#define IMU_GYRO_R_SENS_NUM   4973

Definition at line 97 of file imu_aspirin.h.

#define IMU_GYRO_R_SIGN   1

Definition at line 60 of file imu_aspirin.h.

#define ImuEvent (   _gyro_handler,
  _accel_handler,
  _mag_handler 
)
Value:
do { \
imu_aspirin_event(_gyro_handler, _accel_handler, _mag_handler); \
} while(0);
static void imu_aspirin_event(void(*_gyro_handler)(void), void(*_accel_handler)(void), void(*_mag_handler)(void))
Definition: imu_aspirin.h:196

Definition at line 254 of file imu_aspirin.h.

#define ImuMagEvent (   _mag_handler)
Value:
{ \
imu.mag_unscaled.x = hmc5843.data.value[IMU_MAG_X_CHAN]; \
imu.mag_unscaled.y = hmc5843.data.value[IMU_MAG_Y_CHAN]; \
imu.mag_unscaled.z = hmc5843.data.value[IMU_MAG_Z_CHAN]; \
_mag_handler(); \
} \
}
#define FALSE
Definition: imu_chimu.h:141
#define MagEvent(_m_handler)
Definition: hmc5843.h:76
uint8_t data_available
Definition: hmc5843.h:36
struct Int32Vect3 mag_unscaled
unscaled magnetometer measurements
Definition: imu.h:50
int16_t value[3]
Definition: hmc5843.h:39
struct Imu imu
global IMU state
Definition: imu_aspirin2.c:50
#define foo_handler()
Definition: imu_aspirin.h:152
union Hmc5843::@15 data
struct Hmc5843 hmc5843
Definition: hmc5843.c:9

Definition at line 153 of file imu_aspirin.h.

Referenced by imu_aspirin_event().

Enumeration Type Documentation

Enumerator
AspirinStatusUninit 
AspirinStatusIdle 
AspirinStatusReadingGyro 
AspirinStatusReadingMag 

Definition at line 127 of file imu_aspirin.h.

Function Documentation

static void accel_copy_spi ( void  )
inlinestatic

Definition at line 187 of file imu_aspirin.h.

References ImuAspirin::accel_rx_buf, Imu::accel_unscaled, imu, imu_aspirin, and VECT3_ASSIGN.

Referenced by imu_aspirin_event().

+ Here is the caller graph for this function:

static void gyro_copy_i2c ( void  )
inlinestatic

Definition at line 179 of file imu_aspirin.h.

References i2c_transaction::buf, Imu::gyro_unscaled, ImuAspirin::i2c_trans_gyro, imu, imu_aspirin, and RATES_ASSIGN.

Referenced by imu_aspirin_event().

+ Here is the caller graph for this function:

static void gyro_read_i2c ( void  )
inlinestatic

Definition at line 169 of file imu_aspirin.h.

References i2c_transaction::buf, i2c_submit(), ImuAspirin::i2c_trans_gyro, I2CTransTxRx, imu_aspirin, ITG3200_REG_GYRO_XOUT_H, i2c_transaction::len_r, i2c_transaction::len_w, ImuAspirin::reading_gyro, and i2c_transaction::type.

Referenced by imu_aspirin_event().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void imu_aspirin_arch_init ( void  )

Definition at line 15 of file imu_aspirin_arch.c.

References Adxl345Unselect.

Referenced by imu_impl_init().

+ Here is the caller graph for this function:

Variable Documentation