Example #1
0
 /// <summary>
 /// Sets the pin direction.
 /// </summary>
 /// <param name="pinNumber">Pin number.</param>
 /// <param name="direction">Pin Direction.</param>
 public override void SetPinDirection(int pinNumber, GpioPinDirection direction)
 {
     this.SendPackage(
         "Failed to send package to remote when setting pin direction. Number of bytes get sent:{0}",
         (byte)Command.SetPinDirection,
         (byte)this.GetTargetPinNumber(pinNumber),
         (byte)direction);
 }
Example #2
0
        internal GpioPin(RaspberryPi parentPi, int index, GpioPinDirection direction)
        {
            _parentPi = parentPi;
            Index     = index;
            Direction = direction;

            SetupPin();
        }
Example #3
0
        public GpioPin GetPin(int index, GpioPinDirection direction)
        {
            if (_pins.ContainsKey(index))
            {
                var pin = _pins[index];
                if (pin.Direction != direction)
                {
                    throw new InvalidOperationException("Pin " + index.ToString() +
                                                        " is already configured for a different direction");
                }

                return(pin);
            }

            _pins[index] = new GpioPin(this, index, direction);
            return(_pins[index]);
        }
Example #4
0
 /// <summary>
 /// Sets the pin direction.
 /// </summary>
 /// <param name="pinNumber">Pin number.</param>
 /// <param name="direction">Pin Direction.</param>
 public override void SetPinDirection(int pinNumber, GpioPinDirection direction)
 {
     pinMode(this.GetTargetPinNumber(pinNumber), (int)direction);
 }
Example #5
0
 /// <summary>
 /// Sets the pin direction.
 /// </summary>
 /// <param name="pinNumber">Pin number.</param>
 /// <param name="direction">Pin Direction.</param>
 public abstract void SetPinDirection(int pinNumber, GpioPinDirection direction);
Example #6
0
 /// <summary>
 /// Sets the pin direction.
 /// </summary>
 /// <param name="pinNumber">Pin number.</param>
 /// <param name="direction">Pin Direction.</param>
 public void SetPinDirection(int pinNumber, GpioPinDirection direction)
 {
     this.implementation.SetPinDirection(pinNumber, direction);
 }