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

Fork of UniServ by Matt Parsons

Committer:
mario_meh
Date:
Wed Feb 08 08:35:32 2017 +0000
Revision:
1:8343f1715462
Parent:
0:dde1a0011645
Zadnje izmjene pred predaju

Who changed what in which revision?

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