Modified Motor Driver Firmware to include Flash + Thermal
Dependencies: FastPWM3 mbed-dev-STM-lean
Diff: math_ops.cpp
- Revision:
- 25:f5741040c4bb
- Parent:
- 20:bf9ea5125d52
- Child:
- 26:2b865c00d7e9
diff -r 58c2d7571207 -r f5741040c4bb math_ops.cpp --- a/math_ops.cpp Fri Apr 07 16:23:39 2017 +0000 +++ b/math_ops.cpp Sun Apr 09 03:05:52 2017 +0000 @@ -3,22 +3,27 @@ float fmaxf(float x, float y){ + /// Returns maximum of x, y /// return (((x)>(y))?(x):(y)); } float fminf(float x, float y){ + /// Returns minimum of x, y /// return (((x)<(y))?(x):(y)); } float fmaxf3(float x, float y, float z){ + /// Returns maximum of x, y, z /// return (x > y ? (x > z ? x : z) : (y > z ? y : z)); } float fminf3(float x, float y, float z){ + /// Returns minimum of x, y, z /// return (x < y ? (x < z ? x : z) : (y < z ? y : z)); } void limit_norm(float *x, float *y, float limit){ + /// Scales the lenght of vector (x, y) to be <= limit /// float norm = sqrt(*x * *x + *y * *y); if(norm > limit){ *x = *x * limit/norm;