SoftwarePWM.h
Go to the documentation of this file.
00001 /* mbed Software PWM Library without using PWM pins
00002  * Copyright (c) 2012 Takashi Kojo
00003  * based and modified, Copyright (c) 2010 Jasper Denkers
00004  *
00005  * Permission is hereby granted, free of charge, to any person obtaining a copy
00006  * of this software and associated documentation files (the "Software"), to deal
00007  * in the Software without restriction, including without limitation the rights
00008  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
00009  * copies of the Software, and to permit persons to whom the Software is
00010  * furnished to do so, subject to the following conditions:
00011  *
00012  * The above copyright notice and this permission notice shall be included in
00013  * all copies or substantial portions of the Software.
00014  *
00015  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
00016  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00017  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
00018  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
00019  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
00020  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
00021  * THE SOFTWARE.
00022 */
00023 
00024 #ifndef MBED_SOFTWAREPWM_H
00025 #define MBED_SOFTWAREPWM_H
00026 
00027 #include "mbed.h"
00028 
00055 class SoftwarePWM
00056 {
00057 
00058 public:
00063   SoftwarePWM(PinName Pin);
00064 
00069   void SetPosition(int NewPos);
00070 
00076   void Enable(int StartPos, int Period);
00077 
00081   void Disable();
00082 
00083 private:
00084   void StartPulse();
00085   void EndPulse();
00086 
00087   int Position;
00088   DigitalOut SoftwarePWMPin;
00089   Ticker Pulse;
00090   Timeout PulseStop;
00091 };
00092 
00093 
00094 extern SoftwarePWM Intensity[] ;
00095 #define INTENSITY_FACTOR 10
00096 
00097 #endif


rosserial_mbed
Author(s): Gary Servin
autogenerated on Sat Oct 7 2017 03:08:46