コード例 #1
0
        public void PerformSelfCalibration()
        {
            SpiComm.Operate(spiDevice =>
            {
                WriteCommand(spiDevice, Constants.Command.SelfCal);

                WaitDataReady(false);
            });
        }
コード例 #2
0
        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);
            }));
        }