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