Ejemplo n.º 1
0
        public static int DevGndPins(Shouter shouter)
        {
            var  onScreen = "n/f = increase pinnumber by 1/10; p/b = decrease pinnumber by 1/10; q = quit!";
            byte p        = 0;
            var  quit     = false;

            while (!quit)
            {
                var tr  = new PinTranslator(40, 40, 0);
                var zif = new ZIFSocket(40);
                zif.SetAll(true);
                using (var td = TopDevice.Create(shouter))
                {
                    td.SetVccLevel(0x2D);
                    td.ApplyGnd(tr.ToZIF, new Pin {
                        Number = 40
                    });
                    td.ApplyVcc(tr.ToZIF, new Pin {
                        Number = 20
                    });
                    td.PullUpsEnable(true);
                    td.WriteZIF(zif, "");
                    Console.WriteLine(onScreen);
                    switch (Console.ReadKey().Key)
                    {
                    case ConsoleKey.N:
                        p++;
                        break;

                    case ConsoleKey.F:
                        p += 10;
                        break;

                    case ConsoleKey.P:
                        p--;
                        break;

                    case ConsoleKey.B:
                        p -= 10;
                        break;

                    case ConsoleKey.Q:
                        quit = true;
                        break;

                    default:
                        Console.WriteLine(onScreen);
                        break;
                    }
                }
            }
            return(0);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// For dev.
        /// </summary>
        /// <param name="shouter">The shouter instance.</param>
        /// <returns>Exit code. 0 is fine; all other is bad.</returns>
        public static int Dev(IShouter shouter)
        {
            //var fpgaFile = new FPGAProgram(@"C:\Top\Topwin6\Blib2\ictest.bit");
            //Console.WriteLine(fpgaFile);
            {
                var tr  = new PinTranslator(40, 40, 0);
                var zif = new ZIFSocket(40);
                zif.SetAll(true);
                using (var td = TopDevice.Create(shouter))
                {
                    td.SetVccLevel(5.0);
                    td.SetVppLevel(13.0);
                    td.ApplyGnd(tr.ToZIF, new Pin {
                        Number = 10
                    });
                    td.ApplyVcc(tr.ToZIF, new Pin {
                        Number = 40
                    });
                    td.PullUpsEnable(true);
                    td.WriteZIF(zif, "");
                    Console.ReadLine();
                }
            }

            {
                var tr  = new PinTranslator(40, 40, 0);
                var zif = new ZIFSocket(40);
                zif.SetAll(false);
                using (var td = TopDevice.Create(shouter))
                {
                    td.SetVccLevel(5.0);
                    td.SetVppLevel(21.0);
                    td.ApplyGnd(tr.ToZIF, new Pin {
                        Number = 10
                    });
                    td.ApplyVcc(tr.ToZIF, new Pin {
                        Number = 40
                    });
                    td.PullUpsEnable(true);
                    td.WriteZIF(zif, "");
                    Console.ReadLine();
                }
            }
            //Console.WriteLine("Testing {0} for Erasure }};-P", args[1]);
            //var fileData = Tools.ReadBinaryFile(args[1]).ToArray();

            //if(fileData.Any(b => b != 0xff))
            //  throw new U2PaException("No good }};-(");
            //else Console.WriteLine("File {0} filled with all nice little 0xFF's }};-P", args[1]);

            return(0);
        }