This Library allows you to use any pin on the mbed micro as PWM out. It also allows the user to update the Period and Pulse width in realtime.
PwmOutAny.h@0:9eb94736e774, 2013-12-08 (annotated)
- Committer:
- mr63
- Date:
- Sun Dec 08 19:04:44 2013 +0000
- Revision:
- 0:9eb94736e774
This Library allows you to use any pin on the mbed micro as PWM out. It also allows the user to update the Period and Pulse width in realtime.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mr63 | 0:9eb94736e774 | 1 | #include "mbed.h" |
mr63 | 0:9eb94736e774 | 2 | |
mr63 | 0:9eb94736e774 | 3 | |
mr63 | 0:9eb94736e774 | 4 | class PwmOutAny { |
mr63 | 0:9eb94736e774 | 5 | public: |
mr63 | 0:9eb94736e774 | 6 | |
mr63 | 0:9eb94736e774 | 7 | PwmOutAny(PinName pin1, float Period, float PercentHigh); |
mr63 | 0:9eb94736e774 | 8 | |
mr63 | 0:9eb94736e774 | 9 | float Get_PulseWidth(); |
mr63 | 0:9eb94736e774 | 10 | void Set_PulseWidth(float PW); |
mr63 | 0:9eb94736e774 | 11 | float Get_Period(); |
mr63 | 0:9eb94736e774 | 12 | void Set_Period(float ChangePeriod); |
mr63 | 0:9eb94736e774 | 13 | |
mr63 | 0:9eb94736e774 | 14 | |
mr63 | 0:9eb94736e774 | 15 | private: |
mr63 | 0:9eb94736e774 | 16 | void TickerFlipper(); |
mr63 | 0:9eb94736e774 | 17 | Ticker _PwmTicker; |
mr63 | 0:9eb94736e774 | 18 | DigitalOut _PwmOut; |
mr63 | 0:9eb94736e774 | 19 | |
mr63 | 0:9eb94736e774 | 20 | }; |