Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions stubs/Jetson.GPIO/@tests/stubtest_allowlist.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
# The high level module can only be imported on a Jetson SBC

# stubtest produces false positives for Jetson.GPIO-related modules in CI
# The high-level Jetson.GPIO library can only be imported on Jetson SBC,
# and requires specific system permissions (/dev/gpiochip0 access).
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.
Jetson.GPIO.gpio_pinmux_lookup

# This builtin error doesn't need to be re-exported
Jetson.GPIO.gpio_event.InterruptedError
22 changes: 22 additions & 0 deletions stubs/Jetson.GPIO/Jetson/GPIO/constants.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
from typing import Final

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
23 changes: 2 additions & 21 deletions stubs/Jetson.GPIO/Jetson/GPIO/gpio.pyi
Original file line number Diff line number Diff line change
@@ -1,26 +1,7 @@
from collections.abc import Callable, Sequence
from typing import Final, Literal
from typing import 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
from .constants import *

model = ...
JETSON_INFO = ...
Expand Down
11 changes: 11 additions & 0 deletions stubs/Jetson.GPIO/Jetson/GPIO/gpio_cdev.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import ctypes
from dataclasses import dataclass
from typing import Final, Literal

from .gpio_pin_data import ChannelInfo
Expand Down Expand Up @@ -70,3 +71,13 @@ def request_handle(line_offset: int, direction: Literal[0, 1], initial: Literal[
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: ...
@dataclass
class PadCtlRegister:
is_gpio: bool
is_input: bool
is_tristate: bool
def __init__(self, value: int) -> None: ...
@property
def is_bidi(self) -> bool: ...

def check_pinmux(ch_info: ChannelInfo, direction: int) -> None: ...
25 changes: 22 additions & 3 deletions stubs/Jetson.GPIO/Jetson/GPIO/gpio_pin_data.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ JETSON_THOR_REFERENCE: Final = "JETSON_THOR_REFERENCE"

JETSON_MODELS: list[str]

JETSON_ORIN_NX_PIN_DEFS: list[tuple[int, str, str, int, int, str, str, str | None, int | None]]
JETSON_ORIN_NX_PIN_DEFS: list[tuple[int, str, str, int, int, str, str, str | None, int | None, int]]
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]]
JETSON_ORIN_PIN_DEFS: list[tuple[int, str, str, int, int, str, str, str | None, int | None, int]]
compats_jetson_orins: Sequence[str]

CLARA_AGX_XAVIER_PIN_DEFS: list[tuple[int, str, str, int, int, str, str, str | None, int | None]]
Expand Down Expand Up @@ -49,8 +49,27 @@ compats_jetson_thor_reference: 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:
channel: int
chip_fd: int | None
line_handle: int | None
line_offset: int
direction: int | None
edge: int | None
consumer: str
gpio_name: str
gpio_chip: str
pwm_chip_dir: str
pwm_id: int
reg_addr: int | None
def __init__(
self, channel: int, line_offset: int, gpio_name: str, gpio_chip: str, pwm_chip_dir: str, pwm_id: int
self,
channel: int,
line_offset: int,
gpio_name: str,
gpio_chip: str,
pwm_chip_dir: str,
pwm_id: int,
reg_addr: int | None = None,
) -> None: ...

ids_warned: bool
Expand Down
6 changes: 6 additions & 0 deletions stubs/Jetson.GPIO/Jetson/GPIO/gpio_pinmux_lookup.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from collections.abc import Iterable

def lookup_mux_register(
gpio_pin: int, pin_defs: Iterable[tuple[int, str, str, int, int, str, str, str | None, int | None, int]]
) -> int: ...
def main() -> None: ...
2 changes: 1 addition & 1 deletion stubs/Jetson.GPIO/METADATA.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
version = "2.1.11"
version = "2.1.12"
upstream_repository = "https://github.com/NVIDIA/jetson-gpio"