Index: __init__.py ================================================================== --- __init__.py +++ __init__.py @@ -218,10 +218,13 @@ if len(self.__register_map) != 53: raise ValueError('Inconsistent register map!') return None + def __del__(self): + self.__spi.close() + def __debug(self, message): print("DEBUG: " + message) return None def __reset_device(self): @@ -385,10 +388,13 @@ # Return the filled in structure return result def configure(self, config): self.__config = config + + if config is None: + return None self.__spi.max_speed_hz = self.__config.get('frequency', 4000000) return None