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()); } }
static void stopButton_OnInterrupt(uint data1, uint data2, DateTime time) { Debug.Print(data1.ToString() + " " + data2.ToString()); led.Write(!led.Read()); state = USBClientController.GetState(); if (state != USBClientController.State.Stopped && state != USBClientController.State.Suspended) { //Write("Attempting to write a B."); if (data1 == 3) { keyboardDevice.KeyTap(USBC_Key.B); } else if (data1 == 8) { keyboardDevice.KeyTap(USBC_Key.S); } } }
static void stopButton_OnInterrupt(uint data1, uint data2, DateTime time) { Debug.Print(data1.ToString() + " " + data2.ToString()); led.Write(!led.Read()); state = USBClientController.GetState(); if (state != USBClientController.State.Stopped && state != USBClientController.State.Suspended) { //Write("Attempting to write a B."); if (data1 == 3) { keyboardDevice.KeyTap(USBC_Key.B); } else if (data1 == 8) { keyboardDevice.KeyTap(USBC_Key.S); } } }