C# Class Porrey.Uwp.IoT.SoftPwm

Provides a software based Pulse Width Modulation capability for any GPIO pin on the device. PWM is used in a variety of circuits as a way to control analog circuits through digital interfaces.
Inheritance: ISoftPwm
Show file Open project: porrey/iot

Public Properties

Property Type Description
PwmPulsed EventHandler

Public Methods

Method Description
Dispose ( ) : void

Stops the SoftPwm if active and calls Dispose on the GPIO pin.

SoftPwm ( Windows.Devices.Gpio.GpioPin pin ) : System

Creates an instance of SoftPwm given an instance of Windows.Devices.Gpio.GpioPin.

StartAsync ( ) : void

Start the SoftPwm in the GPIO pin.

StopAsync ( ) : Task

Stop the SoftPwm on the GPIO pin.

Protected Methods

Method Description
OnPulseWidthChanged ( double highPulseWidth, double lowPulseWidth ) : void

Called to raise the PulseWidthChanged event.

OnPwmPulsed ( ) : void

Called to raise the PwmPulsed event

Private Methods

Method Description
CheckDisposed ( ) : void

Checks if this instance has been disposed and throws the ObjectDisposedException exception if it is.

DelayMicroSeconds ( double delayMicroseconds ) : Task

Delays the current thread by the given number of μs.

Method Details

Dispose() public method

Stops the SoftPwm if active and calls Dispose on the GPIO pin.
public Dispose ( ) : void
return void

OnPulseWidthChanged() protected method

Called to raise the PulseWidthChanged event.
protected OnPulseWidthChanged ( double highPulseWidth, double lowPulseWidth ) : void
highPulseWidth double
lowPulseWidth double
return void

OnPwmPulsed() protected method

Called to raise the PwmPulsed event
protected OnPwmPulsed ( ) : void
return void

SoftPwm() public method

Creates an instance of SoftPwm given an instance of Windows.Devices.Gpio.GpioPin.
public SoftPwm ( Windows.Devices.Gpio.GpioPin pin ) : System
pin Windows.Devices.Gpio.GpioPin An instance of Windows.Devices.Gpio.GpioPin to create the SoftPwm on.
return System

StartAsync() public method

Start the SoftPwm in the GPIO pin.
public StartAsync ( ) : void
return void

StopAsync() public method

Stop the SoftPwm on the GPIO pin.
public StopAsync ( ) : Task
return Task

Property Details

PwmPulsed public property

This event is fired for every pulse (after the low pulse). Monitoring of this event can impact the performance of this Soft PWM and it's ability to keep accurate timing.
public EventHandler PwmPulsed
return EventHandler