Search Code
About PwmIn

First published 17 Feb 2010, with 2 revisions since.
Last update: 02 Sep 2010.
View history

Last change message: Convert previous example in to a library, including doxygen docs

Related to
PwmIn_ModSerial
Problems with compilation of MODSERIAL
tag MODSERIAL, PwmIn

CHR6dm_reading
CHR-6dm trial
tag CHR-6dm, MODSERIAL

Import this library into a program

PwmIn

Published 02 Sep 2010, by   user Simon Ford   tag InterruptIn, PwmIn
Embed: (wiki syntax)

« Back to documentation index

PwmIn Class Reference

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

PwmIn ( PinName  p  ) 

Create a PwmIn.

Parameters:
p The pwm input pin (must support InterruptIn)

Definition at line 25 of file PwmIn.cpp.


Member Function Documentation

float dutycycle (  ) 

Read the current dutycycle.

Returns:
the dutycycle as a percentage, represented between 0.0-1.0

Definition at line 41 of file PwmIn.cpp.

float period (  ) 

Read the current period.

Returns:
the period in seconds

Definition at line 33 of file PwmIn.cpp.

float pulsewidth (  ) 

Read the current pulsewidth.

Returns:
the pulsewidth in seconds

Definition at line 37 of file PwmIn.cpp.