AdcController Class
Namespace: GHIElectronics.TinyCLR.Devices.Adc · Assembly: GHIElectronics.TinyCLR.Devices.Adc
Represents an ADC peripheral. Open a channel via OpenChannel(int) to take samples; use MinValue/MaxValue to know the raw-code range for the configured resolution.
public class AdcController : IDisposable
Properties
Provider
public IAdcControllerProvider Provider { get; }
The low-level provider backing this controller.
ChannelCount
public int ChannelCount { get; }
Number of channels exposed by this controller.
ResolutionInBits
public int ResolutionInBits { get; }
Sample width in bits. Determines the spread between MinValue and MaxValue.
MinValue
public int MinValue { get; }
Smallest raw value AdcChannel.ReadValue can return.
MaxValue
public int MaxValue { get; }
Largest raw value AdcChannel.ReadValue can return.
ChannelMode
public AdcChannelMode ChannelMode { get; set; }
Controller-wide channel mode (single-ended or differential). Not every mode is supported on every controller — check with IsChannelModeSupported(AdcChannelMode).
Methods
GetDefault()
public static AdcController GetDefault()
Returns the default ADC controller for this device.
Returns AdcController
FromName(string name)
public static AdcController FromName(string name)
Returns an ADC controller identified by its native API name.
| Parameter | Type | Description |
|---|---|---|
name | string | Native API name. |
Returns AdcController
FromProvider(IAdcControllerProvider provider)
public static AdcController FromProvider(IAdcControllerProvider provider)
Creates a controller from a custom IAdcControllerProvider.
| Parameter | Type | Description |
|---|---|---|
provider | IAdcControllerProvider | Provider implementing the channel operations. |
Returns AdcController
IsChannelModeSupported(AdcChannelMode mode)
public bool IsChannelModeSupported(AdcChannelMode mode)
Tests whether the controller supports a given channel mode.
| Parameter | Type | Description |
|---|---|---|
mode | AdcChannelMode | The mode to test. |
Returns bool
Dispose()
public void Dispose()
Releases the underlying provider.
OpenChannel(int channelNumber)
public AdcChannel OpenChannel(int channelNumber)
Opens a channel for sampling.
| Parameter | Type | Description |
|---|---|---|
channelNumber | int | Controller-relative channel index. |
Returns AdcChannel — An AdcChannel; dispose it to release the channel.