A Servo control library that works on any output pin, not just the PWM pins

Dependents:   PES2_Board_Servo

Committer:
bloodline
Date:
Wed Oct 13 23:53:29 2010 +0000
Revision:
0:dde1a0011645

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bloodline 0:dde1a0011645 1 /* UniServ Servo Library
bloodline 0:dde1a0011645 2 * Copyright (c) 2010 Matt Parsons
bloodline 0:dde1a0011645 3 *
bloodline 0:dde1a0011645 4 * Permission is hereby granted, free of charge, to any person obtaining a copy
bloodline 0:dde1a0011645 5 * of this software and associated documentation files (the "Software"), to deal
bloodline 0:dde1a0011645 6 * in the Software without restriction, including without limitation the rights
bloodline 0:dde1a0011645 7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
bloodline 0:dde1a0011645 8 * copies of the Software, and to permit persons to whom the Software is
bloodline 0:dde1a0011645 9 * furnished to do so, subject to the following conditions:
bloodline 0:dde1a0011645 10 *
bloodline 0:dde1a0011645 11 * The above copyright notice and this permission notice shall be included in
bloodline 0:dde1a0011645 12 * all copies or substantial portions of the Software.
bloodline 0:dde1a0011645 13 *
bloodline 0:dde1a0011645 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
bloodline 0:dde1a0011645 15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
bloodline 0:dde1a0011645 16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
bloodline 0:dde1a0011645 17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
bloodline 0:dde1a0011645 18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
bloodline 0:dde1a0011645 19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
bloodline 0:dde1a0011645 20 * THE SOFTWARE.
bloodline 0:dde1a0011645 21 */
bloodline 0:dde1a0011645 22
bloodline 0:dde1a0011645 23 #ifndef MBED_UNISERVE_H
bloodline 0:dde1a0011645 24 #define MBED_UNISERVE_H
bloodline 0:dde1a0011645 25
bloodline 0:dde1a0011645 26 #include "mbed.h"
bloodline 0:dde1a0011645 27
bloodline 0:dde1a0011645 28 class UniServ{
bloodline 0:dde1a0011645 29
bloodline 0:dde1a0011645 30 public:
bloodline 0:dde1a0011645 31 UniServ(PinName);
bloodline 0:dde1a0011645 32 void write_us(int);
bloodline 0:dde1a0011645 33 int read_us();
bloodline 0:dde1a0011645 34
bloodline 0:dde1a0011645 35 private:
bloodline 0:dde1a0011645 36 void SigStart();
bloodline 0:dde1a0011645 37 void SigStop();
bloodline 0:dde1a0011645 38 DigitalOut ServPin;
bloodline 0:dde1a0011645 39 int Period;
bloodline 0:dde1a0011645 40 int Position;
bloodline 0:dde1a0011645 41 int ServMin;
bloodline 0:dde1a0011645 42 int ServMax;
bloodline 0:dde1a0011645 43 Ticker Pulse;
bloodline 0:dde1a0011645 44 Timeout PulseEnd;
bloodline 0:dde1a0011645 45
bloodline 0:dde1a0011645 46 };
bloodline 0:dde1a0011645 47
bloodline 0:dde1a0011645 48
bloodline 0:dde1a0011645 49 #endif
bloodline 0:dde1a0011645 50