Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: CircularBuffer Servo Terminal mbed Radio
Diff: utility.h
- Revision:
- 18:8806d24809c2
- Parent:
- 17:4ec59e8b52a6
--- a/utility.h Mon May 27 03:31:58 2013 +0000 +++ b/utility.h Mon May 27 20:08:03 2013 +0000 @@ -1,5 +1,3 @@ - - inline float min(float a, float b) { return (a < b ? a : b); @@ -10,4 +8,40 @@ inline float pos(float f) { return f > 0.0f ? f : 0.0f; +} + + + +inline int deadzone(int input, int zone) +{ + if (input > zone) return input; + else if (input < -zone) return input; + else return 0; +} + + + +inline int least(float f1, float f2, float f3, float f4) +{ + int value = 0; + float temp = f1; + + if (f2 < temp) + { + value = 1; + temp = f2; + } + + if (f3 < temp) + { + value = 2; + temp = f3; + } + + if (f4 < temp) + { + value = 3; + } + + return value; } \ No newline at end of file