小编Mic*_*ack的帖子

如何在微框架中实现中断?

我无法stm32f4discovery使用VS2010在.NET中编译代码.

运用 NETMF 4.2

    using System;
    using System.Threading;
    using Microsoft.SPOT;
    using Microsoft.SPOT.Hardware;

    namespace MFConsoleApplication1
    {

        public class Program
        {
            private static InterruptPort interruptPort;

            public static void Main()
            {
                interruptPort =  new InterruptPort(Cpu.Pin.GPIO_Pin2,
                                               false,
                                               Port.ResistorMode.PullUp,
                                               rt.InterruptMode.InterruptEdgeLevelLow);

                interruptPort.OnInterrupt += new NativeEventHandler(port_OnInterrupt);


                 Thread.Sleep(Timeout.Infinite);
            }


             private static void port_OnInterrupt(uint port, uint state, TimeSpan time)
             {
                Debug.Print("Pin=" + port + " State=" + state + " Time=" + time);
                interruptPort.ClearInterrupt();
             }
         }
    } 
Run Code Online (Sandbox Code Playgroud)

在编译时,我收到以下错误: No overload for 'port_OnInterrupt' matches delegate 'Microsoft.SPOT.Hardware.NativeEventHandler'

我怎么能编译代码?

我从"Expert …

c# .net-micro-framework

2
推荐指数
1
解决办法
1402
查看次数

标签 统计

.net-micro-framework ×1

c# ×1