protected GPIOPin(PinDirection direction, PhysicalPin pin) { Pin = pin; Direction = direction; ExportPin(); }
public GPIOPin RemapPin(PinDirection direction, PhysicalPin pin) { if (UsedPins.ContainsKey((uint)pin)) { if (direction == UsedPins[(uint) pin].Direction) return UsedPins[(uint) pin]; UsedPins[(uint)pin].Dispose(); UsedPins.Remove((uint) pin); } return CreatePin(direction, pin); }
public GPIOPin CreatePin(PinDirection direction, PhysicalPin pin) { if (UsedPins.ContainsKey((uint)pin)) { if (direction == UsedPins[(uint) pin].Direction) return UsedPins[(uint) pin]; throw new Exception("Pin already in use. Use RemapPin() to remap the pin."); } GPIOPin returnPin; if (direction == PinDirection.In) { returnPin = new GPIOInputPin(pin); } else { returnPin = new GPIOOutputPin(pin); } UsedPins.Add((uint)returnPin.Pin, returnPin); return returnPin; }
public GPIOInputPin(PhysicalPin pin) : base(PinDirection.In, pin) { }
public GPIOOutputPin CreateOutputPin(PhysicalPin pin) { return (GPIOOutputPin)CreatePin(PinDirection.Out, pin); }
public GPIOInputPin CreateInputPin(PhysicalPin pin) { return (GPIOInputPin) CreatePin(PinDirection.In, pin); }
public GPIOOutputPin(PhysicalPin pin) : base(PinDirection.Out, pin) { }