Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of ele350 by
soft_pwm.h@4:badd73a8d806, 2015-11-05 (annotated)
- Committer:
- GGHHHH
- Date:
- Thu Nov 05 12:24:05 2015 +0000
- Revision:
- 4:badd73a8d806
ku
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
GGHHHH | 4:badd73a8d806 | 1 | #ifndef _SOFT_PWM_ |
GGHHHH | 4:badd73a8d806 | 2 | #define _SOFT_PWM_ |
GGHHHH | 4:badd73a8d806 | 3 | |
GGHHHH | 4:badd73a8d806 | 4 | #include "mbed.h" |
GGHHHH | 4:badd73a8d806 | 5 | |
GGHHHH | 4:badd73a8d806 | 6 | class SoftPwm |
GGHHHH | 4:badd73a8d806 | 7 | { |
GGHHHH | 4:badd73a8d806 | 8 | private: |
GGHHHH | 4:badd73a8d806 | 9 | float period; |
GGHHHH | 4:badd73a8d806 | 10 | float dutyCycle; |
GGHHHH | 4:badd73a8d806 | 11 | Timer timer; |
GGHHHH | 4:badd73a8d806 | 12 | public: |
GGHHHH | 4:badd73a8d806 | 13 | |
GGHHHH | 4:badd73a8d806 | 14 | SoftPwm(float initialPeriod, float initialDutycycle); |
GGHHHH | 4:badd73a8d806 | 15 | |
GGHHHH | 4:badd73a8d806 | 16 | float getPeriod(); |
GGHHHH | 4:badd73a8d806 | 17 | float getDutyCycle(); |
GGHHHH | 4:badd73a8d806 | 18 | |
GGHHHH | 4:badd73a8d806 | 19 | void setPeriod(float newPeriod); |
GGHHHH | 4:badd73a8d806 | 20 | void setDutyCycle(float newDutyCycle); |
GGHHHH | 4:badd73a8d806 | 21 | |
GGHHHH | 4:badd73a8d806 | 22 | bool isOn(); |
GGHHHH | 4:badd73a8d806 | 23 | |
GGHHHH | 4:badd73a8d806 | 24 | }; |
GGHHHH | 4:badd73a8d806 | 25 | #endif |