public void Dispose() { if (_isDisposed) { return; } SpiComm?.Dispose(); _spiCommController?.Dispose(); Pins.Reset?.Dispose(); if (Pins.Dio0 != null) { Pins.Dio0.ValueChanged -= Dio0Pin_ValueChanged; Pins.Dio0.Dispose(); } Pins.Dio1?.Dispose(); Pins.Dio2?.Dispose(); Pins.Dio3?.Dispose(); Pins.Dio4?.Dispose(); Pins.Dio5?.Dispose(); _transmissionCompletedEventSlim?.Dispose(); _isDisposed = true; }
public void PerformSelfCalibration() { SpiComm.Operate(spiDevice => { WriteCommand(spiDevice, Constants.Command.SelfCal); WaitDataReady(false); }); }
private double GetInput(double vRef, byte positiveInputMuxValue, byte negativeInputMuxValue) { return(SpiComm.Operate(spiDevice => { EnsureConfiguration(spiDevice); WriteRegister(spiDevice, Constants.Register.Mux, (byte)(positiveInputMuxValue | negativeInputMuxValue)); _timing.WaitMicroseconds(5); WriteCommand(spiDevice, Constants.Command.Sync); _timing.WaitMicroseconds(5); WriteCommand(spiDevice, Constants.Command.WakeUp); _timing.WaitMicroseconds(25); int rawInputValue = ReadRawInputValue(spiDevice); return rawInputValue * vRef / (0x7FFFFF * _currentRegisters.GainFactor); })); }