Austin Brown
/
ESCmk2_Inductance
Inductance Testing Code
Fork of CurrentModeSine by
Diff: math_ops/math_ops.cpp
- Revision:
- 1:64b881306f6f
- Parent:
- 0:9edd6ec0f56a
diff -r 9edd6ec0f56a -r 64b881306f6f math_ops/math_ops.cpp --- a/math_ops/math_ops.cpp Sat May 20 21:42:20 2017 +0000 +++ b/math_ops/math_ops.cpp Thu Oct 11 04:13:45 2018 +0000 @@ -25,3 +25,13 @@ *y = *y * limit/norm; } } + +void limit_abs(float *x, float limit){ + limit = abs(limit); + if(*x > limit){ + *x = limit; + } + if(*x < -limit){ + *x = -limit; + } + }