Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add mem{8,16,32} to machine. #35

Merged
merged 1 commit into from
May 4, 2022
Merged
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
22 changes: 22 additions & 0 deletions typeshed/stdlib/machine.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,25 @@ def time_pulse_us(
:return: The duration of the pulse in microseconds, or -1 for a timeout waiting for the level to match ``pulse_level``, or -2 on timeout waiting for the pulse to end
"""
...


class mem:
"""The class for the ``mem8``, ``mem16`` and ``mem32`` memory views."""
def __getitem__(self, address: int) -> int:
"""Access a value from memory."""
...
def __setitem__(self, address: int, value: int) -> None:
"""Set a value at the given address."""
...


mem8: mem
"""8-bit (byte) view of memory."""


mem16: mem
"""16-bit view of memory."""


mem32: mem
"""32-bit view of memory."""