@classmethod
def add_event_detect(cls, channel, mode, callback=None, bouncetime=None):
    """Adds an event detection callback when the state of the gpio channels changes."""
    if channel not in cls.SETUPS:
        raise RuntimeError(
            "You did not setup the channel '{}' before activating event detection"
            .format(channel))
    cls.MODES[channel] = mode
    if not callback:
        return
    if channel in cls.CALLBACKS:
        raise RuntimeError('You already added a callback to this channel')
    cls.CALLBACKS[channel].append((callback, mode))
