mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-16 00:37:10 +08:00
Add stubs for Jetson.GPIO (#12108)
This commit is contained in:
10
stubs/Jetson.GPIO/@tests/stubtest_allowlist.txt
Normal file
10
stubs/Jetson.GPIO/@tests/stubtest_allowlist.txt
Normal file
@@ -0,0 +1,10 @@
|
||||
# The high level module can only be imported on a Jetson SBC
|
||||
|
||||
Jetson.GPIO
|
||||
# error: Jetson.GPIO failed to import. RuntimeError: The current user does not have permissions set to access the library functionalites. Please configure permissions or use the root user to run this. It is also possible that /dev/gpiochip0 does not exist. Please check if that file is present.
|
||||
|
||||
Jetson.GPIO.gpio
|
||||
# error: Jetson.GPIO.gpio failed to import. RuntimeError: The current user does not have permissions set to access the library functionalites. Please configure permissions or use the root user to run this. It is also possible that /dev/gpiochip0 does not exist. Please check if that file is present.
|
||||
|
||||
# This builtin error doesn't need to be re-exported
|
||||
Jetson.GPIO.gpio_event.InterruptedError
|
||||
3
stubs/Jetson.GPIO/Jetson/GPIO/__init__.pyi
Normal file
3
stubs/Jetson.GPIO/Jetson/GPIO/__init__.pyi
Normal file
@@ -0,0 +1,3 @@
|
||||
from .gpio import *
|
||||
|
||||
VERSION: str = ...
|
||||
63
stubs/Jetson.GPIO/Jetson/GPIO/gpio.pyi
Normal file
63
stubs/Jetson.GPIO/Jetson/GPIO/gpio.pyi
Normal file
@@ -0,0 +1,63 @@
|
||||
from collections.abc import Callable, Sequence
|
||||
from typing import Final, Literal
|
||||
|
||||
BOARD: Final = 10
|
||||
BCM: Final = 11
|
||||
TEGRA_SOC: Final = 1000
|
||||
CVM: Final = 1001
|
||||
|
||||
PUD_OFF: Final = 20
|
||||
PUD_DOWN: Final = 21
|
||||
PUD_UP: Final = 22
|
||||
|
||||
HIGH: Final = 1
|
||||
LOW: Final = 0
|
||||
|
||||
RISING: Final = 31
|
||||
FALLING: Final = 32
|
||||
BOTH: Final = 33
|
||||
|
||||
UNKNOWN: Final = -1
|
||||
OUT: Final = 0
|
||||
IN: Final = 1
|
||||
HARD_PWM: Final = 43
|
||||
|
||||
model = ...
|
||||
JETSON_INFO = ...
|
||||
RPI_INFO = ...
|
||||
|
||||
def setwarnings(state: bool) -> None: ...
|
||||
def setmode(mode: Literal[10, 11, 1000, 1001]) -> None: ...
|
||||
def getmode() -> Literal[10, 11, 1000, 1001]: ...
|
||||
def setup(
|
||||
channels: int | Sequence[int],
|
||||
direction: Literal[0, 1],
|
||||
pull_up_down: Literal[20, 21, 22] = ...,
|
||||
initial: Literal[0, 1] = ...,
|
||||
consumer: str = ...,
|
||||
) -> None: ...
|
||||
def cleanup(channel: int | Sequence[int] | None = ...) -> None: ...
|
||||
def input(channel: int) -> Literal[0, 1]: ...
|
||||
def output(channels: int | Sequence[int], values: Literal[0, 1]) -> None: ...
|
||||
def add_event_detect(
|
||||
channel: int,
|
||||
edge: Literal[31, 32, 33],
|
||||
callback: Callable[[int], None] | None = ...,
|
||||
bouncetime: int | None = ...,
|
||||
polltime: float = ...,
|
||||
) -> None: ...
|
||||
def remove_event_detect(channel: int, timeout: float = ...) -> None: ...
|
||||
def event_detected(channel: int) -> bool: ...
|
||||
def add_event_callback(channel: int, callback: Callable[[int], None]) -> None: ...
|
||||
def wait_for_edge(
|
||||
channel: int, edge: Literal[31, 32, 33], bouncetime: int | None = ..., timeout: float | None = ...
|
||||
) -> int | None: ...
|
||||
def gpio_function(channel: int) -> Literal[-1, 0, 1]: ...
|
||||
|
||||
class PWM:
|
||||
def __init__(self, channel: int, frequency_hz: float) -> None: ...
|
||||
def __del__(self) -> None: ...
|
||||
def start(self, duty_cycle_percent: float) -> None: ...
|
||||
def ChangeFrequency(self, frequency_hz: float) -> None: ...
|
||||
def ChangeDutyCycle(self, duty_cycle_percent: float) -> None: ...
|
||||
def stop(self) -> None: ...
|
||||
72
stubs/Jetson.GPIO/Jetson/GPIO/gpio_cdev.pyi
Normal file
72
stubs/Jetson.GPIO/Jetson/GPIO/gpio_cdev.pyi
Normal file
@@ -0,0 +1,72 @@
|
||||
import ctypes
|
||||
from typing import Final, Literal
|
||||
|
||||
from .gpio_pin_data import ChannelInfo
|
||||
|
||||
GPIO_HIGH: Final = 1
|
||||
|
||||
GPIOHANDLE_REQUEST_INPUT: Final = 0x1
|
||||
GPIOHANDLE_REQUEST_OUTPUT: Final = 0x2
|
||||
|
||||
GPIOEVENT_REQUEST_RISING_EDGE: Final = 0x1
|
||||
GPIOEVENT_REQUEST_FALLING_EDGE: Final = 0x2
|
||||
GPIOEVENT_REQUEST_BOTH_EDGES: Final = 0x3
|
||||
|
||||
GPIO_GET_CHIPINFO_IOCTL: Final = 0x8044B401
|
||||
GPIO_GET_LINEINFO_IOCTL: Final = 0xC048B402
|
||||
GPIO_GET_LINEHANDLE_IOCTL: Final = 0xC16CB403
|
||||
GPIOHANDLE_GET_LINE_VALUES_IOCTL: Final = 0xC040B408
|
||||
GPIOHANDLE_SET_LINE_VALUES_IOCTL: Final = 0xC040B409
|
||||
GPIO_GET_LINEEVENT_IOCTL: Final = 0xC030B404
|
||||
|
||||
class gpiochip_info(ctypes.Structure):
|
||||
name: str
|
||||
label: str
|
||||
lines: int
|
||||
|
||||
class gpiohandle_request(ctypes.Structure):
|
||||
lineoffsets: list[int]
|
||||
flags: int
|
||||
default_values: list[int]
|
||||
consumer_label: str
|
||||
lines: int
|
||||
fd: int
|
||||
|
||||
class gpiohandle_data(ctypes.Structure):
|
||||
values: list[int]
|
||||
|
||||
class gpioline_info(ctypes.Structure):
|
||||
line_offset: int
|
||||
flags: int
|
||||
name: str
|
||||
consumer: str
|
||||
|
||||
class gpioline_info_changed(ctypes.Structure):
|
||||
line_info: gpioline_info
|
||||
timestamp: int
|
||||
event_type: int
|
||||
padding: list[int]
|
||||
|
||||
class gpioevent_request(ctypes.Structure):
|
||||
lineoffset: int
|
||||
handleflags: int
|
||||
eventflags: int
|
||||
consumer_label: str
|
||||
fd: int
|
||||
|
||||
class gpioevent_data(ctypes.Structure):
|
||||
timestamp: int
|
||||
id: int
|
||||
|
||||
class GPIOError(IOError): ...
|
||||
|
||||
def chip_open(gpio_chip: str) -> int: ...
|
||||
def chip_check_info(label: str, gpio_device: str) -> int | None: ...
|
||||
def chip_open_by_label(label: str) -> int: ...
|
||||
def close_chip(chip_fd: int) -> None: ...
|
||||
def open_line(ch_info: ChannelInfo, request: int) -> None: ...
|
||||
def close_line(line_handle: int) -> None: ...
|
||||
def request_handle(line_offset: int, direction: Literal[0, 1], initial: Literal[0, 1], consumer: str) -> gpiohandle_request: ...
|
||||
def request_event(line_offset: int, edge: int, consumer: str) -> gpioevent_request: ...
|
||||
def get_value(line_handle: int) -> int: ...
|
||||
def set_value(line_handle: int, value: int) -> None: ...
|
||||
17
stubs/Jetson.GPIO/Jetson/GPIO/gpio_event.pyi
Normal file
17
stubs/Jetson.GPIO/Jetson/GPIO/gpio_event.pyi
Normal file
@@ -0,0 +1,17 @@
|
||||
from collections.abc import Callable
|
||||
from typing import Any, Final, Literal
|
||||
|
||||
NO_EDGE: Final = 0
|
||||
RISING_EDGE: Final = 1
|
||||
FALLING_EDGE: Final = 2
|
||||
BOTH_EDGE: Final = 3
|
||||
|
||||
def add_edge_detect(
|
||||
chip_fd: int, chip_name: str, channel: int, request: int, bouncetime: int, poll_time: float
|
||||
) -> Literal[1, 2, 0]: ...
|
||||
def remove_edge_detect(chip_name: str, channel: int, timeout: float = ...) -> None: ...
|
||||
def add_edge_callback(chip_name: str, channel: int, callback: Callable[[int], None]) -> None: ...
|
||||
def edge_event_detected(chip_name: str, channel: int) -> bool: ...
|
||||
def gpio_event_added(chip_name: str, channel: int) -> Any: ...
|
||||
def blocking_wait_for_edge(chip_fd: int, chip_name: str, channel: int, request: int, bouncetime: int, timeout: float) -> int: ...
|
||||
def event_cleanup(chip_name: str, channel: int) -> None: ...
|
||||
58
stubs/Jetson.GPIO/Jetson/GPIO/gpio_pin_data.pyi
Normal file
58
stubs/Jetson.GPIO/Jetson/GPIO/gpio_pin_data.pyi
Normal file
@@ -0,0 +1,58 @@
|
||||
from collections.abc import Sequence
|
||||
from typing import Any, Final
|
||||
|
||||
CLARA_AGX_XAVIER: Final = "CLARA_AGX_XAVIER"
|
||||
JETSON_NX: Final = "JETSON_NX"
|
||||
JETSON_XAVIER: Final = "JETSON_XAVIER"
|
||||
JETSON_TX2: Final = "JETSON_TX2"
|
||||
JETSON_TX1: Final = "JETSON_TX1"
|
||||
JETSON_NANO: Final = "JETSON_NANO"
|
||||
JETSON_TX2_NX: Final = "JETSON_TX2_NX"
|
||||
JETSON_ORIN: Final = "JETSON_ORIN"
|
||||
JETSON_ORIN_NX: Final = "JETSON_ORIN_NX"
|
||||
JETSON_ORIN_NANO: Final = "JETSON_ORIN_NANO"
|
||||
|
||||
JETSON_MODELS: list[str] = ...
|
||||
|
||||
JETSON_ORIN_NX_PIN_DEFS: list[tuple[int, str, str, int, int, str, str, str | None, int | None]] = ...
|
||||
compats_jetson_orins_nx: Sequence[str] = ...
|
||||
compats_jetson_orins_nano: Sequence[str] = ...
|
||||
|
||||
JETSON_ORIN_PIN_DEFS: list[tuple[int, str, str, int, int, str, str, str | None, int | None]] = ...
|
||||
compats_jetson_orins: Sequence[str] = ...
|
||||
|
||||
CLARA_AGX_XAVIER_PIN_DEFS: list[tuple[int, str, str, int, int, str, str, str | None, int | None]] = ...
|
||||
compats_clara_agx_xavier: Sequence[str] = ...
|
||||
|
||||
JETSON_NX_PIN_DEFS: list[tuple[int, str, str, int, int, str, str, str | None, int | None]] = ...
|
||||
compats_nx: Sequence[str] = ...
|
||||
|
||||
JETSON_XAVIER_PIN_DEFS: list[tuple[int, str, str, int, int, str, str, str | None, int | None]] = ...
|
||||
compats_xavier: Sequence[str] = ...
|
||||
|
||||
JETSON_TX2_NX_PIN_DEFS: list[tuple[int, str, str, int, int, str, str, str | None, int | None]] = ...
|
||||
compats_tx2_nx: Sequence[str] = ...
|
||||
|
||||
JETSON_TX2_PIN_DEFS: list[tuple[int, str, str, int, int, str, str, str | None, int | None]] = ...
|
||||
compats_tx2: Sequence[str] = ...
|
||||
|
||||
JETSON_TX1_PIN_DEFS: list[tuple[int, str, str, int, int, str, str, str | None, int | None]] = ...
|
||||
compats_tx1: Sequence[str] = ...
|
||||
|
||||
JETSON_NANO_PIN_DEFS: list[tuple[int, str, str, int, int, str, str, str | None, int | None]] = ...
|
||||
compats_nano: Sequence[str] = ...
|
||||
|
||||
jetson_gpio_data: dict[str, tuple[list[tuple[int, str, str, int, int, str, str, str | None, int | None]], dict[str, Any]]] = ...
|
||||
|
||||
class ChannelInfo:
|
||||
def __init__(
|
||||
self, channel: int, line_offset: int, gpio_name: str, gpio_chip: str, pwm_chip_dir: str, pwm_id: int
|
||||
) -> None: ...
|
||||
|
||||
ids_warned: bool = ...
|
||||
|
||||
def find_pmgr_board(prefix: str) -> str | None: ...
|
||||
def warn_if_not_carrier_board(*carrier_boards: str) -> None: ...
|
||||
def get_compatibles(compatible_path: str) -> list[str]: ...
|
||||
def get_model() -> str: ...
|
||||
def get_data() -> tuple[str, Any, dict[str, dict[Any, ChannelInfo]]]: ...
|
||||
0
stubs/Jetson.GPIO/Jetson/__init__.pyi
Normal file
0
stubs/Jetson.GPIO/Jetson/__init__.pyi
Normal file
2
stubs/Jetson.GPIO/METADATA.toml
Normal file
2
stubs/Jetson.GPIO/METADATA.toml
Normal file
@@ -0,0 +1,2 @@
|
||||
version = "2.1.*"
|
||||
upstream_repository = "https://github.com/NVIDIA/jetson-gpio"
|
||||
Reference in New Issue
Block a user