示例#1
0
            /// <summary>
            /// Constructs a ButtonPad that handles the emulated hardware's
            /// button interrupts.
            /// </summary>
            /// <param name="sink"></param>
            /// <param name="button"></param>
            /// <param name="pin"></param>
            public ButtonPad(GPIOButtonInputProvider sink, Button button,
                             Cpu.Pin pin)
            {
                this.sink         = sink;
                this.button       = button;
                this.buttonDevice = InputManager.CurrentInputManager.ButtonDevice;

                if (pin != Cpu.Pin.GPIO_NONE)
                {
                    // When this GPIO pin is true, call the Interrupt method.
                    port = new InterruptPort(pin, true,
                                             Port.ResistorMode.PullUp,
                                             Port.InterruptMode.InterruptEdgeBoth);
                    port.OnInterrupt += new NativeEventHandler(this.Interrupt);
                }
            }
示例#2
0
        public static void Main()
        {
            myApplication = new MyClock();

            NetworkInterface[] nis = NetworkInterface.GetAllNetworkInterfaces();

            for (int i = 0; i < nis.Length; i++)
            {
                NetworkInterface networkInterface = nis[i];

                if (networkInterface.NetworkInterfaceType == NetworkInterfaceType.Ethernet)
                {
                    string m_macAddress = networkInterface.PhysicalAddress[0].ToString();
                    for (int j = 1; j < networkInterface.PhysicalAddress.Length; ++j)
                    {
                        m_macAddress += "-" + networkInterface.PhysicalAddress[j].ToString();
                    }

                    string[] m_staticDnsAddresses = new string[] { "0.0.0.0", "0.0.0.0" };
                    for (int k = 0; k < networkInterface.DnsAddresses.Length; ++k)
                    {
                        m_staticDnsAddresses[k] = networkInterface.DnsAddresses[k];
                    }

                    str = networkInterface.IPAddress;
                    break;
                }
            }

            Microsoft.SPOT.Touch.Touch.Initialize(myApplication);

            Window mainWindow = myApplication.CreateWindow();

            // Create the object that configures the GPIO pins to buttons.
            GPIOButtonInputProvider inputProvider =
                new GPIOButtonInputProvider(null);

            // Start the application
            myApplication.Run(mainWindow);
        }
示例#3
0
        public static void Main()
        {
            myApplication = new MyClock();            

            NetworkInterface[] nis = NetworkInterface.GetAllNetworkInterfaces();

            for (int i = 0; i < nis.Length; i++)
            {
                NetworkInterface networkInterface = nis[i];

                if (networkInterface.NetworkInterfaceType == NetworkInterfaceType.Ethernet)
                {
                    string m_macAddress = networkInterface.PhysicalAddress[0].ToString();
                    for (int j = 1; j < networkInterface.PhysicalAddress.Length; ++j)
                    {
                        m_macAddress += "-" + networkInterface.PhysicalAddress[j].ToString();
                    }

                    string[] m_staticDnsAddresses = new string[] { "0.0.0.0", "0.0.0.0" };
                    for (int k = 0; k < networkInterface.DnsAddresses.Length; ++k)
                    {
                        m_staticDnsAddresses[k] = networkInterface.DnsAddresses[k];
                    }

                    str = networkInterface.IPAddress;
                    break;
                }
            }

            Microsoft.SPOT.Touch.Touch.Initialize(myApplication);

            Window mainWindow = myApplication.CreateWindow();

            // Create the object that configures the GPIO pins to buttons.
            GPIOButtonInputProvider inputProvider =
                new GPIOButtonInputProvider(null);

            // Start the application
            myApplication.Run(mainWindow);
        }
            /// <summary>
            /// Constructs a ButtonPad that handles the emulated hardware's 
            /// button interrupts.
            /// </summary>
            /// <param name="sink"></param>
            /// <param name="button"></param>
            /// <param name="pin"></param>
            public ButtonPad(GPIOButtonInputProvider sink, Button button, 
                Cpu.Pin pin)
            {
                this.sink = sink;
                this.button = button;
                this.buttonDevice = InputManager.CurrentInputManager.ButtonDevice;

                if (pin != Cpu.Pin.GPIO_NONE)
                {
                    // When this GPIO pin is true, call the Interrupt method.
                    port = new InterruptPort(pin, true,
                        Port.ResistorMode.PullUp,
                        Port.InterruptMode.InterruptEdgeBoth);
                    port.OnInterrupt += new NativeEventHandler(this.Interrupt);
                }
            }