mirror of
https://github.com/pybricks/pybricks-api.git
synced 2026-09-12 01:24:17 +00:00
micropython: Document heap_lock, heap_unlock.
Fixes https://github.com/pybricks/pybricks-api/issues/116
This commit is contained in:
@@ -6,16 +6,20 @@
|
||||
|
||||
.. autofunction:: micropython.const
|
||||
|
||||
.. autofunction:: micropython.opt_level
|
||||
.. autofunction:: micropython.heap_lock
|
||||
|
||||
.. autofunction:: micropython.heap_unlock
|
||||
|
||||
.. autofunction:: micropython.kbd_intr
|
||||
|
||||
.. autofunction:: micropython.mem_info
|
||||
|
||||
.. autofunction:: micropython.opt_level
|
||||
|
||||
.. autofunction:: micropython.qstr_info
|
||||
|
||||
|
||||
.. autofunction:: micropython.stack_use
|
||||
|
||||
.. autofunction:: micropython.kbd_intr
|
||||
|
||||
|
||||
Examples
|
||||
---------------------
|
||||
|
||||
@@ -149,6 +149,8 @@ def test_from_micropython_import():
|
||||
completions: list[CompletionItem] = json.loads(complete(code, 1, len(code) + 1))
|
||||
assert [c["insertText"] for c in completions] == [
|
||||
"const",
|
||||
"heap_lock",
|
||||
"heap_unlock",
|
||||
"kbd_intr",
|
||||
"mem_info",
|
||||
"opt_level",
|
||||
|
||||
@@ -108,7 +108,27 @@ def stack_use() -> int:
|
||||
"""
|
||||
|
||||
|
||||
# REVISIT: Skipping heap lock funcs for now
|
||||
def heap_lock() -> None:
|
||||
"""
|
||||
heap_lock()
|
||||
|
||||
Locks the heap. When locked, no memory allocation can occur. A
|
||||
``MemoryError`` will be raised if any heap allocation is attempted.
|
||||
"""
|
||||
|
||||
|
||||
def heap_unlock() -> int:
|
||||
"""
|
||||
heap_unlock() -> int
|
||||
|
||||
Unlocks the heap. Memory allocation is now allowed again.
|
||||
|
||||
If :func:`heap_lock()` was called multiple times, :func:`heap_unlock()`
|
||||
must be called the same number of times to make the heap available again.
|
||||
|
||||
Returns:
|
||||
The lock depth after unlocking. It is ``0`` once it is unlocked.
|
||||
"""
|
||||
|
||||
|
||||
def kbd_intr(chr: int) -> None:
|
||||
|
||||
Reference in New Issue
Block a user