mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2026-02-01 18:41:54 +08:00
only available gpio modes
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user