Пример #1
0
        private void InitLibAndHandle()
        {
            FtResult result;

            if (_handle != IntPtr.Zero)
            {
                return;
            }


            LibMpsse.Init();
            result = LibMpsseSpi.SPI_OpenChannel(_spiConfig.ChannelIndex, out _handle);

            CheckResult(result);

            if (_handle == IntPtr.Zero)
            {
                throw new SpiChannelNotConnectedException(FtResult.InvalidHandle);
            }

            result = LibMpsseSpi.SPI_InitChannel(_handle, ref _cfg);

            CheckResult(result);

            _currentGlobalConfig = _cfg;
        }
Пример #2
0
 private void EnforceRightConfiguration()
 {
     if (_currentGlobalConfig.configOptions != _cfg.configOptions)
     {
         LibMpsseSpi.SPI_ChangeCS(_handle, _cfg.configOptions);
         _currentGlobalConfig = _cfg;
     }
 }
Пример #3
0
 protected FtResult Read(byte[] buffer, int sizeToTransfer, out int sizeTransfered, FtSpiTransferOptions options)
 {
     EnforceRightConfiguration();
     return(LibMpsseSpi.SPI_Read(_handle, buffer, sizeToTransfer, out sizeTransfered, options));
 }