'Register edge callback.'

def register_callback(self, i2c_hat, channel, callback):

    if hasattr(i2c_hat, self._DIGITAL_INPUTS):
        digital_inputs = getattr(i2c_hat, self._DIGITAL_INPUTS)
        callbacks = getattr(digital_inputs, self._CALLBACKS)
        callbacks[channel] = callback
        setattr(digital_inputs, self._CALLBACKS, callbacks)
