Exemplo n.º 1
0
        public static void initATIS(string filename)
        {
            // detect Opal Kelly and Program
            dev = new okCFrontPanel();
            int  num_boards    = 0;
            bool device_opened = false;

            lock (dev)
            {
                while (device_opened == false)
                {
                    num_boards = dev.GetDeviceCount();

                    for (int i = 0; i < num_boards; i++)
                    {
                        if (dev.GetDeviceListModel(i) == okCFrontPanel.BoardModel.brdXEM6010LX150)
                        {
                            dev.OpenBySerial(dev.GetDeviceListSerial(i));
                            device_opened = true;
                        }
                    }
                }

                /*
                 * while (dev.OpenBySerial("") != okCFrontPanel.ErrorCode.NoError)
                 * {
                 *
                 * }//wait for Opal Kelly to be plugged in
                 */
                dev.LoadDefaultPLLConfiguration();
                dev.ConfigureFPGA(filename);
            }

            // Initialize the Biases
            BiasesInterface.initBiases();
        }
Exemplo n.º 2
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            #region "color definitions"
            //The 12 S1 colours
            List <System.Windows.Media.Color> colors = new List <System.Windows.Media.Color>();
            colors.Add(Color.FromRgb(0, 0, 0));
            colors.Add(Color.FromRgb(255, 0, 0));
            colors.Add(Color.FromRgb(255, 128, 0));
            colors.Add(Color.FromRgb(255, 255, 0));
            colors.Add(Color.FromRgb(128, 255, 0));
            colors.Add(Color.FromRgb(0, 255, 0));
            colors.Add(Color.FromRgb(0, 255, 128));
            colors.Add(Color.FromRgb(0, 255, 255));
            colors.Add(Color.FromRgb(0, 128, 255));
            colors.Add(Color.FromRgb(0, 0, 255));
            colors.Add(Color.FromRgb(128, 0, 255));
            colors.Add(Color.FromRgb(255, 0, 255));
            colors.Add(Color.FromRgb(128, 0, 128));
            BitmapPalette myPalette = new BitmapPalette(colors);

            //The 36 S2 colours
            List <System.Windows.Media.Color> fullcolors = new List <System.Windows.Media.Color>();
            fullcolors.Add(Color.FromRgb(0, 0, 0));
            fullcolors.Add(Color.FromRgb(255, 42, 0));
            fullcolors.Add(Color.FromRgb(255, 85, 0));
            fullcolors.Add(Color.FromRgb(255, 128, 0));
            fullcolors.Add(Color.FromRgb(255, 170, 0));
            fullcolors.Add(Color.FromRgb(255, 213, 0));
            fullcolors.Add(Color.FromRgb(255, 255, 0));
            fullcolors.Add(Color.FromRgb(212, 255, 0));
            fullcolors.Add(Color.FromRgb(170, 255, 0));
            fullcolors.Add(Color.FromRgb(128, 255, 0));
            fullcolors.Add(Color.FromRgb(85, 255, 0));
            fullcolors.Add(Color.FromRgb(42, 255, 0));
            fullcolors.Add(Color.FromRgb(0, 255, 0));
            fullcolors.Add(Color.FromRgb(0, 255, 42));
            fullcolors.Add(Color.FromRgb(0, 255, 85));
            fullcolors.Add(Color.FromRgb(0, 255, 128));
            fullcolors.Add(Color.FromRgb(0, 255, 170));
            fullcolors.Add(Color.FromRgb(0, 255, 212));
            fullcolors.Add(Color.FromRgb(0, 255, 255));
            fullcolors.Add(Color.FromRgb(0, 212, 255));
            fullcolors.Add(Color.FromRgb(0, 170, 255));
            fullcolors.Add(Color.FromRgb(0, 128, 255));
            fullcolors.Add(Color.FromRgb(0, 85, 255));
            fullcolors.Add(Color.FromRgb(0, 43, 255));
            fullcolors.Add(Color.FromRgb(0, 0, 255));
            fullcolors.Add(Color.FromRgb(42, 0, 255));
            fullcolors.Add(Color.FromRgb(85, 0, 255));
            fullcolors.Add(Color.FromRgb(128, 0, 255));
            fullcolors.Add(Color.FromRgb(170, 0, 255));
            fullcolors.Add(Color.FromRgb(212, 0, 255));
            fullcolors.Add(Color.FromRgb(255, 0, 255));
            fullcolors.Add(Color.FromRgb(255, 0, 212));
            fullcolors.Add(Color.FromRgb(255, 0, 170));
            fullcolors.Add(Color.FromRgb(128, 0, 128));
            fullcolors.Add(Color.FromRgb(128, 0, 85));
            fullcolors.Add(Color.FromRgb(128, 0, 43));
            BitmapPalette myfullPalette = new BitmapPalette(fullcolors);

            //The 3 TD "colours"
            List <System.Windows.Media.Color> colorsBW = new List <System.Windows.Media.Color>();
            colorsBW.Add(Color.FromRgb(128, 128, 128));
            colorsBW.Add(Color.FromRgb(0, 0, 0));
            colorsBW.Add(Color.FromRgb(255, 255, 255));
            BitmapPalette myBWPalette = new BitmapPalette(colorsBW);
            #endregion

            _TDbackBuffer  = new WriteableBitmap(304, 240, 96, 96, PixelFormats.Indexed8, myBWPalette);
            _APSbackBuffer = new WriteableBitmap(304, 240, 96, 96, PixelFormats.Gray8, null);

            ATISinterface.initATIS("ramtest.bit");
            BiasesInterface.initBiases();

            ATISinterface.setWire(ATISinterface.ControlSignals.Enable_AER_TD);
            ATISinterface.setWire(ATISinterface.ControlSignals.Enable_AER_APS);
            ATISinterface.resetFifos();

            /*
             * //init HMAX
             * ATIS.setHMAXThreshold(ATISinterface.HMAXlayer.S1, 150);
             * ATIS.setHMAXDecay(ATISinterface.HMAXlayer.S1, 1);
             * ATIS.setHMAXThreshold(ATISinterface.HMAXlayer.C1, 5); //actually a refractory period...
             * ATIS.setHMAXThreshold(ATISinterface.HMAXlayer.S2, 150);
             * ATIS.setHMAXDecay(ATISinterface.HMAXlayer.S2, 1);
             *
             * ATIS.programHMAXkernels(ATISinterface.HMAXlayer.S2, "S2Kernels.val");
             * //ATIS.programHMAXkernels(ATISinterface.HMAXlayer.S1, "S1Kernels.val");
             */

            ATISinterface.setWire(ATISinterface.ControlSignals.couple);

            AcquisitionThread();
        }