Skip to content

Commit 47098ef

Browse files
committed
docs: Provide initial documentation for micropython module.
1 parent 7b19e99 commit 47098ef

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed

docs/library/index.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
Micro Python libraries
22
======================
33

4+
Functionality specific to the Micro Python implementation is available in
5+
the following library.
6+
7+
.. toctree::
8+
:maxdepth: 1
9+
10+
micropython.rst
11+
412
Python standard libraries
513
-------------------------
614

docs/library/micropython.rst

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
:mod:`micropython` -- access and control Micro Python internals
2+
===============================================================
3+
4+
.. module:: micropython
5+
:synopsis: access and control Micro Python internals
6+
7+
Functions
8+
---------
9+
10+
.. function:: mem_info([verbose])
11+
12+
Print information about currently used memory. If the ``verbose`` argument
13+
is given then extra information is printed.
14+
15+
The information that is printed is implementation dependent, but currently
16+
includes the amount of stack and heap used. In verbose mode it prints out
17+
the entire heap indicating which blocks are used and which are free.
18+
19+
.. function:: qstr_info([verbose])
20+
21+
Print information about currently interned strings. If the ``verbose``
22+
argument is given then extra information is printed.
23+
24+
The information that is printed is implementation dependent, but currently
25+
includes the number of interned strings and the amount of RAM they use. In
26+
verbose mode it prints out the names of all RAM-interned strings.
27+
28+
.. function:: alloc_emergency_exception_buf(size)
29+
30+
Allocate ``size`` bytes of RAM for the emergency exception buffer (a good
31+
size is around 100 bytes). The buffer is used to create exceptions in cases
32+
when normal RAM allocation would fail (eg within an interrupt handler).
33+
34+
A good way to use this function is to put it at the start of your main script
35+
(eg boot.py or main.py) and then the emergency exception buffer will be active
36+
for all the code following it.

0 commit comments

Comments
 (0)