Beispiel #1
0
        public void AcquirePin(GpioEnum pin)
        {
            lock (m_Pins)
            {
                if (m_Pins.ContainsKey(pin))
                {
                    throw new UnauthorizedAccessException();
                }

                var gpioPin = m_GpioController.OpenPin(pin);
                gpioPin.SetDriveMode(GpioPinDriveModeEnum.Output);
                m_Pins[pin] = new SoftPwmPin(gpioPin);
            }
        }
Beispiel #2
0
        void IPwmControllerProvider.AcquirePin(int pin)
        {
            if ((pin < 0) || (pin > (pinCount - 1)))
            {
                throw new ArgumentOutOfRangeException("pin");
            }

            lock (pins)
            {
                if (pins.ContainsKey(pin))
                {
                    throw new UnauthorizedAccessException();
                }
                var gpioPin = gpioController.OpenPin(pin);
                gpioPin.SetDriveMode(GpioPinDriveMode.Output);
                pins[pin] = new SoftPwmPin(gpioPin);
            }
        }
Beispiel #3
0
        public void AcquirePin(int pin)
        {
            if ((pin < 0) || (pin > (pinCount - 1))) throw new ArgumentOutOfRangeException("pin");

            lock (pins)
            {
                if (pins.ContainsKey(pin)) { throw new UnauthorizedAccessException(); }
                var gpioPin = gpioController.OpenPin(pin);
                gpioPin.SetDriveMode(GpioPinDriveMode.Output);
                pins[pin] = new SoftPwmPin(gpioPin);
            }
        }