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); } }
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); } }
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); } }