@classmethod
def add_event_callback(cls, channel, callback):
    """Adds an event detection callback when the state of the gpio channels changes."""
    if channel not in cls.MODES:
        raise RuntimeError('You have to enable the event detection first')
    mode = cls.MODES[channel]
    cls.CALLBACKS[channel].append((callback, mode))
