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


C# PinState类代码示例

本文整理汇总了C#中PinState的典型用法代码示例。如果您正苦于以下问题:C# PinState类的具体用法?C# PinState怎么用?C# PinState使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: Relay

 public Relay(IDigitalWriteRead _digitalWriteRead, int gpioPin)
 {
     this._gpioPin           = gpioPin;
     this._digitalWriteRead  = _digitalWriteRead;
     this._state             = PinState.Unknown;
     this.TurnOff();
 }
开发者ID:Tommy00,项目名称:Nusbio.Samples,代码行数:7,代码来源:Relay.cs

示例2: Initialize

		/// <summary>
		/// Initialize this instance with standard settings. 
		/// 9600:N:8:1, handshaking disabled.
		/// </summary>
		/// <param name="index">The port index - 1,2,...</param>
		public void Initialize(int index)
		{
			portName   = "COM" + index.ToString() + ":";
			baudRate   = LineSpeed.Baud_9600;
			txFlowCTS  = false;
			txFlowDSR  = false;
			dtrControl = PinState.Disable;
			rxDSRsense = false;
			txContinue = true;
			txFlowXoff = false;
			rxFlowXoff = false;
			errReplace = false;
			nulDiscard = false;
			rtsControl = PinState.Disable;
			abortOnErr = false;
			xonLimit   = 0;	// 0=OS managed
			xoffLimit  = 0; // 0=OS managed
			dataBits   = ByteSize.Eight;
			parity     = Parity.None;
			stopBits   = StopBits.One;
			xonChar    = (byte) CtrlChar.DC1;
			xoffChar   = (byte) CtrlChar.DC3;
			errChar    = (byte) '?';
			eofChar    = (byte) CtrlChar.SUB;
			evtChar    = (byte) CtrlChar.NULL;
			handshake  = Handshake.None;
			rxQueLen   = 0; // 0=OS managed
			txQueLen   = 0; // 0=OS managed
			txTmoMulti = 0;
			txTmoConst = 0;
			receiveMode = false;
			return;
		}
开发者ID:hydrayu,项目名称:imobile-src,代码行数:38,代码来源:SerialConfig.cs

示例3: Arduino_DigitalPinUpdated

        private void Arduino_DigitalPinUpdated(byte pin, PinState pinValue)
        {
            //Debug.WriteLine("IOConnector.Arduino_DigitalPinUpdated");
            arduinoAlive = true;

            MachineStates state = MachineStates.UNDEFINED;
            switch (pin)
            {
                case STARTUP_PIN:
                    state = MachineStates.STARTUP;
                    break;
                case MANUAL_PIN:
                    state = MachineStates.MANUAL;
                    break;
                case LATCH_PIN:
                    state = MachineStates.LATCH;
                    break;
                case SPLIT_PIN:
                    state = MachineStates.SPLIT;
                    break;
            }
            
            if (pinValue == PinState.HIGH)
                machine.updateState(state, false);
            else
                machine.updateState(state, true);
        }
开发者ID:s114898,项目名称:TSS_program,代码行数:27,代码来源:IOConnector.cs

示例4: setup

        private void setup()
        {
            //Set the initial state of the led.
            ledState = PinState.LOW;

            //Set the pin mode of the led.
            arduino.pinMode(LED_PIN, PinMode.OUTPUT);

            //Set the timer to schedule blink() every one second.
            blinkTimer = new DispatcherTimer();
            blinkTimer.Interval = TimeSpan.FromMilliseconds(1000);
            blinkTimer.Tick += blink;
            blinkTimer.Start();
        }
开发者ID:DFRobot,项目名称:DFRobotWindowsIoTTempelate,代码行数:14,代码来源:MainPage.xaml.cs

示例5: MainPage

        public MainPage()
        {
            this.InitializeComponent();

            arduino = App.Arduino;
            App.Telemetry.TrackEvent( "RemoteBlinky_Windows10_SuccessfullyConnected" );

            App.Arduino.DeviceConnectionLost += Arduino_OnDeviceConnectionLost;

            currentState = PinState.LOW;
            OnButton.IsEnabled = true;
            OffButton.IsEnabled = true;
            BlinkButton.IsEnabled = true;
        }
开发者ID:Robotmad,项目名称:windows-remote-arduino-samples,代码行数:14,代码来源:MainPage.xaml.cs

示例6: blink

 private void blink(object sender, object e)
 {
     if (ledState == PinState.HIGH)  //LED state is HIGH.
     {
         //Turn off the LED.
         arduino.digitalWrite(LED_PIN, PinState.LOW);
         //Show the message in the Output dialog.
         Debug.WriteLine("OFF");
         //Set local LED state to Low.
         ledState = PinState.LOW;
     }
     else    //LED state is LOW.
     {
         //Turn on the LED.
         arduino.digitalWrite(LED_PIN, PinState.HIGH);
         //Show the message in the Output dialog.
         Debug.WriteLine("ON");
         //Set local LED state to Low.
         ledState = PinState.HIGH;
     }
 }
