|
brazos-trapezoidal
|
#include "mc_types.h"
Go to the source code of this file.
Classes | |
| struct | ABC_t |
| struct | DQ_t |
| struct | AlphaBeta_t |
| struct | trig_t |
Macros | |
| #define | BASE_IQ (15) |
| #define | _IQ(x) (x) |
| #define | _IQX_TO_IQY(x, qx, qy) (x) |
| #define | _FLOAT_TO_IQ(x, base) (x) |
| #define | _FLOAT_TO_IQY(x, base_iq, base) (x) |
| #define | _IQ_TO_FLOATY(x, y, base) ((float32_t)(x)) |
| #define | _IQ_TO_FLOAT(x) ((float32_t)(x)) |
| #define | MATHLIB_MIN_VALUE ((mc_t)1e-12f) |
| #define | MATHLIB_IQMPY(a, b, a_format, b_format, out_format) ((a) * (b)) |
| #define | MATHLIB_MPY(a, b) ((a) * (b)) |
| #define | MATHLIB_DIV(x, y) ((x) / (y)) |
| #define | MATHLIB_ABS(x) ((x < 0) ? -x : x) |
| #define | MATHLIB_SAT(x, lim_inf, lim_sup) |
| #define | MATHLIB_MPY_BY_TWO(a) ((a) * 2) |
| #define | MATHLIB_MPY_BY_FOUR(a) ((a) * 4) |
| #define | MATHLIB_MPY_BY_EIGHT(a) ((a) * 8) |
| #define | MATHLIB_DIV_BY_TWO(a) ((a) * 0.5f) |
| #define | MATHLIB_DIV_BY_FOUR(a) ((a) * 0.25f) |
| #define | MATHLIB_DIV_BY_EIGHT(a) ((a) * 0.125f) |
| #define | MATHLIB_SQRT(x) MathLib_SqrtFromInvSqrt((x)) |
| #define | MATHLIB_SINCOS(th, sc) MathLib_SinCos(th, sc) |
| #define | MATHLIB_MOD(x, y) MathLib_Mod(x, y) |
| #define | MATHLIB_SINCOSMODAB(ab, m, sc) MathLib_SinCosModAb(ab, m, sc) |
| #define | ONE_OVER_TWO (0.5f) |
| #define | ONE_OVER_THREE (0.33333f) |
| #define | ONE_OVER_SQRT3 (0.57735026918962576450914878050196f) |
| #define | SQRT3_OVER_TWO (0.86602540378443864676372317075294f) |
| #define | SQRT3 ((0.86602540378443864676372317075294f)*2) |
| #define | SIN_TABLE_SIZE 256 |
| #define | COS_TABLE_OFFSET 64 |
Functions | |
| float32_t | MathLib_Sqrt (float32_t value) |
| Calculates the square root of a floating point number. More... | |
| float32_t | MathLib_SqrtFlt (float32_t value) |
| Calculates the square root of a floating point number. More... | |
| float32_t | MathLib_SqrtFromInvSqrt (float32_t x) |
| Calculates the square root of a floating point number using the invSqrt method Referemce: https://betterexplained.com/articles/understanding-quakes-fast-inverse-square-root/. More... | |
| void | MathLib_SinCos (mc_t theta, trig_t *sinCos) |
| Sin and Cosine calculation of a floating point angle. More... | |
| mc_t | MathLib_Atan2 (mc_t y, mc_t x) |
| Atan2 function, it calculates the atan based on the x and y values. More... | |
| mc_t | MathLib_Mod (mc_t x, mc_t y) |
| Modulus function, it calculates hypotenusa. More... | |
| void | MathLib_SinCosModAb (AlphaBeta_t *ab, mc_t mod, trig_t *sinCos) |
| Modulus function, it calculates hypotenusa. More... | |
Definition in file MathLib_Float.h.
| #define _FLOAT_TO_IQ | ( | x, | |
| base | |||
| ) | (x) |
Definition at line 59 of file MathLib_Float.h.
| #define _FLOAT_TO_IQY | ( | x, | |
| base_iq, | |||
| base | |||
| ) | (x) |
Definition at line 60 of file MathLib_Float.h.
| #define _IQ | ( | x | ) | (x) |
Definition at line 55 of file MathLib_Float.h.
| #define _IQ_TO_FLOAT | ( | x | ) | ((float32_t)(x)) |
Definition at line 66 of file MathLib_Float.h.
| #define _IQ_TO_FLOATY | ( | x, | |
| y, | |||
| base | |||
| ) | ((float32_t)(x)) |
Definition at line 65 of file MathLib_Float.h.
| #define _IQX_TO_IQY | ( | x, | |
| qx, | |||
| qy | |||
| ) | (x) |
Definition at line 57 of file MathLib_Float.h.
| #define BASE_IQ (15) |
Defines the base IQ, unless otherwise noted, all the variables use this base
Definition at line 54 of file MathLib_Float.h.
| #define COS_TABLE_OFFSET 64 |
Definition at line 104 of file MathLib_Float.h.
| #define MATHLIB_ABS | ( | x | ) | ((x < 0) ? -x : x) |
Definition at line 76 of file MathLib_Float.h.
| #define MATHLIB_DIV | ( | x, | |
| y | |||
| ) | ((x) / (y)) |
Definition at line 74 of file MathLib_Float.h.
| #define MATHLIB_DIV_BY_EIGHT | ( | a | ) | ((a) * 0.125f) |
Definition at line 87 of file MathLib_Float.h.
| #define MATHLIB_DIV_BY_FOUR | ( | a | ) | ((a) * 0.25f) |
Definition at line 86 of file MathLib_Float.h.
| #define MATHLIB_DIV_BY_TWO | ( | a | ) | ((a) * 0.5f) |
Definition at line 85 of file MathLib_Float.h.
| #define MATHLIB_IQMPY | ( | a, | |
| b, | |||
| a_format, | |||
| b_format, | |||
| out_format | |||
| ) | ((a) * (b)) |
Multiply two variables defined by BASE_IQ, assuming the integer part is never bigger than 1.41pu (1.41^2 would overflow the multiplication in the Q15 format
Definition at line 71 of file MathLib_Float.h.
| #define MATHLIB_MIN_VALUE ((mc_t)1e-12f) |
Definition at line 68 of file MathLib_Float.h.
| #define MATHLIB_MOD | ( | x, | |
| y | |||
| ) | MathLib_Mod(x, y) |
Definition at line 92 of file MathLib_Float.h.
| #define MATHLIB_MPY | ( | a, | |
| b | |||
| ) | ((a) * (b)) |
Definition at line 72 of file MathLib_Float.h.
| #define MATHLIB_MPY_BY_EIGHT | ( | a | ) | ((a) * 8) |
Definition at line 84 of file MathLib_Float.h.
| #define MATHLIB_MPY_BY_FOUR | ( | a | ) | ((a) * 4) |
Definition at line 83 of file MathLib_Float.h.
| #define MATHLIB_MPY_BY_TWO | ( | a | ) | ((a) * 2) |
Multiply a variable by two, this macro was created to optimize multiplications by multiples of two in fixed point logic
Definition at line 82 of file MathLib_Float.h.
| #define MATHLIB_SAT | ( | x, | |
| lim_inf, | |||
| lim_sup | |||
| ) |
Definition at line 77 of file MathLib_Float.h.
| #define MATHLIB_SINCOS | ( | th, | |
| sc | |||
| ) | MathLib_SinCos(th, sc) |
Definition at line 91 of file MathLib_Float.h.
| #define MATHLIB_SINCOSMODAB | ( | ab, | |
| m, | |||
| sc | |||
| ) | MathLib_SinCosModAb(ab, m, sc) |
Definition at line 93 of file MathLib_Float.h.
| #define MATHLIB_SQRT | ( | x | ) | MathLib_SqrtFromInvSqrt((x)) |
Definition at line 90 of file MathLib_Float.h.
| #define ONE_OVER_SQRT3 (0.57735026918962576450914878050196f) |
Definition at line 99 of file MathLib_Float.h.
| #define ONE_OVER_THREE (0.33333f) |
Definition at line 98 of file MathLib_Float.h.
| #define ONE_OVER_TWO (0.5f) |
Constants
Definition at line 97 of file MathLib_Float.h.
| #define SIN_TABLE_SIZE 256 |
Definition at line 103 of file MathLib_Float.h.
| #define SQRT3 ((0.86602540378443864676372317075294f)*2) |
Definition at line 101 of file MathLib_Float.h.
| #define SQRT3_OVER_TWO (0.86602540378443864676372317075294f) |
Definition at line 100 of file MathLib_Float.h.
| mc_t MathLib_Atan2 | ( | mc_t | y, |
| mc_t | x | ||
| ) |
Atan2 function, it calculates the atan based on the x and y values.
| y | y-axis value to be calculated |
| x | x-axis value to be calculated |
Definition at line 650 of file MathLib_Float.c.
| mc_t MathLib_Mod | ( | mc_t | x, |
| mc_t | y | ||
| ) |
Modulus function, it calculates hypotenusa.
| y | y-axis value to be calculated |
| x | x-axis value to be calculated |
Definition at line 663 of file MathLib_Float.c.
| void MathLib_SinCos | ( | mc_t | theta, |
| trig_t * | sinCos | ||
| ) |
Sin and Cosine calculation of a floating point angle.
| theta | the angle |
| sinCos | pointer to the struct that will hold the results |
Definition at line 591 of file MathLib_Float.c.
| void MathLib_SinCosModAb | ( | AlphaBeta_t * | ab, |
| mc_t | mod, | ||
| trig_t * | sinCos | ||
| ) |
Modulus function, it calculates hypotenusa.
| y | y-axis value to be calculated |
| x | x-axis value to be calculated |
Definition at line 676 of file MathLib_Float.c.
| float32_t MathLib_Sqrt | ( | float32_t | value | ) |
Calculates the square root of a floating point number.
| Floating | point input |
Definition at line 489 of file MathLib_Float.c.
| float32_t MathLib_SqrtFlt | ( | float32_t | value | ) |
Calculates the square root of a floating point number.
| Floating | point input |
Definition at line 523 of file MathLib_Float.c.
| float32_t MathLib_SqrtFromInvSqrt | ( | float32_t | x | ) |
Calculates the square root of a floating point number using the invSqrt method Referemce: https://betterexplained.com/articles/understanding-quakes-fast-inverse-square-root/.
| Floating | point input |
Definition at line 565 of file MathLib_Float.c.