private const int LatencyTimer = 255; // Hz static void Main(string[] args) { var adcSpiConfig = new FtChannelConfig { ClockRate = ConnectionSpeed, LatencyTimer = LatencyTimer, configOptions = FtConfigOptions.Mode0 | FtConfigOptions.CsDbus3 | FtConfigOptions.CsActivelow }; var adcConfig = new Maxim186Configuration { Channel = Maxim186.Channel.Channel0, ConversionType = Maxim186.ConversionType.SingleEnded, Polarity = Maxim186.Polarity.Unipolar, PowerMode = Maxim186.PowerMode.InternalClockMode }; var adc = new Maxim186(adcConfig, adcSpiConfig); do { Console.WriteLine(adc.GetConvertedSample()); } while (true); //*/ }
private byte GetAdcControlWord(Maxim186Configuration config, Channel?channel = null) { int word = 0; channel = channel ?? config.Channel; word = 1 << 7; // Reserved Bit word |= (int)channel.Value << 4; // channel word |= (int)config.Polarity << 3; word |= (int)config.ConversionType << 2; word |= (int)config.PowerMode; return((byte)word); }
public Maxim186(Maxim186Configuration adcConfig, FtChannelConfig config, SpiConfiguration spiConfig) : base(config, spiConfig) { _adcConfig = adcConfig; }
public Maxim186(Maxim186Configuration adcConfig, FtChannelConfig config) : this(adcConfig, config, null) { }
private byte GetAdcControlWord(Maxim186Configuration config, Channel? channel = null) { int word = 0; channel = channel ?? config.Channel; word = 1 << 7; // Reserved Bit word |= (int)channel.Value << 4; // channel word |= (int)config.Polarity << 3; word |= (int)config.ConversionType << 2; word |= (int)config.PowerMode; return (byte)word; }