sketchbook
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Classes | Macros | Functions | Variables
IMU.cpp File Reference
#include "Arduino.h"
#include "config.h"
#include "def.h"
#include "types.h"
#include "MultiWii.h"
#include "IMU.h"
#include "Sensors.h"

Classes

struct  t_int32_t_vector_def
 
struct  t_int16_t_vector_def
 
union  t_int32_t_vector
 

Macros

#define ACC_LPF_FACTOR   4
 
#define GYR_CMPF_FACTOR   10
 
#define GYR_CMPFM_FACTOR   8
 
#define MultiS16X16to32(longRes, intIn1, intIn2)
 
#define UPDATE_INTERVAL   25000
 
#define BARO_TAB_SIZE   21
 
#define ACC_Z_DEADBAND   (ACC_1G>>5)
 
#define applyDeadband(value, deadband)
 

Functions

void getEstimatedAttitude ()
 
void computeIMU ()
 
int16_t _atan2 (int32_t y, int32_t x)
 
float InvSqrt (float x)
 
int32_t __attribute__ ((noinline)) mul(int16_t a
 
 MultiS16X16to32 (r, a, b)
 
void rotateV32 (t_int32_t_vector *v, int16_t *delta)
 

Variables

int32_t int16_t b
 
return r
 

Macro Definition Documentation

#define ACC_LPF_FACTOR   4
#define ACC_Z_DEADBAND   (ACC_1G>>5)
#define applyDeadband (   value,
  deadband 
)
Value:
if(abs(value) < deadband) { \
value = 0; \
} else if(value > 0){ \
value -= deadband; \
} else if(value < 0){ \
value += deadband; \
}
#define abs(x)
Definition: Arduino.h:84
#define BARO_TAB_SIZE   21
#define GYR_CMPF_FACTOR   10
#define GYR_CMPFM_FACTOR   8
#define MultiS16X16to32 (   longRes,
  intIn1,
  intIn2 
)
Value:
asm volatile ( \
"clr r26 \n\t" \
"mul %A1, %A2 \n\t" \
"movw %A0, r0 \n\t" \
"muls %B1, %B2 \n\t" \
"movw %C0, r0 \n\t" \
"mulsu %B2, %A1 \n\t" \
"sbc %D0, r26 \n\t" \
"add %B0, r0 \n\t" \
"adc %C0, r1 \n\t" \
"adc %D0, r26 \n\t" \
"mulsu %B1, %A2 \n\t" \
"sbc %D0, r26 \n\t" \
"add %B0, r0 \n\t" \
"adc %C0, r1 \n\t" \
"adc %D0, r26 \n\t" \
"clr r1 \n\t" \
: \
"=&r" (longRes) \
: \
"a" (intIn1), \
"a" (intIn2) \
: \
"r26" \
)
#define UPDATE_INTERVAL   25000

Function Documentation

int32_t __attribute__ ( (noinline)  )
int16_t _atan2 ( int32_t  y,
int32_t  x 
)
void computeIMU ( )
void getEstimatedAttitude ( )
float InvSqrt ( float  x)
MultiS16X16to32 ( r  ,
,
b   
)
void rotateV32 ( t_int32_t_vector v,
int16_t *  delta 
)

Variable Documentation

int32_t int16_t b
Initial value:
{
int32_t r
return r
Definition: IMU.cpp:176
return r