public bool OnEvent(BaseEvent ev)
        {
            var     pinEvent = (GpioPinEvent)ev;
            GpioPin pin      = null;

            lock (_pinMap)
            {
                pin = FindGpioPin(pinEvent.PinNumber);
            }

            // Avoid calling this under a lock to prevent a potential lock inversion.
            if (pin != null)
            {
                pin.OnPinChangedInternal(pinEvent.EventType);
            }

            return(true);
        }