开发者ID:DFRobot,项目名称:DFRobotWindowsIoTTempelate,代码行数:21,代码来源:MainPage.xaml.cs

示例7: SetHeatingPin

 static void SetHeatingPin(PinState state)
 {
     GPIOMem heatingPin = new GPIOMem(GPIOPins.GPIO_14);
     heatingPin.PinDirection = GPIODirection.Out;
     heatingPin.Write(state);
 }
开发者ID:jrnijboer,项目名称:ThermAtHome,代码行数:6,代码来源:Program.cs

示例8: SetupOverlappedMultiple

        // Sets up an Overlapped object with with multiple buffers pinned.
        unsafe private void SetupOverlappedMultiple()
        {
            ArraySegment<byte>[] tempList = new ArraySegment<byte>[_bufferList.Count];
            _bufferList.CopyTo(tempList, 0);

            // Number of things to pin is number of buffers.
            // Ensure we have properly sized object array.
            if (_objectsToPin == null || (_objectsToPin.Length != tempList.Length))
            {
                _objectsToPin = new object[tempList.Length];
            }

            // Fill in object array.
            for (int i = 0; i < (tempList.Length); i++)
            {
                _objectsToPin[i] = tempList[i].Array;
            }

            if (_wsaBufferArray == null || _wsaBufferArray.Length != tempList.Length)
            {
                _wsaBufferArray = new WSABuffer[tempList.Length];
            }

            // Pin buffers and fill in WSABuffer descriptor pointers and lengths.
            _preAllocatedOverlapped = new PreAllocatedOverlapped(CompletionPortCallback, this, _objectsToPin);
            if (GlobalLog.IsEnabled)
            {
                GlobalLog.Print(
                    "SocketAsyncEventArgs#" + LoggingHash.HashString(this) + "::SetupOverlappedMultiple: new PreAllocatedOverlapped." +
                    LoggingHash.HashString(_preAllocatedOverlapped));
            }

            for (int i = 0; i < tempList.Length; i++)
            {
                ArraySegment<byte> localCopy = tempList[i];
                RangeValidationHelpers.ValidateSegment(localCopy);
                _wsaBufferArray[i].Pointer = Marshal.UnsafeAddrOfPinnedArrayElement(localCopy.Array, localCopy.Offset);
                _wsaBufferArray[i].Length = localCopy.Count;
            }
            _pinState = PinState.MultipleBuffer;
        }
开发者ID:er0dr1guez,项目名称:corefx,代码行数:42,代码来源:SocketAsyncEventArgs.Windows.cs

示例9: FreeOverlapped

        // Cleans up any existing Overlapped object and related state variables.
        private void FreeOverlapped(bool checkForShutdown)
        {
            if (!checkForShutdown || !Environment.HasShutdownStarted)
            {
                // Free the overlapped object.
                if (_ptrNativeOverlapped != null && !_ptrNativeOverlapped.IsInvalid)
                {
                    _ptrNativeOverlapped.Dispose();
                    _ptrNativeOverlapped = null;
                }

                // Free the preallocated overlapped object. This in turn will unpin
                // any pinned buffers.
                if (_preAllocatedOverlapped != null)
                {
                    _preAllocatedOverlapped.Dispose();
                    _preAllocatedOverlapped = null;

                    _pinState = PinState.None;
                    _pinnedAcceptBuffer = null;
                    _pinnedSingleBuffer = null;
                    _pinnedSingleBufferOffset = 0;
                    _pinnedSingleBufferCount = 0;
                }

                // Free any allocated GCHandles.
                if (_socketAddressGCHandle.IsAllocated)
                {
                    _socketAddressGCHandle.Free();
                    _pinnedSocketAddress = null;
                }

                if (_wsaMessageBufferGCHandle.IsAllocated)
                {
                    _wsaMessageBufferGCHandle.Free();
                    _ptrWSAMessageBuffer = IntPtr.Zero;
                }

                if (_wsaRecvMsgWSABufferArrayGCHandle.IsAllocated)
                {
                    _wsaRecvMsgWSABufferArrayGCHandle.Free();
                    _ptrWSARecvMsgWSABufferArray = IntPtr.Zero;
                }

                if (_controlBufferGCHandle.IsAllocated)
                {
                    _controlBufferGCHandle.Free();
                    _ptrControlBuffer = IntPtr.Zero;
                }
            }
        }
开发者ID:er0dr1guez,项目名称:corefx,代码行数:52,代码来源:SocketAsyncEventArgs.Windows.cs

示例10: GpioFile

		/// <summary>
		/// Initializes a new instance of the <see cref="CyrusBuilt.MonoPi.IO.GpioFile"/>
		/// class with the Rev1 pin to access, the I/O direction, and the initial value.
		/// </summary>
		/// <param name="pin">
		/// The pin on the board to access.
		/// </param>
		/// <param name="mode">
		/// The I/0 mode of the pin.
		/// </param>
		/// <param name="initialValue">
		/// The pin's initial value.
		/// </param>
		public GpioFile(GpioPins pin, PinMode mode, PinState initialValue)
			: base(pin, mode, initialValue) {
		}
