A library that maps one range onto another range.
Diff: Map.hpp
- Revision:
- 1:dad975e2e150
- Parent:
- 0:f274b178a2d4
--- a/Map.hpp Wed Sep 28 01:44:45 2016 +0000 +++ b/Map.hpp Wed Sep 28 04:02:59 2016 +0200 @@ -0,0 +1,34 @@ +#ifndef MAP_H +#define MAP_H + +#include "mbed.h" + +/** + * A library that maps one range (inMin -> inMax) to another (outMin -> outMax) + * + * @author CA Bezuidenhout + */ +class Map +{ +public: + /** + * @param inMin : Minimum value of input range + * @param inMax : Maximum value of input range + * @param outMin : Minimum value of output range + * @param outMax : Maximum value of output range + */ + Map(float inMin, float inMax, float outMin, float outMax); + + /** + * Map inVal onto the output range + * + * @param inVal : A value in the input range to be mapped onto the output range + * @returns A value in the output range + */ + float Calculate(float inVal); +private: + float _inMin,_inMax; + float _outMin,_outMax; + +}; +#endif