#include "Arduino.h"
Go to the source code of this file.
◆ _120_D2R
| #define _120_D2R 2.09439510239 |
◆ _1_SQRT3
| #define _1_SQRT3 0.57735026919 |
◆ _2_SQRT3
| #define _2_SQRT3 1.15470053838 |
◆ _2PI
| #define _2PI 6.28318530718 |
◆ _3PI_2
| #define _3PI_2 4.71238898038 |
◆ _ACTIVE
◆ _constrain
| #define _constrain |
( |
|
amt, |
|
|
|
low, |
|
|
|
high |
|
) |
| ((amt)<(low)?(low):((amt)>(high)?(high):(amt))) |
◆ _HIGH_IMPEDANCE
| #define _HIGH_IMPEDANCE 0 |
◆ _HIGH_Z
◆ _isset
| #define _isset |
( |
|
a | ) |
( (a) != (NOT_SET) ) |
◆ _PI
| #define _PI 3.14159265359 |
◆ _PI_2
| #define _PI_2 1.57079632679 |
◆ _PI_3
| #define _PI_3 1.0471975512 |
◆ _PI_6
| #define _PI_6 0.52359877559 |
◆ _round
| #define _round |
( |
|
x | ) |
((x)>=0?(long)((x)+0.5):(long)((x)-0.5)) |
◆ _sign
| #define _sign |
( |
|
a | ) |
( ( (a) < 0 ) ? -1 : ( (a) > 0 ) ) |
◆ _sqrt
◆ _SQRT2
| #define _SQRT2 1.41421356237 |
◆ _SQRT3
| #define _SQRT3 1.73205080757 |
◆ _SQRT3_2
| #define _SQRT3_2 0.86602540378 |
◆ NOT_SET
◆ _cos()
Function approximating cosine calculation by using fixed size array
- execution time ~50us (Arduino UNO)
- Parameters
-
| a | angle in between 0 and 2PI |
Definition at line 39 of file foc_utils.cpp.
◆ _electricalAngle()
| float _electricalAngle |
( |
float |
shaft_angle, |
|
|
int |
pole_pairs |
|
) |
| |
Electrical angle calculation
- Parameters
-
| shaft_angle | - shaft angle of the motor |
| pole_pairs | - number of pole pairs |
Definition at line 53 of file foc_utils.cpp.
◆ _normalizeAngle()
| float _normalizeAngle |
( |
float |
angle | ) |
|
normalizing radian angle to [0,2PI]
- Parameters
-
| angle | - angle to be normalized |
Definition at line 47 of file foc_utils.cpp.
◆ _sin()
Function approximating the sine calculation by using fixed size array
- execution time ~40us (Arduino UNO)
- Parameters
-
| a | angle in between 0 and 2PI |
Definition at line 14 of file foc_utils.cpp.
◆ _sqrtApprox()
| float _sqrtApprox |
( |
float |
value | ) |
|
Function approximating square root function
- using fast inverse square root
- Parameters
-
Definition at line 60 of file foc_utils.cpp.