开发者ID:cyrusbuilt,项目名称:MonoPi,代码行数:16,代码来源:GpioFile.cs

示例11: Write

		/// <summary>
		/// Writes the specified value to the specified GPIO pin.
		/// </summary>
		/// <param name="pin">
		/// The pin to write the value to.
		/// </param>
		/// <param name="value">
		/// The value to write to the pin.
		/// </param>
		public static void Write(GpioPins pin, PinState value) {
			String num = GetGpioPinNumber(pin);
			String name = Enum.GetName(typeof(GpioPins), pin);
			internal_Write((Int32)pin, value, num, name);
		}
开发者ID:cyrusbuilt,项目名称:MonoPi,代码行数:14,代码来源:GpioFile.cs

示例12: Write

 /// <summary>
 /// Write a value to the pin
 /// </summary>
 /// <param name="value">The value to write to the pin</param>
 public void Write(PinState value)
 {
     Write(value == PinState.High);
 }
开发者ID:JohnRuddy,项目名称:RaspberryPi.Net,代码行数:8,代码来源:GPIOFile.cs

示例13: SetupOverlappedMultiple

 private void SetupOverlappedMultiple()
 {
     this.m_Overlapped = new Overlapped();
     ArraySegment<byte>[] array = new ArraySegment<byte>[this.m_BufferList.Count];
     this.m_BufferList.CopyTo(array, 0);
     if ((this.m_ObjectsToPin == null) || (this.m_ObjectsToPin.Length != array.Length))
     {
         this.m_ObjectsToPin = new object[array.Length];
     }
     for (int i = 0; i < array.Length; i++)
     {
         this.m_ObjectsToPin[i] = array[i].Array;
     }
     if ((this.m_WSABufferArray == null) || (this.m_WSABufferArray.Length != array.Length))
     {
         this.m_WSABufferArray = new WSABuffer[array.Length];
     }
     this.m_PtrNativeOverlapped = new SafeNativeOverlapped(this.m_Overlapped.UnsafePack(new IOCompletionCallback(this.CompletionPortCallback), this.m_ObjectsToPin));
     for (int j = 0; j < array.Length; j++)
     {
         ArraySegment<byte> segment = array[j];
         ValidationHelper.ValidateSegment(segment);
         this.m_WSABufferArray[j].Pointer = Marshal.UnsafeAddrOfPinnedArrayElement(segment.Array, segment.Offset);
         this.m_WSABufferArray[j].Length = segment.Count;
     }
     this.m_PinState = PinState.MultipleBuffer;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:27,代码来源:SocketAsyncEventArgs.cs

示例14: FreeOverlapped

 private void FreeOverlapped(bool checkForShutdown)
 {
     if (!checkForShutdown || !NclUtilities.HasShutdownStarted)
     {
         if ((this.m_PtrNativeOverlapped != null) && !this.m_PtrNativeOverlapped.IsInvalid)
         {
             this.m_PtrNativeOverlapped.Dispose();
             this.m_PtrNativeOverlapped = null;
             this.m_Overlapped = null;
             this.m_PinState = PinState.None;
             this.m_PinnedAcceptBuffer = null;
             this.m_PinnedSingleBuffer = null;
             this.m_PinnedSingleBufferOffset = 0;
             this.m_PinnedSingleBufferCount = 0;
         }
         if (this.m_SocketAddressGCHandle.IsAllocated)
         {
             this.m_SocketAddressGCHandle.Free();
         }
         if (this.m_WSAMessageBufferGCHandle.IsAllocated)
         {
             this.m_WSAMessageBufferGCHandle.Free();
         }
         if (this.m_WSARecvMsgWSABufferArrayGCHandle.IsAllocated)
         {
             this.m_WSARecvMsgWSABufferArrayGCHandle.Free();
         }
         if (this.m_ControlBufferGCHandle.IsAllocated)
         {
             this.m_ControlBufferGCHandle.Free();
         }
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:33,代码来源:SocketAsyncEventArgs.cs

示例15: Arduino_OnDigitalPinUpdated

 /// <summary>
 /// This function is called when the Windows Remote Arduino library reports that an input value has changed for a digital pin.
 /// </summary>
 /// <param name="pin">The pin whose value has changed</param>
 /// <param name="state">the new state of the pin, either HIGH or LOW</param>
 private void Arduino_OnDigitalPinUpdated( byte pin, PinState state )
 {
     //we must dispatch the change to the UI thread to change the indicator image
     var action = Dispatcher.RunAsync( Windows.UI.Core.CoreDispatcherPriority.Normal, new Windows.UI.Core.DispatchedHandler( () =>
     {
         UpdateDigitalPinIndicators( pin );
     } ) );
 }
开发者ID:turkycat,项目名称:remote-wiring-experience,代码行数:13,代码来源:MainPage.xaml.cs


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