as
Dependencies: CommonTypes ESC Matrix PID Servo kalman mbed-rtos mbed
Fork of Nucleo_MPU_9250_ by
MathFuncs.h
- Committer:
- AlanHuchin
- Date:
- 2018-06-26
- Revision:
- 0:89cf0851969b
File content as of revision 0:89cf0851969b:
/* * SOURCE FILE : MathFuncs.h * * Definition of class MathFuncs. * */ #ifndef MathFuncsDefined #define MathFuncsDefined #include "Types.h" /** Various useful maths related functions. */ class MathFuncs { public : /** Constrain a number to be between 2 values. * * @param x Number to constrain. * @param min Minimum value. * @param max Maximum value. * @returns A number between min and max. */ static Int16 Constrain( Int16 x, Int16 min, Int16 max ) { if( x < min ) { return min; } else if( x > max ) { return max; } else { return x; } } }; #endif /* END of MathFuncs.h */