Skip to content

Commit 06ec96b

Browse files
committed
docs/machine: Generalize docs from just WiPy to other ports.
1 parent cfc94be commit 06ec96b

File tree

1 file changed

+32
-24
lines changed

1 file changed

+32
-24
lines changed

docs/library/machine.rst

Lines changed: 32 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -18,23 +18,25 @@ Reset related functions
1818

1919
Get the reset cause. See :ref:`constants <machine_constants>` for the possible return values.
2020

21-
Interrupt related functions
22-
---------------------------
21+
.. only:: port_wipy
2322

24-
.. function:: disable_irq()
23+
Interrupt related functions
24+
---------------------------
2525

26-
Disable interrupt requests.
27-
Returns the previous IRQ state: ``False``/``True`` for disabled/enabled IRQs
28-
respectively. This return value can be passed to enable_irq to restore
29-
the IRQ to its original state.
26+
.. function:: disable_irq()
3027

31-
.. function:: enable_irq(state=True)
28+
Disable interrupt requests.
29+
Returns the previous IRQ state: ``False``/``True`` for disabled/enabled IRQs
30+
respectively. This return value can be passed to enable_irq to restore
31+
the IRQ to its original state.
3232

33-
Enable interrupt requests.
34-
If ``state`` is ``True`` (the default value) then IRQs are enabled.
35-
If ``state`` is ``False`` then IRQs are disabled. The most common use of
36-
this function is to pass it the value returned by ``disable_irq`` to
37-
exit a critical section.
33+
.. function:: enable_irq(state=True)
34+
35+
Enable interrupt requests.
36+
If ``state`` is ``True`` (the default value) then IRQs are enabled.
37+
If ``state`` is ``False`` then IRQs are disabled. The most common use of
38+
this function is to pass it the value returned by ``disable_irq`` to
39+
exit a critical section.
3840

3941
Power related functions
4042
-----------------------
@@ -69,31 +71,37 @@ Power related functions
6971

7072
Stops the CPU and all peripherals including WLAN. Execution is resumed from main, just
7173
as with a reset. The reset cause can be checked to know that we are coming from
72-
from ``machine.DEEPSLEEP``. Wake sources are ``Pin`` and ``RTC``. Current consumption
74+
``machine.DEEPSLEEP``. Wake sources are ``Pin`` and ``RTC``. Current consumption
7375
is reduced to ~5uA.
7476

75-
.. function:: wake_reason()
77+
.. only:: port_wipy
78+
79+
.. function:: wake_reason()
7680

77-
Get the wake reason. See :ref:`constants <machine_constants>` for the possible return values.
81+
Get the wake reason. See :ref:`constants <machine_constants>` for the possible return values.
7882

7983
Miscellaneous functions
8084
-----------------------
8185

82-
.. function:: main(filename)
86+
.. only:: port_wipy
87+
88+
.. function:: main(filename)
8389

84-
Set the filename of the main script to run after boot.py is finished. If
85-
this function is not called then the default file main.py will be executed.
90+
Set the filename of the main script to run after boot.py is finished. If
91+
this function is not called then the default file main.py will be executed.
8692

87-
It only makes sense to call this function from within boot.py.
93+
It only makes sense to call this function from within boot.py.
8894

89-
.. function:: rng()
95+
.. function:: rng()
9096

91-
Return a 24-bit software generated random number.
97+
Return a 24-bit software generated random number.
9298

9399
.. function:: unique_id()
94100

95-
Returns a string of 6 bytes (48 bits), which is the unique ID of the MCU.
96-
This also corresponds to the network ``MAC address``.
101+
Returns a byte string with a unique idenifier of a board/SoC. It will vary
102+
from a board/SoC instance to another, if underlying hardware allows. Length
103+
varies by hardware (so use substring of a full value if you expect a short
104+
ID). In some MicroPython ports, ID corresponds to the network MAC address.
97105

98106
.. _machine_constants:
99107

0 commit comments

Comments
 (0)