Esempio n. 1
0
        protected void AddPin(PinMeta pin, bool replace = false)
        {
            if (!IsValidPhysicalPin(pin?.PhysicalId ?? 0))
            {
                throw new InvalidOperationException($"Invalid physical pin [{pin?.PhysicalId}]");
            }

            var existingPin = this[PinIndexScheme.Physical, pin.PhysicalId];

            if (existingPin != null)
            {
                if (replace)
                {
                    _pinInfo.Remove(existingPin);
                }
                else
                {
                    throw new DuplicateNameException($"Pin {existingPin.PhysicalId} already exists");
                }
            }
            _pinInfo.Add(pin);
        }
Esempio n. 2
0
 public ButtonStateChangedArgs(PinMeta pin, ButtonEvent buttonEvent)
 {
     Pin         = pin;
     ButtonEvent = buttonEvent;
 }