| |
- builtins.object
-
- ChannelState
- GPIO
class ChannelState(builtins.object) |
|
ChannelState(pin)
A class that manages the state of the individual GPIO channels. |
|
Methods defined here:
- __init__(self, pin)
Set up a fake GPIO channel.
• pin : The channel number, used for messaging.
- __str__(self) -> str
Return str(self).
- getState(self) -> int
Calculate the actual pin input state. If there's a high or low applied,
it's that, otherwise we look to the pull-up or pull-down resistor. If
neither of those are applied, give a warning and assume it's floating high.
- setState(self, value: int)
Set the state of an external input. We then calculate that
channel's input state, considering pull-up and pull-down resistors,
and call any applicable callbacks.
• value : The external input to the channel.
Data descriptors defined here:
- __dict__
dictionary for instance variables (if defined)
- __weakref__
list of weak references to the object (if defined)
|
class GPIO(builtins.object) |
|
Public class members match those in the RPi.GPIO module (or
at least they should match; if they don't, it's a bug).
See that module for documentation. |
|
Static methods defined here:
- add_event_callback(pin: int, callback) -> None
- add_event_detect(pin: int, transition: int, callback=None, bouncetime: None | int = None) -> None
- cleanup() -> None
- event_detected(pin: int, target: int) -> None
- input(pin: int) -> int
- output(pin: int, state: int | bool)
- remove_event_callback(pin: int) -> None
- remove_event_detect(pin: int) -> None
- runScript(events: list[tuple[float, int, int]]) -> None
Play out a series of GPIO events.
:value events: The event script. Each tuple is
time , pin-number and new-state .
- setmode(mode: int) -> None
Initialize the GPIO simulator.
- setup(pin: int, mode: int, pull_up_down: int = 27)
Set up a GPIO pin.
- simulateEvents(script_list: str) -> None
Simulate a sequence of inputs (presumably for testing).
Events are played in file order. There can be multiple scripts
(so pin assignments can be kept in one file), but only one script
with actions can be played at a time.
• script_list : a whitespace-separated list of scripts.
- wait_for_edge(pin: int, target: int, *, timeout: int | None) -> int | None
Data descriptors defined here:
- __dict__
dictionary for instance variables (if defined)
- __weakref__
list of weak references to the object (if defined)
Data and other attributes defined here:
- BCM = 108
- BOARD = 109
- BOTH = 384
- FALLING = 227
- HIGH = 107
- IN = 13
- LOW = 0
- OUT = 17
- PUD_DOWN = 88
- PUD_OFF = 27
- PUD_UP = 33
- RISING = 153
- UNCONFIGURED = 4
- __annotations__ = {'_channel': dict[int, gpiosim.ChannelState], '_script_thread': threading.Thread | None}
| |