esp32,esp8266: 添加 ESP-NOW 协议支持

ESP32、ESP8266
ESP32-S2、ESP32-S3、ESP32-C3
回复
头像
shaoziyang
帖子: 3919
注册时间: 2019年 10月 21日 13:48

esp32,esp8266: 添加 ESP-NOW 协议支持

#1

帖子 shaoziyang »

https://github.com/micropython/micropyt ... 5c30ac56d8
 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 ... spnow-4115.

c-527
帖子: 8
注册时间: 2020年 11月 4日 14:56

Re: esp32,esp8266: 添加 ESP-NOW 协议支持

#2

帖子 c-527 »

链接: https://pan.baidu.com/s/12EdM4nu5KUpggh ... A?pwd=esp3 提取码: esp3
我这里把官方带espnow的源码下载下来了,与官方1.20正式版合并在了一起,已经编译过了esp32-s2和esp32-s3的generic版本,简单测了一下是带espnow库的,有需要的可以去下载拿去用

回复

  • 随机主题
    回复总数
    阅读次数
    最新文章