public void SetDacChannelGain(ChannelAddress channelAddress, ushort value) { if (channelAddress < ChannelAddress.Dac0 || channelAddress > ChannelAddress.Dac39) { throw new ArgumentOutOfRangeException(nameof(channelAddress)); } var val = _evalBoard.DeviceState.Precision == DacPrecision.SixteenBit ? value : (ushort)(value & (ushort)BasicMasks.HighFourteenBits); if (!_evalBoard.DeviceState.UseRegisterCache || val != _evalBoard.DeviceState.MRegisters[channelAddress.ToChannelNumber()]) { using (_lockFactory.GetLock(LockType.CommandLock)) { _setCLRPinLowCommand.SetCLRPinLow(); _sendSPICommand.SendSPI((uint)SerialInterfaceModeBits.WriteToDACGainRegisterM | (uint)(((byte)channelAddress & (byte)BasicMasks.SixBits) << 16) | val); _evalBoard.DeviceState.MRegisters[channelAddress.ToChannelNumber()] = val; _setCLRPinHighCommand.SetCLRPinHigh(); } } }
public void SetOffsetDAC0(ushort value) { value &= (ushort)BasicMasks.FourteenBits; if (!_evalBoard.DeviceState.UseRegisterCache || value != _evalBoard.DeviceState.OFS0Register) { using (_lockFactory.GetLock(LockType.CommandLock)) { _setCLRPinLowCommand.SetCLRPinLow(); _writeOFS0RegisterCommand.WriteOFS0Register(value); _setCLRPinHighCommand.SetCLRPinHigh(); } } }