only available gpio modes

This commit is contained in:
Devaev Maxim
2020-09-10 09:31:05 +03:00
parent 967afb2d9a
commit 9cb5582565
8 changed files with 58 additions and 26 deletions

View File

@@ -20,6 +20,7 @@
# ========================================================================== #
from typing import Set
from typing import Type
from typing import Optional
from typing import Any
@@ -46,6 +47,14 @@ class GpioDriverOfflineError(GpioOperationError):
super().__init__(f"GPIO driver {driver} is offline")
# =====
class UserGpioModes:
INPUT = "input"
OUTPUT = "output"
ALL = set([INPUT, OUTPUT])
# =====
class BaseUserGpioDriver(BasePlugin):
def __init__( # pylint: disable=super-init-not-called
@@ -61,6 +70,10 @@ class BaseUserGpioDriver(BasePlugin):
def get_instance_id(self) -> str:
return self._instance_name
@classmethod
def get_modes(cls) -> Set[str]:
return set(UserGpioModes.ALL)
def register_input(self, pin: int) -> None:
raise NotImplementedError