public void SendDeviceCommand(DeviceCommand deviceCommand, uint setupData)
        {
            using (_lockFactory.GetLock(LockType.CommandLock))
            {
                if (!_evalBoard.DeviceState.SPI_Initialized && deviceCommand != DeviceCommand.InitializeSPIPins)
                {
                    _initializeSPIPinsCommand.InitializeSPIPins();
                }

                _usbControlTransferCommand.UsbControlTransfer(
                    (byte)UsbRequestType.TypeVendor,
                    (byte)deviceCommand,
                    (ushort)(setupData & (uint)BasicMasks.SixteenBits),
                    (ushort)((setupData & 0xFF0000) / 0x10000),
                    null,
                    0);
            }
        }
예제 #2
0
        public ushort ReadSPI()
        {
            using (_lockFactory.GetLock(LockType.CommandLock))
            {
                if (!_evalBoard.DeviceState.SPI_Initialized)
                {
                    _initializeSPIPinsCommand.InitializeSPIPins();
                }

                const ushort len = 3;
                var          buf = new byte[len];

                _usbControlTransferCommand.UsbControlTransfer(
                    (byte)UsbRequestType.TypeVendor | (byte)UsbCtrlFlags.Direction_In,
                    (byte)DeviceCommand.SendSPI,
                    0,
                    0,
                    buf,
                    len
                    );
                return((ushort)(buf[0] | (buf[1] << 8)));
            }
        }