NinjaFlight
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
maths.h File Reference
#include <stdint.h>
Include dependency graph for maths.h:

Go to the source code of this file.

Data Structures

struct  stdev_s
 
struct  fp_vector
 
union  t_fp_vector
 
struct  fp_angles
 
union  fp_angles_t
 

Macros

#define sq(x)   ((x)*(x))
 
#define FAST_TRIGONOMETRY
 
#define M_PIf   3.14159265358979323846f
 
#define RAD   (M_PIf / 180.0f)
 
#define MIN(a, b)   ((a) < (b) ? (a) : (b))
 
#define MAX(a, b)   ((a) > (b) ? (a) : (b))
 
#define ABS(x)   ((x) > 0 ? (x) : -(x))
 
#define sin_approx(x)   sinf(x)
 
#define cos_approx(x)   cosf(x)
 
#define atan2_approx(y, x)   atan2f(y,x)
 
#define acos_approx(x)   acosf(x)
 
#define tan_approx(x)   tanf(x)
 
#define DEGREES_TO_DECIDEGREES(angle)   (angle * 10)
 
#define DECIDEGREES_TO_DEGREES(angle)   (angle / 10)
 
#define DECIDEGREES_TO_RADIANS(angle)   ((angle / 10.0f) * 0.0174532925f)
 
#define DEGREES_TO_RADIANS(angle)   ((angle) * 0.0174532925f)
 

Typedefs

typedef struct stdev_s stdev_t
 
typedef struct fp_vector t_fp_vector_def
 
typedef struct fp_angles fp_angles_def
 
typedef float matrix_3x3_t [3][3]
 

Functions

int32_t applyDeadband (int32_t value, int32_t deadband)
 
int constrain (int amt, int low, int high)
 
float constrainf (float amt, float low, float high)
 
void devClear (stdev_t *dev)
 
void devPush (stdev_t *dev, float x)
 
float devVariance (stdev_t *dev)
 
float devStandardDeviation (stdev_t *dev)
 
float degreesToRadians (int16_t degrees)
 
int scaleRange (int x, int srcMin, int srcMax, int destMin, int destMax)
 
float scaleRangef (float x, float in_min, float in_max, float out_min, float out_max)
 
void normalizeV (struct fp_vector *src, struct fp_vector *dest)
 
void rotateV (struct fp_vector *v, fp_angles_t *delta)
 
void buildRotationMatrix (fp_angles_t *delta, float matrix[3][3])
 
int32_t quickMedianFilter3 (int32_t *v)
 
int32_t quickMedianFilter5 (int32_t *v)
 
int32_t quickMedianFilter7 (int32_t *v)
 
int32_t quickMedianFilter9 (int32_t *v)
 
void arraySubInt32 (int32_t *dest, int32_t *array1, int32_t *array2, int count)
 
void matrix_set_identity (matrix_3x3_t mat)
 

Macro Definition Documentation

#define ABS (   x)    ((x) > 0 ? (x) : -(x))
#define acos_approx (   x)    acosf(x)
#define atan2_approx (   y,
 
)    atan2f(y,x)
#define cos_approx (   x)    cosf(x)
#define DECIDEGREES_TO_DEGREES (   angle)    (angle / 10)
#define DECIDEGREES_TO_RADIANS (   angle)    ((angle / 10.0f) * 0.0174532925f)
#define DEGREES_TO_DECIDEGREES (   angle)    (angle * 10)
#define DEGREES_TO_RADIANS (   angle)    ((angle) * 0.0174532925f)
#define FAST_TRIGONOMETRY
#define M_PIf   3.14159265358979323846f
#define MAX (   a,
 
)    ((a) > (b) ? (a) : (b))
#define MIN (   a,
 
)    ((a) < (b) ? (a) : (b))
#define RAD   (M_PIf / 180.0f)
#define sin_approx (   x)    sinf(x)
#define sq (   x)    ((x)*(x))
#define tan_approx (   x)    tanf(x)

Typedef Documentation

typedef struct fp_angles fp_angles_def
typedef float matrix_3x3_t[3][3]
typedef struct stdev_s stdev_t
typedef struct fp_vector t_fp_vector_def

Function Documentation

int32_t applyDeadband ( int32_t  value,
int32_t  deadband 
)
void arraySubInt32 ( int32_t *  dest,
int32_t *  array1,
int32_t *  array2,
int  count 
)
void buildRotationMatrix ( fp_angles_t delta,
float  matrix[3][3] 
)

Here is the call graph for this function:

int constrain ( int  amt,
int  low,
int  high 
)
float constrainf ( float  amt,
float  low,
float  high 
)
float degreesToRadians ( int16_t  degrees)
void devClear ( stdev_t dev)
void devPush ( stdev_t dev,
float  x 
)
float devStandardDeviation ( stdev_t dev)

Here is the call graph for this function:

float devVariance ( stdev_t dev)
void matrix_set_identity ( matrix_3x3_t  mat)
void normalizeV ( struct fp_vector src,
struct fp_vector dest 
)
int32_t quickMedianFilter3 ( int32_t *  v)
int32_t quickMedianFilter5 ( int32_t *  v)
int32_t quickMedianFilter7 ( int32_t *  v)
int32_t quickMedianFilter9 ( int32_t *  v)
void rotateV ( struct fp_vector v,
fp_angles_t delta 
)

Here is the call graph for this function:

int scaleRange ( int  x,
int  srcMin,
int  srcMax,
int  destMin,
int  destMax 
)
float scaleRangef ( float  x,
float  in_min,
float  in_max,
float  out_min,
float  out_max 
)