8000 esp/espnow: Support for the Espressif ESP-NOW protocol. · glenn20/micropython@cf4d99b · GitHub
[go: up one dir, main page]

Skip to content

Commit cf4d99b

Browse files
committed
esp/espnow: Support for the Espressif ESP-NOW protocol.
- Micropython v1.13 - v1.19 compatible - Use (extended) ring buffers in py/ringbuf.[ch] for robust IO. - Signal strength (RSSI) monitoring (see ESPNow.peers). - Core support in "_espnow" C module (extended by espnow.py module). - Asyncio support via aioespnow.py module. - Docs provided at docs/library/espnow.rst. - PR6515. Methods in espnow.ESPNow class (modules/espnow.py): - active(True/False) - config(): set rx buffer size, read timeout and tx rate. - recv()/irecv() to read incoming messages from peers. - send() to send messages to peer devices - any() to test if a message is ready to read. - irq()/on_recv() 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, ...): register peer before sending messages. - get_peer(mac): Return peer info: (mac,lmk,channel,ifidx,encrypt) - mod_peer(mac, ...) to change peer info parameters. - get_peers(): to return all peer info tuples. - peers_table: to support RSSI signal monitoring for received messages: {peer1: [rssi, time_ms], peer2: [rssi, time_ms], ...} aioespnow.AIOESPNow class provides coroutines: - airecv(), arecv() and asend(). 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. Add constants as attributes of the espnow module: - espnow.MAX_DATA_LEN (=ESP_NOW_MAX_DATA_LEN) (250) - espnow.KEY_LEN (=ESP_NOW_KEY_LEN) (16) - espnow.MAX_TOTAL_PEER_NUM (=ESP_NOW_MAX_TOTAL_PEER_NUM) (20) - espnow.MAX_ENCRYPT_PEER_NUM (=ESP_NOW_MAX_ENCRYPT_PEER_NUM) (6) - espnow.ESP_NOW_ETH_ALEN (=ESP_NOW_ETH_ALEN) (6) Test suite in tests/multi_espnow: - Tests basic espnow data transfer, multiple transfers various message sizes, encrypted messages (pmk and lmk), asyncio support. Initial PR at: micropython#4115. Initial import of code from: https://github.com/nickzoic/micropython/tree/espnow-4115. Including contributions from @nickzoic @shawwwn and @zoland. esp32/8266: WLAN(): add support for set/get wifi power saving mode. For esp32 and esp8266: adds: - 'pm' option to WLAN.config() to set/get the wifi power saving mode; and - PM_NONE, PM_MIN_MODEM, PM_MAX_MODEM and PM_LIGHT_SLEEP (eps8266 only) constants to the WLAN class.
1 parent bb77c1d commit cf4d99b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+3841
-4
lines changed

docs/library/esp.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,13 @@ The ``esp`` module contains specific functions related to both the ESP8266 and
88
ESP32 modules. Some functions are only available on one or the other of these
99
ports.
1010

11+
Modules
12+
-------
13+
14+
.. toctree::
15+
:maxdepth: 1
16+
17+
espnow.rst
1118

1219
Functions
1320
---------

0 commit comments

Comments
 (0)
0