Beispiel #1
0
        protected override bool _Start()
        {
            USBIFSTATUS sTATUS = USBIF.SendCommand(0x07, new uint[] { 0u, (uint)RX_BUF_SIZE, 0 }, 3);

            if (sTATUS != USBIFSTATUS.E_OK)
            {
                throw new IOException(sTATUS.ToString());
            }
            if (!USBIF.Reset())
            {
                throw new IOException("can't reset device");
            }

            var result = btc_SetStartDMA();

            return(true);
        }
Beispiel #2
0
        /*状態*/



        /*機能*/


        /* -------------------- */


        protected override bool _Reset()
        {
            if (Status == StatusEnum.Close)
            {
                USBIF = USBinterfaceExtensions200C.CreateUSB();

                if (!USBIF.Open())
                {
                    throw new IOException("can't open device");                             //オープン・初期化動作
                }
                if (!USBIF.isUSB3())
                {
                    System.Windows.MessageBox.Show("connected USB 2.0");                    //USB3.0の確認
                }
                if (!USBIF.Reset())
                {
                    throw new IOException("can't reset device"); //USBのリセット動作
                }
                rw.data = USBIF.CISReg;                          //<-!!!意味がないというかただの配列サイズ初期化
                ResetGain();                                     //ここでいい?

                ResetIris();

                /****/

                //サイズの初期化

                USBIFSTATUS sTATUS;
                uint        ysize = 0u;
                uint        xsize = 0u;

                sTATUS = USBIF.ReadReg(10u, ref xsize, 0u);
                Width  = (int)(sTATUS != USBIFSTATUS.E_OK ? 2256u : xsize * 2u);
                sTATUS = USBIF.ReadReg(3u, ref ysize, 0u);
                Height = (int)(sTATUS != USBIFSTATUS.E_OK ? 1178u : ysize * 2u);

                Size        = Width * Height;
                RX_BUF_SIZE = btc_GetImageSize();

                img_io2uint = new uint[RX_BUF_SIZE];
            }
            else if (Status == StatusEnum.Run)
            {
                Stop();
                if (!USBIF.Open())
                {
                    return(false);
                }
            }
            else
            {
                //初期化動作
                if (!USBIF.Open())
                {
                    return(false);
                }
            }


            return(true);
        }