Commit Graph

79 Commits

Author SHA1 Message Date
Jim Mussared
9092909bf5 docs: Rename uasyncio to asyncio.
This work was funded through GitHub Sponsors.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-06-19 18:36:54 +10:00
Jim Mussared
8211d56712 docs/library/index: Update docs after umodule rename.
- Update guide for extending built-in modules.
- Remove any last trace of umodule in other docs.

This work was funded through GitHub Sponsors.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-06-08 17:54:28 +10:00
Jim Mussared
5159304ca1 docs/library/index: Update built-in extension docs.
- Make the docs match the new behavior which only allows certain modules
  to be extended.
- List the modules that currently have the u-prefix.
- Add a note about the sys.path method for forcing a built-in import.

This work was funded through GitHub Sponsors.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-06-01 16:22:04 +10:00
Glenn Moloney
7fa322afb8 esp32,esp8266: Add support for the Espressif ESP-NOW protocol.
ESP-NOW is a proprietary wireless communication protocol which supports
connectionless communication between ESP32 and ESP8266 devices, using
vendor specific WiFi frames.  This commit adds support for this protocol
through a new `espnow` module.

This commit builds on original work done by @nickzoic, @shawwwn and with
contributions from @zoland.  Features include:
- Use of (extended) ring buffers in py/ringbuf.[ch] for robust IO.
- Signal strength (RSSI) monitoring.
- Core support in `_espnow` C module, extended by `espnow.py` module.
- Asyncio support via `aioespnow.py` module (separate to this commit).
- Docs provided at `docs/library/espnow.rst`.

Methods available in espnow.ESPNow class are:
- active(True/False)
- config(): set rx buffer size, read timeout and tx rate
- recv()/irecv()/recvinto() to read incoming messages from peers
- send() to send messages to peer devices
- any() to test if a message is ready to read
- irq() to set callback for received messages
- stats() returns transfer stats:
    (tx_pkts, tx_pkt_responses, tx_failures, rx_pkts, lost_rx_pkts)
- add_peer(mac, ...) registers a peer before sending messages
- get_peer(mac) returns peer info: (mac, lmk, channel, ifidx, encrypt)
- mod_peer(mac, ...) changes peer info parameters
- get_peers() returns all peer info tuples
- peers_table supports RSSI signal monitoring for received messages:
    {peer1: [rssi, time_ms], peer2: [rssi, time_ms], ...}

ESP8266 is a pared down version of the ESP32 ESPNow support due to code
size restrictions and differences in the low-level API.  See docs for
details.

Also included is a test suite in tests/multi_espnow.  This tests basic
espnow data transfer, multiple transfers, various message sizes, encrypted
messages (pmk and lmk), and asyncio support.

Initial work is from https://github.com/micropython/micropython/pull/4115.
Initial import of code is from:
https://github.com/nickzoic/micropython/tree/espnow-4115.
2023-05-01 16:47:21 +10:00
Laurens Valk
da217e83d9 docs/library: Fix nested rst styles not rendering.
These can't be nested, so apply styling separately.

Signed-off-by: Laurens Valk <laurens@pybricks.com>
2022-08-26 15:15:59 +10:00
robert-hh
56b331ace6 drivers/codec: Add driver for the WM8960 codec.
This codec is assembled for the MIMXRT1xxx_DEV boards and available for
WM8960 breakout boards as well.

The driver itself has been tested as working with the MIMXRT boards and a
Sparkfun WM6890 breakout board.  It implements the initialization, basic
methods and some enhanced methods like 3D, ALC, soft-mute and deemphasis.
2022-04-04 16:31:17 +10:00
NitiKaur
763042a287 docs/library/stm.rst: Document the stm module. 2021-10-14 23:19:08 +11:00
NitiKaur
c42c1c8718 docs/library/random.rst: Document the random module. 2021-10-13 16:56:37 +11:00
Fernando
577a3c4192 docs/library: Fix usage of :term: for frozen module reference.
Signed-off-by: Fernando <fepegar@gmail.com>
2021-08-30 23:51:18 +10:00
Jim Mussared
53145c4c5f docs: Add docs for machine.bitstream and neopixel module.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-08-19 22:50:32 +10:00
Jim Mussared
d7fbc755dc docs/library/index.rst: Clarify module naming and purpose.
Adds section about extending built-in modules from Python.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-08-13 23:14:08 +10:00
Jim Mussared
c737cde947 docs: Replace ufoo with foo in all docs.
Anywhere a module is mentioned, use its "non-u" name for consistency.

The "import module" vs "import umodule" is something of a FAQ, and this
commit intends to help clear that up.  As a first approximation MicroPython
is Python, and so imports should work the same as Python and use the same
name, to a first approximation.  The u-version of a module is a detail that
can be learned later on, when the user wants to understand more and have
finer control over importing.

Existing Python code should just work, as much as it is possible to do that
within the constraints of embedded systems, and the MicroPython
documentation should match the idiomatic way to write Python code.

With universal weak links for modules (via MICROPY_MODULE_WEAK_LINKS) users
can consistently use "import foo" across all ports (with the exception of
the minimal ports).  And the ability to override/extend via "foo.py"
continues to work well.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-08-13 22:53:29 +10:00
Jim Mussared
218606351c docs: Rename ufoo.rst to foo.rst.
This is a simple rename of the files, no content changes
(other than updating index.rst to use the new paths)

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-08-13 20:31:32 +10:00
Julia Hathaway
6ed6990625 docs/library/zephyr: Add libraries specific to the Zephyr port.
Includes documentation for Zephyr specific modules (zephyr and zsensor),
classes (DiskAccess and FlashArea), and functions.

Signed-off-by: Julia Hathaway <julia.hathaway@nxp.com>
2021-08-13 20:21:14 +10:00
Tim Radvan
fd24e649fd docs/library: Add initial API reference for rp2 module and its classes.
All the method signatures from rp2_pio.c and friends have been taken and
converted to RST format, then explanatory notes added for each signature.

Signed-off-by: Tim Radvan <tim@tjvr.org>
2021-05-08 18:02:04 +10:00
stijn
40ad8f1666 all: Rename "sys" module to "usys".
This is consistent with the other 'micro' modules and allows implementing
additional features in Python via e.g. micropython-lib's sys.

Note this is a breaking change (not backwards compatible) for ports which
do not enable weak links, as "import sys" must now be replaced with
"import usys".
2020-09-04 00:10:24 +10:00
David Lechner
1e6d18c915 docs: Fix Sphinx 3.x warnings, and enable warnings-as-errors on build.
This enables warnings as errors and fixes all current errors, namely:

- reference to terms in the glossary must now be explicit (:term:)
- method overloads must not be declared as a separate method or must
  use :noindex:
- 2 cases where `` should have been used instead of `
2020-06-05 21:42:17 +10:00
Damien George
c99322f8d8 docs/library: Add initial docs for uasyncio module. 2020-03-26 01:25:45 +11:00
Mike Wadsten
f69ef97f24 docs: Move ubluetooth under "MicroPython-specific libraries".
CPython does not have a bluetooth module,
so it is not appropriate to call ubluetooth
a Python standard library or micro-library.
2019-10-23 11:43:01 -05:00
Jim Mussared
19e87742c4 docs/library/bluetooth: Rename to "ubluetooth". 2019-10-22 21:58:05 +11:00
Damien George
a2eea57b1d docs/library: Rename "array" module to "uarray". 2019-10-22 16:40:58 +11:00
Peter Hinch
c0b3419261 docs/library: Clarify relation between machine and port-specific mods. 2019-10-16 14:03:44 +11:00
Jim Mussared
dc82bee298 docs/library/bluetooth: Add initial BLE documentation. 2019-10-11 14:03:01 +11:00
Damien George
8a237237a3 docs: Rename machine.ADC docs to machine.ADCWiPy.
To signify that this ADC documentation is specific to the WiPy, and to make
way for a standardised ADC documentation.
2019-09-04 15:05:03 +10:00
Damien George
acd647100b docs/library: Add documentation for esp32 module. 2019-01-25 12:18:34 +11:00
Matt Trentini
69e72954ad docs: Add initial docs for esp32 port, including quick-ref and general.
With contributions from Oliver Robson (@HowManyOliversAreThere), Sean
Lanigan (@seanlano) and @rprr.
2019-01-25 12:18:34 +11:00
Damien George
d8e0320485 docs: Move WiPy specific Timer class to separate doc file.
The WiPy machine.Timer class is very different to the esp8266 and esp32
implementations which are better candidates for a general Timer class.  By
moving the WiPy Timer docs to a completely separate file, under a new name
machine.TimerWiPy, it gives a clean slate to define and write the docs for
a better, general machine.Timer class.  This is with the aim of eventually
providing documentation that does not have conditional parts to it,
conditional on the port.

While the new docs are being defined it makes sense to keep the WiPy docs,
since they describe its behaviour.  Once the new Timer behaviour is defined
the WiPy code can be changed to match it, and then the TimerWiPy docs would
be removed.
2018-07-31 23:40:06 +10:00
Damien George
5b1ca66668 docs/library/index: Add hint about using help('modules') for discovery. 2018-07-20 15:47:42 +10:00
Damien George
84d5dd46fe docs/library/index: Remove all conditionals from library index.
It's fair to just provide a link to all available modules, regardless of
the port.  Most of the existing ports (unix, stm32, esp8266, esp32) share
most of the same set of modules anyway, so no need to maintain separate
lists for them.  And there's a big discussion at the start of this index
about modules not being available on a given port.

For port-specific modules, they can also be listed unconditionally because
they have headings that explicitly state they are only available on certain
ports.
2018-07-20 15:34:22 +10:00
Paul Sokolovsky
12fde67a25 docs/ucryptolib: Add docs for new ucryptolib module. 2018-06-27 14:57:11 +10:00
Damien George
c7818032b1 docs/library: Add ussl module to library index for unix port. 2018-04-26 17:14:51 +10:00
Paul Sokolovsky
5de064fbd0 docs/library/index: Elaborate uPy libraries intro. 2017-12-23 21:21:08 +02:00
Paul Sokolovsky
579b86451d docs/_thread: Add a placeholder docs for _thread module.
Doesn't list specific API calls yet, the purpose is to let user know that
the module exists.
2017-11-10 00:09:43 +02:00
Paul Sokolovsky
64a3c52f66 docs: Consistently link to micropython-lib in glossary. 2017-08-22 09:33:31 +03:00
Paul Sokolovsky
ffb13cc633 docs/uerrno: Document "uerrno" module. 2017-07-03 00:55:09 +03:00
Paul Sokolovsky
8b7d311595 reference/index: Rewrite introduction paragraph to avoid confusion.
The old intro talked about "differences", but there were hardly any
sections describing differences, mostly MicroPython specific features.
On the other hand, we now have real "differences" chapter, though it's
mostly concerned with stdlib differences.

So, try to avoid confusion by changing wording and linking to the other
chapters and contrasting them with what is described in "MicroPython
language".
2017-07-01 22:09:40 +03:00
Paul Sokolovsky
94696973a0 docs/select: Rename to uselect, to match the actual module name.
Also, add ipoll() documentation and markup changes to comply with CPython
usage.
2017-06-16 11:28:06 +03:00
Paul Sokolovsky
d5713c8618 docs/library/index: Add important summary of the intro section as warning.
To make them harder to miss.
2017-05-15 00:26:44 +03:00
Paul Sokolovsky
bb296482c3 docs/library/btree: Add btree module docs. 2017-04-04 00:29:23 +03:00
Rami Ali
f9d18d96b7 docs/library: Add framebuf documentation. 2017-03-07 18:16:46 +11:00
Damien George
e72e343908 docs: Add documentation for lcd160cr module. 2017-01-23 14:37:10 +11:00
Paul Sokolovsky
64db4080ce docs/library/index: Elaborate on u-modules.
Also, remove an "only" directive in u-modules description.
2016-11-16 01:18:19 +03:00
Paul Sokolovsky
7219a18d17 docs/library/index: Update TOCs so builtins sorted before modules. 2016-10-30 23:13:52 +03:00
Paul Sokolovsky
fdb411a8c5 docs/library/index: Include array module in ToC. 2016-08-07 00:16:41 +03:00
Paul Sokolovsky
1d3b903eb5 docs/library/index: Add builtins.rst. 2016-06-09 00:26:44 +03:00
Damien George
ed4e5d2583 docs/library/index: Fix grammar and spelling in intro paragraph. 2016-06-02 11:05:13 +01:00
Paul Sokolovsky
09f764dc04 docs/library/index: Add intro paragraph regarding availability of modules.
This introductions makes explicit the fact that whenever possible,
the documentation describes full MicroPython functionality, and arbitrary
functions/classes/modules may be missing in a paricular port or build.
2016-06-02 00:08:07 +03:00
Paul Sokolovsky
3e33aeb0db docs: esp8266: Include ussl module in the docs. 2016-05-22 23:57:26 +03:00
Paul Sokolovsky
621c644205 docs: _io and _collections were renamed to have standard "u" prefix. 2016-05-02 14:02:54 +03:00
Paul Sokolovsky
8ebdbcfb27 docs: Add _io module reference. 2016-05-02 00:39:36 +03:00