'Updates the specified config bits
Returns which bits were changed'

def set_config(self, config, mask):

    old = self.config
    self.config &= (~ mask)
    self.config |= config
    return (old ^ self.config)
