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.
Dependents: PPM_Test QuadCopter Quadcopter_mk2
Diff: PPM.cpp
- Revision:
- 1:fb0ab71eb0ea
- Parent:
- 0:083ed8cea5ff
--- a/PPM.cpp Tue Aug 26 15:54:34 2014 +0000
+++ b/PPM.cpp Thu Jan 22 18:02:33 2015 +0000
@@ -90,9 +90,14 @@
else
{
//Map the channel times to value between the channel min and channel max
- channelData[i] = (_completeTimes[i] - _minimumPulseTime) * (_maximumOutput - _minimumOutput) / (_maximumPulseTime - _minimumPulseTime) + _minimumOutput;
+ channelData[i] = Map(_completeTimes[i] ,_minimumPulseTime, _maximumPulseTime, _minimumOutput, _maximumOutput);
}
}
return;
+}
+
+float PPM::Map(float input, float inputMin, float inputMax, float outputMin, float outputMax)
+{
+ return (input - inputMin) * (outputMax - outputMin) / (inputMax - inputMin) + outputMin;
}
\ No newline at end of file