当前位置: 首页>>代码示例>>C#>>正文


C# InterruptPort.Read方法代码示例

本文整理汇总了C#中Microsoft.SPOT.Hardware.InterruptPort.Read方法的典型用法代码示例。如果您正苦于以下问题:C# InterruptPort.Read方法的具体用法?C# InterruptPort.Read怎么用?C# InterruptPort.Read使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Microsoft.SPOT.Hardware.InterruptPort的用法示例。


在下文中一共展示了InterruptPort.Read方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DigitalInputPin

        public DigitalInputPin (Cpu.Pin pin, bool glitchFilter = false)
		{
            port = new InterruptPort (pin, glitchFilter, HWPort.ResistorMode.Disabled, HWPort.InterruptMode.InterruptEdgeBoth);

            var initialValue = port.Read () ? 1 : 0;
            
            Output = AddPort ("Output", Units.Digital, initialValue);

            port.OnInterrupt += port_OnInterrupt;
		}
开发者ID:Roddoric,项目名称:Monkey.Robotics,代码行数:10,代码来源:DigitalInputPin.cs

示例2: RotaryEncoder

        public RotaryEncoder(Cpu.Pin aQuad, Cpu.Pin bQuad, Cpu.Pin momentaryPushbutton)
        {
            //Keyboard kb = Keyboard.Instance;
            //kb.Clear();
            Keyboard2.Clear();
            _aQuad = new InterruptPort(aQuad, true, Port.ResistorMode.PullUp, Port.InterruptMode.InterruptEdgeBoth);
            _bQuad = new InterruptPort(bQuad, true, Port.ResistorMode.PullUp, Port.InterruptMode.InterruptEdgeBoth);
            _momentaryPushbutton = new InterruptPort(momentaryPushbutton, true, Port.ResistorMode.PullUp, Port.InterruptMode.InterruptEdgeBoth);

            if (_momentaryPushbutton.Read() == false)
            {
                using (var rtc = new RTC())
                {
                    rtc.ClearCalibration();
                }
            }

            _distanceTraveled = 0;
            _currentDirection = Direction.RotateLeft;
            _sequencePos = 1;
            _ready = true;

            try
            {
                _momentaryPushbutton.OnInterrupt += MomentaryPushbuttonOnInterrupt;
                //_momentaryPushbutton.EnableInterrupt();

                _aQuad.OnInterrupt += AQuadOnInterrupt;
                //_aQuad.EnableInterrupt();
                _bQuad.OnInterrupt += BQuadOnInterrupt;
                //_bQuad.EnableInterrupt();
            }
            catch
            {
                DebugHelper.Print("Button Interrupt Init Failed");
            }
        }
开发者ID:karlvonkries,项目名称:sc-firmwareapp,代码行数:37,代码来源:RotaryEncoder.cs

示例3: Axis

        public Axis(string axisID, Cpu.Pin stepPin, Cpu.Pin directionPin, Cpu.Pin limitSwitchPin, bool invertDirectionPinOutput = false)
        {
            this.ID = axisID;
            StepPort = new OutputPort(stepPin, false);
            DirectionPort = new OutputPort(directionPin, false);
            LimitReached = LimitSwitch.None;

            if (limitSwitchPin != Cpu.Pin.GPIO_NONE)
            {
                LimitSwitchPort = new InterruptPort(limitSwitchPin, false, Port.ResistorMode.PullUp, Port.InterruptMode.InterruptEdgeLevelLow);
                LimitSwitchPort.OnInterrupt += new NativeEventHandler(LimitSwitchPin_OnInterrupt);

                // Since we're sharing a port for the Min/Max limit switches on each axis, we can only determine which switch is tripped
                // while there is motion (based on direction). If we initialize the axis and find that the switch is tripped, then we don't
                // know which end it is at and the user will need to move the axis off of the switch before the machine can be homed.
                if (LimitSwitchPort.Read() == false) LimitReached = LimitSwitch.Unknown;
            }

            InvertDirectionPinOutput = invertDirectionPinOutput;

            Location = 0;
            LocationUnitsPerStep = 4;       //Should be overwritten when machine sets the resolution
            StepDirection = true;
        }
开发者ID:gflerm,项目名称:DazCAM,代码行数:24,代码来源:Axis.cs


注:本文中的Microsoft.SPOT.Hardware.InterruptPort.Read方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。