TR-mbed 1.0
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
PwmIn Class Reference

#include <PwmIn.h>

Public Member Functions

 PwmIn (PinName p)
 
float period ()
 
float pulsewidth ()
 
float dutycycle ()
 

Protected Member Functions

void rise ()
 
void fall ()
 

Protected Attributes

InterruptIn _p
 
Timer _t
 
float _pulsewidth
 
float _period
 

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

Constructor & Destructor Documentation

◆ PwmIn()

PwmIn::PwmIn ( PinName  p)

Create a PwmIn

Parameters
pThe pwm input pin (must support InterruptIn)

Member Function Documentation

◆ dutycycle()

float PwmIn::dutycycle ( )

Read the current dutycycle

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

◆ fall()

void PwmIn::fall ( )
protected

◆ period()

float PwmIn::period ( )

Read the current period

Returns
the period in seconds

◆ pulsewidth()

float PwmIn::pulsewidth ( )

Read the current pulsewidth

Returns
the pulsewidth in seconds

◆ rise()

void PwmIn::rise ( )
protected

Member Data Documentation

◆ _p

InterruptIn PwmIn::_p
protected

◆ _period

float PwmIn::_period
protected

◆ _pulsewidth

float PwmIn::_pulsewidth
protected

◆ _t

Timer PwmIn::_t
protected

The documentation for this class was generated from the following files: