mirror of
https://github.com/licsber/micropython.git
synced 2024-09-20 00:50:24 +08:00
docs: More consistent capitalization and use of articles in headings.
See issue #3188.
This commit is contained in:
parent
de78a9e317
commit
aec88ddf03
@ -54,7 +54,7 @@ A MicroPython user C module is a directory with the following files:
|
|||||||
See below for full usage example.
|
See below for full usage example.
|
||||||
|
|
||||||
|
|
||||||
Basic Example
|
Basic example
|
||||||
-------------
|
-------------
|
||||||
|
|
||||||
This simple module named ``example`` provides a single function
|
This simple module named ``example`` provides a single function
|
||||||
|
@ -435,7 +435,7 @@ For low-level driving of a NeoPixel::
|
|||||||
``NeoPixel`` object.
|
``NeoPixel`` object.
|
||||||
|
|
||||||
|
|
||||||
Capacitive Touch
|
Capacitive touch
|
||||||
----------------
|
----------------
|
||||||
|
|
||||||
Use the ``TouchPad`` class in the ``machine`` module::
|
Use the ``TouchPad`` class in the ``machine`` module::
|
||||||
|
@ -173,8 +173,8 @@ For more details see Espressif's `ESP-IDF RMT documentation.
|
|||||||
stream starts at 0 or 1.
|
stream starts at 0 or 1.
|
||||||
|
|
||||||
|
|
||||||
The Ultra-Low-Power co-processor
|
Ultra-Low-Power co-processor
|
||||||
--------------------------------
|
----------------------------
|
||||||
|
|
||||||
.. class:: ULP()
|
.. class:: ULP()
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
:mod:`framebuf` --- Frame buffer manipulation
|
:mod:`framebuf` --- frame buffer manipulation
|
||||||
=============================================
|
=============================================
|
||||||
|
|
||||||
.. module:: framebuf
|
.. module:: framebuf
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
.. _pyboard_tutorial_switch:
|
.. _pyboard_tutorial_switch:
|
||||||
|
|
||||||
The Switch, callbacks and interrupts
|
Switches, callbacks and interrupts
|
||||||
====================================
|
==================================
|
||||||
|
|
||||||
The pyboard has 2 small switches, labelled USR and RST. The RST switch
|
The pyboard has 2 small switches, labelled USR and RST. The RST switch
|
||||||
is a hard-reset switch, and if you press it then it restarts the pyboard
|
is a hard-reset switch, and if you press it then it restarts the pyboard
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
Assembler Directives
|
Assembler directives
|
||||||
====================
|
====================
|
||||||
|
|
||||||
Labels
|
Labels
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
Floating Point instructions
|
Floating point instructions
|
||||||
==============================
|
===========================
|
||||||
|
|
||||||
These instructions support the use of the ARM floating point coprocessor
|
These instructions support the use of the ARM floating point coprocessor
|
||||||
(on platforms such as the Pyboard which are equipped with one). The FPU
|
(on platforms such as the Pyboard which are equipped with one). The FPU
|
||||||
@ -61,7 +61,7 @@ Where ``[Rn + offset]`` denotes the memory address obtained by adding Rn to the
|
|||||||
is specified in bytes. Since each float value occupies a 32 bit word, when accessing arrays of
|
is specified in bytes. Since each float value occupies a 32 bit word, when accessing arrays of
|
||||||
floats the offset must always be a multiple of four bytes.
|
floats the offset must always be a multiple of four bytes.
|
||||||
|
|
||||||
Data Comparison
|
Data comparison
|
||||||
---------------
|
---------------
|
||||||
|
|
||||||
* vcmp(Sd, Sm)
|
* vcmp(Sd, Sm)
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
.. _asm_thumb2_index:
|
.. _asm_thumb2_index:
|
||||||
|
|
||||||
Inline Assembler for Thumb2 architectures
|
Inline assembler for Thumb2 architectures
|
||||||
=========================================
|
=========================================
|
||||||
|
|
||||||
This document assumes some familiarity with assembly language programming and should be read after studying
|
This document assumes some familiarity with assembly language programming and should be read after studying
|
||||||
@ -25,7 +25,7 @@ This enables the effect of instructions to be demonstrated in Python. In certain
|
|||||||
because Python doesn't support concepts such as indirection. The pseudocode employed in such cases is
|
because Python doesn't support concepts such as indirection. The pseudocode employed in such cases is
|
||||||
described on the relevant page.
|
described on the relevant page.
|
||||||
|
|
||||||
Instruction Categories
|
Instruction categories
|
||||||
----------------------
|
----------------------
|
||||||
|
|
||||||
The following sections details the subset of the ARM Thumb-2 instruction set supported by MicroPython.
|
The following sections details the subset of the ARM Thumb-2 instruction set supported by MicroPython.
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
Logical & Bitwise instructions
|
Logical & bitwise instructions
|
||||||
==============================
|
==============================
|
||||||
|
|
||||||
Document conventions
|
Document conventions
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
.. _constrained:
|
.. _constrained:
|
||||||
|
|
||||||
MicroPython on Microcontrollers
|
MicroPython on microcontrollers
|
||||||
===============================
|
===============================
|
||||||
|
|
||||||
MicroPython is designed to be capable of running on microcontrollers. These
|
MicroPython is designed to be capable of running on microcontrollers. These
|
||||||
@ -12,7 +12,7 @@ based on a variety of architectures, the methods presented are generic: in some
|
|||||||
cases it will be necessary to obtain detailed information from platform specific
|
cases it will be necessary to obtain detailed information from platform specific
|
||||||
documentation.
|
documentation.
|
||||||
|
|
||||||
Flash Memory
|
Flash memory
|
||||||
------------
|
------------
|
||||||
|
|
||||||
On the Pyboard the simple way to address the limited capacity is to fit a micro
|
On the Pyboard the simple way to address the limited capacity is to fit a micro
|
||||||
@ -58,7 +58,7 @@ heap fragmentation. In general terms it is best to minimise the repeated
|
|||||||
creation and destruction of objects. The reason for this is covered in the
|
creation and destruction of objects. The reason for this is covered in the
|
||||||
section covering the `heap`_.
|
section covering the `heap`_.
|
||||||
|
|
||||||
Compilation Phase
|
Compilation phase
|
||||||
~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
When a module is imported, MicroPython compiles the code to bytecode which is
|
When a module is imported, MicroPython compiles the code to bytecode which is
|
||||||
@ -85,7 +85,7 @@ imported in the usual way. Alternatively some or all modules may be implemented
|
|||||||
as frozen bytecode: on most platforms this saves even more RAM as the bytecode
|
as frozen bytecode: on most platforms this saves even more RAM as the bytecode
|
||||||
is run directly from flash rather than being stored in RAM.
|
is run directly from flash rather than being stored in RAM.
|
||||||
|
|
||||||
Execution Phase
|
Execution phase
|
||||||
~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
There are a number of coding techniques for reducing RAM usage.
|
There are a number of coding techniques for reducing RAM usage.
|
||||||
@ -292,7 +292,7 @@ The Q(xxx) lines should be gone.
|
|||||||
|
|
||||||
.. _heap:
|
.. _heap:
|
||||||
|
|
||||||
The Heap
|
The heap
|
||||||
--------
|
--------
|
||||||
|
|
||||||
When a running program instantiates an object the necessary RAM is allocated
|
When a running program instantiates an object the necessary RAM is allocated
|
||||||
@ -391,7 +391,7 @@ Symbol Meaning
|
|||||||
Each letter represents a single block of memory, a block being 16 bytes. So each
|
Each letter represents a single block of memory, a block being 16 bytes. So each
|
||||||
line of the heap dump represents 0x400 bytes or 1KiB of RAM.
|
line of the heap dump represents 0x400 bytes or 1KiB of RAM.
|
||||||
|
|
||||||
Control of Garbage Collection
|
Control of garbage collection
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
A GC can be demanded at any time by issuing `gc.collect()`. It is advantageous
|
A GC can be demanded at any time by issuing `gc.collect()`. It is advantageous
|
||||||
@ -420,7 +420,7 @@ initialisation the compiler may be starved of RAM when subsequent modules are
|
|||||||
imported. If modules do instantiate data on import then `gc.collect()` issued
|
imported. If modules do instantiate data on import then `gc.collect()` issued
|
||||||
after the import will ameliorate the problem.
|
after the import will ameliorate the problem.
|
||||||
|
|
||||||
String Operations
|
String operations
|
||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
MicroPython handles strings in an efficient manner and understanding this can
|
MicroPython handles strings in an efficient manner and understanding this can
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
The MicroPython language
|
MicroPython language and implementation
|
||||||
========================
|
=======================================
|
||||||
|
|
||||||
MicroPython aims to implement the Python 3.4 standard (with selected
|
MicroPython aims to implement the Python 3.4 standard (with selected
|
||||||
features from later versions) with respect to language syntax, and most
|
features from later versions) with respect to language syntax, and most
|
||||||
|
@ -29,7 +29,7 @@ This summarises the points detailed below and lists the principal recommendation
|
|||||||
* Allocate an emergency exception buffer (see below).
|
* Allocate an emergency exception buffer (see below).
|
||||||
|
|
||||||
|
|
||||||
MicroPython Issues
|
MicroPython issues
|
||||||
------------------
|
------------------
|
||||||
|
|
||||||
The emergency exception buffer
|
The emergency exception buffer
|
||||||
@ -214,7 +214,7 @@ Exceptions
|
|||||||
If an ISR raises an exception it will not propagate to the main loop. The interrupt will be disabled unless the
|
If an ISR raises an exception it will not propagate to the main loop. The interrupt will be disabled unless the
|
||||||
exception is handled by the ISR code.
|
exception is handled by the ISR code.
|
||||||
|
|
||||||
General Issues
|
General issues
|
||||||
--------------
|
--------------
|
||||||
|
|
||||||
This is merely a brief introduction to the subject of real time programming. Beginners should note
|
This is merely a brief introduction to the subject of real time programming. Beginners should note
|
||||||
@ -225,7 +225,7 @@ with an appreciation of the following issues.
|
|||||||
|
|
||||||
.. _ISR:
|
.. _ISR:
|
||||||
|
|
||||||
Interrupt Handler Design
|
Interrupt handler design
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
As mentioned above, ISR's should be designed to be as simple as possible. They should always return in a short,
|
As mentioned above, ISR's should be designed to be as simple as possible. They should always return in a short,
|
||||||
@ -276,7 +276,7 @@ advanced topic beyond the scope of this tutorial.
|
|||||||
|
|
||||||
.. _Critical:
|
.. _Critical:
|
||||||
|
|
||||||
Critical Sections
|
Critical sections
|
||||||
~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
An example of a critical section of code is one which accesses more than one variable which can be affected by an ISR. If
|
An example of a critical section of code is one which accesses more than one variable which can be affected by an ISR. If
|
||||||
|
@ -103,7 +103,7 @@ For example:
|
|||||||
KeyboardInterrupt:
|
KeyboardInterrupt:
|
||||||
>>>
|
>>>
|
||||||
|
|
||||||
Paste Mode
|
Paste mode
|
||||||
----------
|
----------
|
||||||
|
|
||||||
If you want to paste some code into your terminal window, the auto-indent feature
|
If you want to paste some code into your terminal window, the auto-indent feature
|
||||||
@ -143,7 +143,7 @@ the auto-indent feature, and changes the prompt from ``>>>`` to ``===``. For exa
|
|||||||
Paste Mode allows blank lines to be pasted. The pasted text is compiled as if
|
Paste Mode allows blank lines to be pasted. The pasted text is compiled as if
|
||||||
it were a file. Pressing Ctrl-D exits paste mode and initiates the compilation.
|
it were a file. Pressing Ctrl-D exits paste mode and initiates the compilation.
|
||||||
|
|
||||||
Soft Reset
|
Soft reset
|
||||||
----------
|
----------
|
||||||
|
|
||||||
A soft reset will reset the python interpreter, but tries not to reset the
|
A soft reset will reset the python interpreter, but tries not to reset the
|
||||||
@ -196,7 +196,7 @@ So you can use the underscore to save the result in a variable. For example:
|
|||||||
15
|
15
|
||||||
>>>
|
>>>
|
||||||
|
|
||||||
Raw Mode
|
Raw mode
|
||||||
--------
|
--------
|
||||||
|
|
||||||
Raw mode is not something that a person would normally use. It is intended for
|
Raw mode is not something that a person would normally use. It is intended for
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
.. _speed_python:
|
.. _speed_python:
|
||||||
|
|
||||||
Maximising MicroPython Speed
|
Maximising MicroPython speed
|
||||||
============================
|
============================
|
||||||
|
|
||||||
.. contents::
|
.. contents::
|
||||||
@ -40,7 +40,7 @@ the best algorithm is employed. This is a topic for textbooks rather than for a
|
|||||||
MicroPython guide but spectacular performance gains can sometimes be achieved
|
MicroPython guide but spectacular performance gains can sometimes be achieved
|
||||||
by adopting algorithms known for their efficiency.
|
by adopting algorithms known for their efficiency.
|
||||||
|
|
||||||
RAM Allocation
|
RAM allocation
|
||||||
~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~
|
||||||
|
|
||||||
To design efficient MicroPython code it is necessary to have an understanding of the
|
To design efficient MicroPython code it is necessary to have an understanding of the
|
||||||
@ -69,7 +69,7 @@ example, objects which support stream interface (e.g., file or UART) provide ``r
|
|||||||
method which allocates new buffer for read data, but also a ``readinto()`` method
|
method which allocates new buffer for read data, but also a ``readinto()`` method
|
||||||
to read data into an existing buffer.
|
to read data into an existing buffer.
|
||||||
|
|
||||||
Floating Point
|
Floating point
|
||||||
~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~
|
||||||
|
|
||||||
Some MicroPython ports allocate floating point numbers on heap. Some other ports
|
Some MicroPython ports allocate floating point numbers on heap. Some other ports
|
||||||
|
Loading…
Reference in New Issue
Block a user