Skip to main content

AdcControllerApiWrapper Class

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

Concrete IAdcControllerProvider backed by the native TinyCLR ADC HAL. Constructed internally by AdcController; you don't normally need to use this type directly.

public sealed class AdcControllerApiWrapper : IAdcControllerProvider

Constructors

AdcControllerApiWrapper(NativeApi api)

public AdcControllerApiWrapper(NativeApi api)

Wraps the given native API as a provider.

ParameterTypeDescription
apiNativeApiThe native ADC API to bind to.

Properties

Api

public NativeApi Api { get; }

The underlying native API descriptor.

ChannelCount

public extern int ChannelCount { get; }

Total number of channels exposed by this controller. (inherited)

ResolutionInBits

public extern int ResolutionInBits { get; }

Sample width in bits. (inherited)

MinValue

public extern int MinValue { get; }

Smallest raw value accepted by Write(int, int). (inherited)

MaxValue

public extern int MaxValue { get; }

Largest raw value accepted by Write(int, int). (inherited)

Methods

Dispose()

public void Dispose()

Releases the native controller.

IsChannelModeSupported(AdcChannelMode mode)

public extern bool IsChannelModeSupported(AdcChannelMode mode)

Tests whether the controller supports the given channel mode. (inherited)

ParameterTypeDescription
modeAdcChannelModeThe mode to test.

Returns bool

GetChannelMode()

public extern AdcChannelMode GetChannelMode()

Returns the controller's current channel mode. (inherited)

Returns AdcChannelMode

SetChannelMode(AdcChannelMode value)

public extern void SetChannelMode(AdcChannelMode value)

Sets the controller's channel mode. (inherited)

ParameterTypeDescription
valueAdcChannelModeNew channel mode.

OpenChannel(int channel)

public extern void OpenChannel(int channel)

Acquires exclusive access to the specified channel. (inherited)

ParameterTypeDescription
channelintController-relative channel index.

CloseChannel(int channel)

public extern void CloseChannel(int channel)

Releases a previously opened channel. (inherited)

ParameterTypeDescription
channelintController-relative channel index.

Read(int channel, TimeSpan samplingTime)

public extern int Read(int channel, TimeSpan samplingTime)

Waits for the pin to reach waitForState, then captures inter-edge intervals. (inherited)

ParameterTypeDescription
channelint
samplingTimeTimeSpan

Returns int — Number of intervals captured.