RC Servo Output

Committer:
HMFK03LST1
Date:
Tue Dec 15 16:58:10 2015 +0000
Revision:
0:608a9f61c2d7
first attempt

Who changed what in which revision?

UserRevisionLine numberNew contents of line
HMFK03LST1 0:608a9f61c2d7 1 #include "mbed.h"
HMFK03LST1 0:608a9f61c2d7 2
HMFK03LST1 0:608a9f61c2d7 3 class RC_PWM {
HMFK03LST1 0:608a9f61c2d7 4 public:
HMFK03LST1 0:608a9f61c2d7 5
HMFK03LST1 0:608a9f61c2d7 6 /** Create a new PWM Output for RC Components
HMFK03LST1 0:608a9f61c2d7 7 *
HMFK03LST1 0:608a9f61c2d7 8 * @param _PWM is the pin for PWM Output
HMFK03LST1 0:608a9f61c2d7 9 * @param PWM_min minimum high time in µs
HMFK03LST1 0:608a9f61c2d7 10 * @param PWM_max maximum high time in µs
HMFK03LST1 0:608a9f61c2d7 11 * @param frequenz repeating Frequenz in Hz
HMFK03LST1 0:608a9f61c2d7 12 */
HMFK03LST1 0:608a9f61c2d7 13 RC_PWM(PinName _PWM, int PWM_min, int PWM_max, int frequenz);
HMFK03LST1 0:608a9f61c2d7 14
HMFK03LST1 0:608a9f61c2d7 15 /** Create a new PWM Output for RC Components
HMFK03LST1 0:608a9f61c2d7 16 *
HMFK03LST1 0:608a9f61c2d7 17 * @param _PWM is the pin for PWM Output
HMFK03LST1 0:608a9f61c2d7 18 */
HMFK03LST1 0:608a9f61c2d7 19 RC_PWM(PinName _PWM);
HMFK03LST1 0:608a9f61c2d7 20
HMFK03LST1 0:608a9f61c2d7 21 PwmOut pwm;
HMFK03LST1 0:608a9f61c2d7 22
HMFK03LST1 0:608a9f61c2d7 23 /** sets PWM in Prozentage
HMFK03LST1 0:608a9f61c2d7 24 *
HMFK03LST1 0:608a9f61c2d7 25 * @param prozent of PWM range 0 - 100
HMFK03LST1 0:608a9f61c2d7 26 *
HMFK03LST1 0:608a9f61c2d7 27 */
HMFK03LST1 0:608a9f61c2d7 28 void set(char prozent);
HMFK03LST1 0:608a9f61c2d7 29
HMFK03LST1 0:608a9f61c2d7 30 /** sets PWM in µs
HMFK03LST1 0:608a9f61c2d7 31 *
HMFK03LST1 0:608a9f61c2d7 32 * @param us set PWM hightime in µs
HMFK03LST1 0:608a9f61c2d7 33 *
HMFK03LST1 0:608a9f61c2d7 34 */
HMFK03LST1 0:608a9f61c2d7 35 void set_us(int us);
HMFK03LST1 0:608a9f61c2d7 36
HMFK03LST1 0:608a9f61c2d7 37
HMFK03LST1 0:608a9f61c2d7 38 int min;
HMFK03LST1 0:608a9f61c2d7 39
HMFK03LST1 0:608a9f61c2d7 40 int max;
HMFK03LST1 0:608a9f61c2d7 41
HMFK03LST1 0:608a9f61c2d7 42 int frq;
HMFK03LST1 0:608a9f61c2d7 43
HMFK03LST1 0:608a9f61c2d7 44 private:
HMFK03LST1 0:608a9f61c2d7 45
HMFK03LST1 0:608a9f61c2d7 46 /** limit PWM between PWM_min and PWM_max
HMFK03LST1 0:608a9f61c2d7 47 *
HMFK03LST1 0:608a9f61c2d7 48 * @param us_i µs input limited µs on output
HMFK03LST1 0:608a9f61c2d7 49 *
HMFK03LST1 0:608a9f61c2d7 50 */
HMFK03LST1 0:608a9f61c2d7 51 int limit(int us_i);
HMFK03LST1 0:608a9f61c2d7 52
HMFK03LST1 0:608a9f61c2d7 53 };