Skip to content

Commit 88d3054

Browse files
committed
docs: Import documentation from source-code inline comments.
The inline docs (prefixed with /// in .c files) have been converted to RST format and put in the docs subdirectory.
1 parent 7c4445a commit 88d3054

39 files changed

Lines changed: 2350 additions & 9 deletions

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
# The short X.Y version.
6161
version = '1.3'
6262
# The full version, including alpha/beta/rc tags.
63-
release = '1.3.1'
63+
release = '1.3.5'
6464

6565
# The language for content autogenerated by Sphinx. Refer to documentation
6666
# for a list of supported languages.

docs/index.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,11 @@ Software
1414
--------
1515

1616
.. toctree::
17-
:maxdepth: 2
17+
:maxdepth: 1
1818

1919
general.rst
2020
tutorial/index.rst
21+
library/index.rst
2122

2223
..
2324
.. - Reference for the [pyb module](module/pyb/ "pyb module").

docs/library/cmath.rst

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
:mod:`cmath` --- mathematical functions for complex numbers
2+
===========================================================
3+
4+
.. module:: cmath
5+
:synopsis: mathematical functions for complex numbers
6+
7+
The ``cmath`` module provides some basic mathematical funtions for
8+
working with complex numbers.
9+
10+
11+
Functions
12+
---------
13+
14+
.. function:: cos(z)
15+
16+
Return the cosine of ``z``.
17+
18+
.. function:: exp(z)
19+
20+
Return the exponential of ``z``.
21+
22+
.. function:: log(z)
23+
24+
Return the natural logarithm of ``z``. The branch cut is along the negative real axis.
25+
26+
.. function:: log10(z)
27+
28+
Return the base-10 logarithm of ``z``. The branch cut is along the negative real axis.
29+
30+
.. function:: phase(z)
31+
32+
Returns the phase of the number ``z``, in the range (-pi, +pi].
33+
34+
.. function:: polar(z)
35+
36+
Returns, as a tuple, the polar form of ``z``.
37+
38+
.. function:: rect(r, phi)
39+
40+
Returns the complex number with modulus ``r`` and phase ``phi``.
41+
42+
.. function:: sin(z)
43+
44+
Return the sine of ``z``.
45+
46+
.. function:: sqrt(z)
47+
48+
Return the square-root of ``z``.
49+
50+
51+
Constants
52+
---------
53+
54+
.. data:: e
55+
56+
base of the natural logarithm
57+
58+
.. data:: pi
59+
60+
the ratio of a circle's circumference to its diameter

docs/library/gc.rst

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
:mod:`gc` --- control the garbage collector
2+
===========================================
3+
4+
.. module:: gc
5+
:synopsis: control the garbage collector
6+
7+
8+
9+
Functions
10+
---------
11+
12+
.. function:: collect()
13+
14+
Run a garbage collection.
15+
16+
.. function:: disable()
17+
18+
Disable the garbage collector.
19+
20+
.. function:: enable()
21+
22+
Enable the garbage collector.
23+
24+
.. function:: mem_alloc()
25+
26+
Return the number of bytes of heap RAM that are allocated.
27+
28+
.. function:: mem_free()
29+
30+
Return the number of bytes of available heap RAM.

docs/library/index.rst

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
Micro Python libraries
2+
======================
3+
4+
Python standard libraries
5+
-------------------------
6+
7+
.. toctree::
8+
:maxdepth: 1
9+
10+
cmath.rst
11+
gc.rst
12+
math.rst
13+
os.rst
14+
select.rst
15+
sys.rst
16+
time.rst
17+
18+
Micro Python reduced libraries
19+
------------------------------
20+
21+
.. toctree::
22+
:maxdepth: 1
23+
24+
usocket.rst
25+
uheapq.rst
26+
ujson.rst
27+
28+
Libraries specific to the pyboard
29+
---------------------------------
30+
31+
.. toctree::
32+
:maxdepth: 2
33+
34+
pyb.rst
35+
network.rst

docs/library/math.rst

Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
:mod:`math` --- mathematical functions
2+
======================================
3+
4+
.. module:: math
5+
:synopsis: mathematical functions
6+
7+
The ``math`` module provides some basic mathematical funtions for
8+
working with floating-point numbers.
9+
10+
11+
Functions
12+
---------
13+
14+
.. function:: acos(x)
15+
16+
17+
.. function:: acosh(x)
18+
19+
20+
.. function:: asin(x)
21+
22+
23+
.. function:: asinh(x)
24+
25+
26+
.. function:: atan(x)
27+
28+
29+
.. function:: atan2(y, x)
30+
31+
32+
.. function:: atanh(x)
33+
34+
35+
.. function:: ceil(x)
36+
37+
38+
.. function:: copysign(x, y)
39+
40+
41+
.. function:: cos(x)
42+
43+
44+
.. function:: cosh(x)
45+
46+
47+
.. function:: degrees(x)
48+
49+
50+
.. function:: erf(x)
51+
52+
Return the error function of ``x``.
53+
54+
.. function:: erfc(x)
55+
56+
Return the complementary error function of ``x``.
57+
58+
.. function:: exp(x)
59+
60+
61+
.. function:: expm1(x)
62+
63+
64+
.. function:: fabs(x)
65+
66+
67+
.. function:: floor(x)
68+
69+
70+
.. function:: fmod(x, y)
71+
72+
73+
.. function:: frexp(x)
74+
75+
Converts a floating-point number to fractional and integral components.
76+
77+
.. function:: gamma(x)
78+
79+
Return the gamma function of ``x``.
80+
81+
.. function:: isfinite(x)
82+
83+
84+
.. function:: isinf(x)
85+
86+
87+
.. function:: isnan(x)
88+
89+
90+
.. function:: ldexp(x, exp)
91+
92+
93+
.. function:: lgamma(x)
94+
95+
return the natural logarithm of the gamma function of ``x``.
96+
97+
.. function:: log(x)
98+
99+
100+
.. function:: log10(x)
101+
102+
103+
.. function:: log2(x)
104+
105+
106+
.. function:: modf(x)
107+
108+
109+
.. function:: pow(x, y)
110+
111+
Returns ``x`` to the power of ``y``.
112+
113+
.. function:: radians(x)
114+
115+
116+
.. function:: sin(x)
117+
118+
119+
.. function:: sinh(x)
120+
121+
122+
.. function:: sqrt(x)
123+
124+
Returns the square root of ``x``.
125+
126+
.. function:: tan(x)
127+
128+
129+
.. function:: tanh(x)
130+
131+
132+
.. function:: trunc(x)
133+
134+
135+
136+
Constants
137+
---------
138+
139+
.. data:: e
140+
141+
base of the natural logarithm
142+
143+
.. data:: pi
144+
145+
the ratio of a circle's circumference to its diameter

docs/library/network.rst

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
****************************************
2+
:mod:`network` --- network configuration
3+
****************************************
4+
5+
.. module:: network
6+
:synopsis: network configuration
7+
8+
This module provides network drivers and routing configuration.
9+
10+
11+
class CC3k
12+
==========
13+
14+
Constructors
15+
------------
16+
17+
.. class:: CC3k(spi, pin_cs, pin_en, pin_irq)
18+
19+
Initialise the CC3000 using the given SPI bus and pins and return a CC3k object.
20+
21+
22+
Methods
23+
-------
24+
25+
.. method:: cc3k.connect(ssid, key=None, \*, security=WPA2, bssid=None)
26+
27+
28+
class WIZnet5k
29+
==============
30+
31+
This class allows you to control WIZnet5x00 Ethernet adaptors based on
32+
the W5200 and W5500 chipsets (only W5200 tested).
33+
34+
Example usage::
35+
36+
import wiznet5k
37+
w = wiznet5k.WIZnet5k()
38+
print(w.ipaddr())
39+
w.gethostbyname('micropython.org')
40+
s = w.socket()
41+
s.connect(('192.168.0.2', 8080))
42+
s.send('hello')
43+
print(s.recv(10))
44+
45+
46+
Constructors
47+
------------
48+
49+
.. class:: WIZnet5k(spi, pin_cs, pin_rst)
50+
51+
Create and return a WIZnet5k object.
52+
53+
54+
Methods
55+
-------
56+
57+
.. method:: wiznet5k.ipaddr([(ip, subnet, gateway, dns)])
58+
59+
Get/set IP address, subnet mask, gateway and DNS.
60+
61+
.. method:: wiznet5k.regs()
62+
63+
Dump WIZnet5k registers.

0 commit comments

Comments
 (0)