private void OnTick(object sender, EventArgs e) { adcListView.Items.Clear(); foreach (IOWarrior iow in FastIOW.GetIOWarriors().Where(entry => entry is ADCDevice)) { ADCInterface adc = (iow as ADCDevice).ADC; for (int counter = 0; counter < adc.AnalogPins.Length; counter++) { double ratio = (adc.AnalogRead(adc.AnalogPins[counter]) / 65535.0); double vcc = 5.0; if (iow is IOWarrior28) { vcc = 3.3; } adcListView.Items.Add(new ListViewItem(new[] { iow.Name, iow.SerialNumber, "ADC_" + counter, (ratio * vcc).ToString("#0.00") + "V" })); } } }
internal IOWarrior28(IntPtr handle) : base(handle) { I2C = new I2CInterfaceImplementation(this, Pipe.I2C_MODE, 62); ADC = new ADCInterfaceImplementation(this, Pipe.ADC_MODE, AnalogPins); }