cleanup on driver side

This commit is contained in:
Devaev Maxim
2020-09-09 12:52:45 +03:00
parent 04284584fe
commit 170ed92bd4
4 changed files with 49 additions and 37 deletions

View File

@@ -117,7 +117,6 @@ class _GpioOutput: # pylint: disable=too-many-instance-attributes
self.__channel = channel
self.__pin: int = config.pin
self.__inverted: bool = config.inverted
self.__initial: Optional[bool] = config.initial
self.__switch: bool = config.switch
@@ -160,13 +159,6 @@ class _GpioOutput: # pylint: disable=too-many-instance-attributes
"busy": busy,
}
def cleanup(self) -> None:
if self.__initial is not None:
try:
self.__driver.write(self.__pin, (self.__initial ^ self.__inverted))
except Exception:
get_logger().exception("Can't cleanup %s", self)
async def switch(self, state: bool) -> bool:
if not self.__switch:
raise GpioSwitchNotSupported()
@@ -278,8 +270,6 @@ class UserGpio:
])
async def cleanup(self) -> None:
for gout in self.__outputs.values():
gout.cleanup()
for driver in self.__drivers.values():
try:
driver.cleanup()