Exemplo n.º 1
0
        protected override bool _CaptureStart(int num)
        {
            capnum  = num;
            captime = DateTime.Now;

            uint[] array = new uint[] { 1u, (uint)RX_BUF_SIZE, (uint)num };

            USBIFSTATUS sTATUS = USBIF.SendCommand(7u, array, array.Length);

            if (sTATUS != USBIFSTATUS.E_OK)
            {
                throw new IOException(sTATUS.ToString());
            }

            if (!USBIF.Reset())
            {
                throw new IOException("can't reset device");
            }

            USBIF.WriteReg(0x8000, 1u, 0u); //0x8000 = 32768u
            while ((array[0] & 1u) != 0u)
            {
                USBIF.ReadReg(0x8000, ref array[0], 0u); //0x8000 = 32768u
                Thread.Sleep(100);
            }

            return(true);
        }
Exemplo n.º 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);
        }