/// <summary> /// Opens the ADC pin. /// </summary> /// <param name="device">The ADC device number.</param> /// <param name="channel">The ADC channel number to control.</param> public AdcChannel(int device, int channel) { var ret = NativeAdc.Open(device, channel, out _handle); if (ret != Internals.Errors.ErrorCode.None) { throw ExceptionFactory.CreateException(ret); } }
/// <summary> /// Disposes the ADC pin. /// </summary> protected virtual void Dispose(bool disposing) { if (_disposed) { return; } NativeAdc.Close(_handle); _disposed = true; }
/// <summary> /// Gets the current value of the ADC pin. /// </summary> public uint ReadValue() { var ret = NativeAdc.Read(_handle, out uint adcValue); if (ret != Internals.Errors.ErrorCode.None) { throw ExceptionFactory.CreateException(ret); } return(adcValue); }