Published 02 Sep 2010, by
Simon Ford
InterruptIn,
PwmIn
PwmIn Class Reference
PwmIn class to read PWM inputs.
More...
#include <PwmIn.h>
Public Member Functions |
| | PwmIn (PinName p) |
| | Create a PwmIn.
|
| float | period () |
| | Read the current period.
|
| float | pulsewidth () |
| | Read the current pulsewidth.
|
| float | dutycycle () |
| | Read the current dutycycle.
|
Detailed Description
PwmIn class to read PWM inputs.
Uses InterruptIn to measure the changes on the input and record the time they occur
- Note:
- uses InterruptIn, so not available on p19/p20
Definition at line 35 of file PwmIn.h.
Constructor & Destructor Documentation
Create a PwmIn.
- Parameters:
-
| p | The pwm input pin (must support InterruptIn) |
Definition at line 25 of file PwmIn.cpp.
Member Function Documentation
Read the current dutycycle.
- Returns:
- the dutycycle as a percentage, represented between 0.0-1.0
Definition at line 41 of file PwmIn.cpp.
Read the current period.
- Returns:
- the period in seconds
Definition at line 33 of file PwmIn.cpp.
Read the current pulsewidth.
- Returns:
- the pulsewidth in seconds
Definition at line 37 of file PwmIn.cpp.