Beispiel #1
0
        public static void Main()
        {
            Debug.Print(Resources.GetString(Resources.StringResources.String1));
            Debug.Print(Resources.GetString(Resources.StringResources.String1));

            Cpu.GlitchFilterTime = TimeSpan.FromTicks(10000 * 50);

            //serialPort = USBClientController.StandardDevices.StartCDC_WithDebugging();

            //Write("Started CDC");

            state = USBClientController.GetState();

            if (state == USBClientController.State.Running)
            {
                // We're currently debugging.
                keyboardDevice = null;
            }
            else
            {
                keyboardDevice = USBClientController.StandardDevices.StartKeyboard();
            }

            var leftAnalogEngine = new AnalogIn((AnalogIn.Pin)GHIElectronics.NETMF.FEZ.FEZ_Pin.AnalogIn.An5);

            var leftEngine = new InterruptPort((Cpu.Pin)FEZ_Pin.Interrupt.Di11, false, Port.ResistorMode.PullUp, Port.InterruptMode.InterruptEdgeBoth);
            leftEngine.OnInterrupt += collector_OnInterrupt;

            var rightEngine = new InterruptPort((Cpu.Pin)FEZ_Pin.Interrupt.Di12, false, Port.ResistorMode.PullUp, Port.InterruptMode.InterruptEdgeBoth);
            rightEngine.OnInterrupt += collector_OnInterrupt;

            var stopButton = new InterruptPort((Cpu.Pin)FEZ_Pin.Interrupt.Di37, true, Port.ResistorMode.PullUp, Port.InterruptMode.InterruptEdgeLow);
            stopButton.OnInterrupt += stopButton_OnInterrupt;

            var singlePlayerButton = new InterruptPort((Cpu.Pin)FEZ_Pin.Interrupt.Di36, true, Port.ResistorMode.PullUp, Port.InterruptMode.InterruptEdgeLow);
            singlePlayerButton.OnInterrupt += stopButton_OnInterrupt;

            led = new OutputPort((Cpu.Pin)FEZ_Pin.Digital.LED, false);
            led.Write(false);

            while (true)
            {
                // We can do other work here, like updating
                // an LCD display or something.
                Thread.Sleep(5000);
                //Debug.Print(leftAnalogEngine.Read().ToString());
            }
        }
Beispiel #2
0
        private static void InitDevice()
        {
            // Check debug interface
            if (Configuration.DebugInterface.GetCurrent() == Configuration.DebugInterface.Port.USB1)
            {
                throw new InvalidOperationException("Current debug interface is USB. It must be changed to something else before proceeding. Refer to your platform user manual to change the debug interface.");
            }

            ushort myVID                = 0x1234;
            ushort myPID                = 0x0006;
            ushort myDeviceVersion      = 0x100;
            ushort myDeviceMaxPower     = 250; // in milli amps
            string companyName          = "DevDotNet.ORG";
            string productName          = "Virtual Keyboard and Mouse";
            string myDeviceSerialNumber = "12345";

            // Create the device
            device = new USBC_Device(myVID, myPID, myDeviceVersion, myDeviceMaxPower, companyName, productName, myDeviceSerialNumber);
            // Add a Keyboard
            kb = new USBC_Keyboard(device, "FEZ Domino Keyboard Interface");
            // Add a Mouse
            mouse = new USBC_Mouse(device, "FEZ Domino Mouse Interface");
            // Start CDC
            // When ready, you can start your device as follows:
            USBClientController.Start(device);
            //
            Debug.Print("Waiting to connect to PC...");
            bool isConnect = false;

            while (!isConnect)
            {
                // Check if connected to PC
                if (USBClientController.GetState() != USBClientController.State.Running)
                {
                    Debug.Print("Waiting to connect to PC...");
                }
                else
                {
                    isConnect = true;
                }
            }
        }
Beispiel #3
0
        public static void Main()
        {
            Debug.Print(Resources.GetString(Resources.StringResources.String1));

            Cpu.GlitchFilterTime = TimeSpan.FromTicks(10000 * 50);

            //serialPort = USBClientController.StandardDevices.StartCDC_WithDebugging();

            //Write("Started CDC");

            keyboardDevice = USBClientController.StandardDevices.StartKeyboard();

            var leftAnalogEngine = new AnalogIn((AnalogIn.Pin)GHIElectronics.NETMF.FEZ.FEZ_Pin.AnalogIn.An5);

            var leftEngine = new InterruptPort((Cpu.Pin)FEZ_Pin.Interrupt.Di11, false, Port.ResistorMode.PullUp, Port.InterruptMode.InterruptEdgeBoth);

            leftEngine.OnInterrupt += collector_OnInterrupt;

            var rightEngine = new InterruptPort((Cpu.Pin)FEZ_Pin.Interrupt.Di12, false, Port.ResistorMode.PullUp, Port.InterruptMode.InterruptEdgeBoth);

            rightEngine.OnInterrupt += collector_OnInterrupt;

            var stopButton = new InterruptPort((Cpu.Pin)FEZ_Pin.Interrupt.Di37, true, Port.ResistorMode.PullUp, Port.InterruptMode.InterruptEdgeLow);

            stopButton.OnInterrupt += stopButton_OnInterrupt;

            var singlePlayerButton = new InterruptPort((Cpu.Pin)FEZ_Pin.Interrupt.Di36, true, Port.ResistorMode.PullUp, Port.InterruptMode.InterruptEdgeLow);

            singlePlayerButton.OnInterrupt += stopButton_OnInterrupt;

            led = new OutputPort((Cpu.Pin)FEZ_Pin.Digital.LED, false);
            led.Write(false);

            while (true)
            {
                // We can do other work here, like updating
                // an LCD display or something.
                Thread.Sleep(5000);
                //Debug.Print(leftAnalogEngine.Read().ToString());
            }
        }