miniFOC 1.0.3
This open-source project aims to accomplish a FOC(Field Oriented Control) scheme that is operatable with minimum costs in China.
Macros | Functions
fast_math.h File Reference

this is the header file of fast_math.c, the macros of fast amplitude limiting algorithm and cosine function evaluation algorithm are defined. More...

Go to the source code of this file.

Macros

#define fast_constrain(x, low, high)   ((x)<(low)?(low):((x) >(high)?(high):(x)))
 fast clipping algorithm More...
 
#define fast_cos(x)   fast_sin(1.5707963f - x);
 fast calculation of cosine More...
 

Functions

float fast_sin (float theta)
 fast calculation of sine More...
 

Detailed Description

this is the header file of fast_math.c, the macros of fast amplitude limiting algorithm and cosine function evaluation algorithm are defined.

Author
Lao·Zhu
Version
V1.0.1
Date
10. October 2021

Definition in file fast_math.h.

Macro Definition Documentation

◆ fast_constrain

#define fast_constrain (   x,
  low,
  high 
)    ((x)<(low)?(low):((x) >(high)?(high):(x)))

fast clipping algorithm

Parameters
[in]xnumber of to be clipped
[in]lowminimum number
[in]highmaximum number
Return values
inputvalue after clipping

Definition at line 20 of file fast_math.h.

◆ fast_cos

#define fast_cos (   x)    fast_sin(1.5707963f - x);

fast calculation of cosine

Parameters
[in]xangle to be calculated
Return values
cosinevalue of angle theta

Definition at line 27 of file fast_math.h.

Function Documentation

◆ fast_sin()

float fast_sin ( float  theta)

fast calculation of sine

Parameters
[in]thetaangle to be calculated
Return values
sinevalue of angle theta

Definition at line 72 of file fast_math.c.

References sin_tab.

Referenced by foc_calculate_dutycycle().