Skip to main content

IPwmControllerProvider Interface

Namespace: GHIElectronics.TinyCLR.Devices.Pwm.Provider · Assembly: GHIElectronics.TinyCLR.Devices.Pwm

Provider contract for a PWM controller. Most users call PwmController / PwmChannel directly; implement this interface only when supplying a custom or virtual PWM.

public interface IPwmControllerProvider : IDisposable

Properties

ChannelCount

int ChannelCount { get; }

Total number of channels exposed by this controller.

MinFrequency

double MinFrequency { get; }

Minimum frequency in Hz this controller can generate.

MaxFrequency

double MaxFrequency { get; }

Maximum frequency in Hz this controller can generate.

Methods

OpenChannel(int channel)

void OpenChannel(int channel)

Acquires exclusive access to the specified channel.

ParameterTypeDescription
channelintController-relative channel index.

CloseChannel(int channel)

void CloseChannel(int channel)

Releases a previously opened channel.

ParameterTypeDescription
channelintController-relative channel index.

EnableChannel(int channel)

void EnableChannel(int channel)

Begins generating the configured waveform on the channel.

ParameterTypeDescription
channelintController-relative channel index.

DisableChannel(int channel)

void DisableChannel(int channel)

Stops the waveform; the pin is parked in its inactive state.

ParameterTypeDescription
channelintController-relative channel index.

SetPulseParameters(int channel, double dutyCycle, PwmPulsePolarity polarity)

void SetPulseParameters(int channel, double dutyCycle, PwmPulsePolarity polarity)

Sets the active duty cycle and polarity for the channel.

ParameterTypeDescription
channelintController-relative channel index.
dutyCycledoubleActive fraction of the period, 0.0..1.0.
polarityPwmPulsePolarityWhich level is "active".

SetDesiredFrequency(double frequency)

double SetDesiredFrequency(double frequency)

Sets the controller-wide frequency.

ParameterTypeDescription
frequencydoubleTarget frequency in Hz.

Returns double — The frequency actually applied.

SetDesiredFrequency(int channel, double frequency)

double SetDesiredFrequency(int channel, double frequency)

Sets a per-channel frequency where the hardware supports it.

ParameterTypeDescription
channelintController-relative channel index.
frequencydoubleTarget frequency in Hz.

Returns double — The frequency actually applied to that channel.