
elec350
Fork of elec350 by
soft_pwm.h@10:021f19a9861f, 2015-10-21 (annotated)
- Committer:
- rmerrisonhort
- Date:
- Wed Oct 21 19:52:30 2015 +0000
- Revision:
- 10:021f19a9861f
- Child:
- 11:4685f33a2468
Added SoftPwm class.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
rmerrisonhort | 10:021f19a9861f | 1 | #ifndef _SOFT_PWM_ |
rmerrisonhort | 10:021f19a9861f | 2 | #define _SOFT_PWM_ |
rmerrisonhort | 10:021f19a9861f | 3 | |
rmerrisonhort | 10:021f19a9861f | 4 | #include "mbed.h" |
rmerrisonhort | 10:021f19a9861f | 5 | |
rmerrisonhort | 10:021f19a9861f | 6 | class SoftPwm |
rmerrisonhort | 10:021f19a9861f | 7 | { |
rmerrisonhort | 10:021f19a9861f | 8 | private: |
rmerrisonhort | 10:021f19a9861f | 9 | float period; |
rmerrisonhort | 10:021f19a9861f | 10 | float dutyCycle; |
rmerrisonhort | 10:021f19a9861f | 11 | Timer timer; |
rmerrisonhort | 10:021f19a9861f | 12 | public: |
rmerrisonhort | 10:021f19a9861f | 13 | SoftPwm(float initialPeriod, float initialDutycycle); |
rmerrisonhort | 10:021f19a9861f | 14 | |
rmerrisonhort | 10:021f19a9861f | 15 | void setPeriod(float newPeriod); |
rmerrisonhort | 10:021f19a9861f | 16 | void setDutyCycle(float newDutyCycle); |
rmerrisonhort | 10:021f19a9861f | 17 | bool isOn(); |
rmerrisonhort | 10:021f19a9861f | 18 | }; |
rmerrisonhort | 10:021f19a9861f | 19 | |
rmerrisonhort | 10:021f19a9861f | 20 | #endif |