C# Class BrrrBayBay.LogicPWMLib.LogicPwmDataGenerator

Inheritance: IDisposable
Show file Open project: joosthaverkort/PWMLogic Class Usage Examples

Public Methods

Method Description
Dispose ( ) : void
LogicPwmDataGenerator ( ) : System

Constructor

applyChannelSettings ( ) : void

Applies the PWM channel settings for a single channel. Calling this method in any other mode than asynchronous mode, will raise an exception.

In asynchronous mode this method will update all channels

applyChannelSettings ( int channel ) : void

Applies te PWM channel settings for a single channel. Calling this method in any other mode than asynchronous mode, will raise an exception.

calculateRealDutyCycle ( double desiredDutyCycle ) : double

Calculates the real duty cycle when using the current sample rate

calculateRealFrequency ( int desiredFrequency ) : double

Calculates the real frequency when using the current sample rate

fillBufferWithPwmStream ( byte buffer ) : void

Fills the provided byte array with pwm stream data

resetChannelSettings ( ) : void

Resets all channel settings to their default values

resetState ( ) : void

Resets the internal PWM control values

Private Methods

Method Description
applySynchronousChannelSettings ( ) : void

Applies the channel settings for synchronous mode

calculateSampleTickTime ( ) : double

Returns the time (in seconds) for a single sample tick

calculateSinglePeriodSampleCount ( int frequency ) : int

Calculates the number of samples needed for a single period of the given frequency

fillBufferAsyncMode ( byte buffer ) : void

Fills the provided byte array with pwm stream data in asynchronous mode

fillBufferSyncMode ( byte buffer ) : void

Fills the provided byte array with pwm stream data in synchronous mode

Method Details

Dispose() public method

public Dispose ( ) : void
return void

LogicPwmDataGenerator() public method

Constructor
public LogicPwmDataGenerator ( ) : System
return System

applyChannelSettings() public method

Applies the PWM channel settings for a single channel. Calling this method in any other mode than asynchronous mode, will raise an exception.
In asynchronous mode this method will update all channels
public applyChannelSettings ( ) : void
return void

applyChannelSettings() public method

Applies te PWM channel settings for a single channel. Calling this method in any other mode than asynchronous mode, will raise an exception.
public applyChannelSettings ( int channel ) : void
channel int The channel number
return void

calculateRealDutyCycle() public method

Calculates the real duty cycle when using the current sample rate
public calculateRealDutyCycle ( double desiredDutyCycle ) : double
desiredDutyCycle double
return double

calculateRealFrequency() public method

Calculates the real frequency when using the current sample rate
public calculateRealFrequency ( int desiredFrequency ) : double
desiredFrequency int The desired frequency in Hz
return double

fillBufferWithPwmStream() public method

Fills the provided byte array with pwm stream data
public fillBufferWithPwmStream ( byte buffer ) : void
buffer byte the byte array that should be filled
return void

resetChannelSettings() public method

Resets all channel settings to their default values
public resetChannelSettings ( ) : void
return void

resetState() public method

Resets the internal PWM control values
public resetState ( ) : void
return void