From f4953c453a3b914b782c030eef3dd858b219acbd Mon Sep 17 00:00:00 2001 From: Jack Date: Wed, 21 Dec 2022 15:46:02 +0800 Subject: [PATCH] doc: add esp now changes to migration guides --- .../release-5.x/5.0/networking.rst | 20 ++++++++++++++++++ .../release-5.x/5.0/networking.rst | 21 +++++++++++++++++++ 2 files changed, 41 insertions(+) diff --git a/docs/en/migration-guides/release-5.x/5.0/networking.rst b/docs/en/migration-guides/release-5.x/5.0/networking.rst index 908f464bb7..cdf33a5e3c 100644 --- a/docs/en/migration-guides/release-5.x/5.0/networking.rst +++ b/docs/en/migration-guides/release-5.x/5.0/networking.rst @@ -3,6 +3,26 @@ Networking :link_to_translation:`zh_CN:[中文]` +Wi-Fi +***** + +Callback function type esp_now_recv_cb_t +---------------------------------------- + +Previously, the first parameter of ``esp_now_recv_cb_t`` was of type ``const uint8_t *mac_addr``, which only included the address of ESP-NOW peer device. + +This now changes. The first parameter is of type ``esp_now_recv_info_t``, which has members ``src_addr``, ``des_addr`` and ``rx_ctrl``. Therefore, the following updates are required: + + - Redefine ESP-NOW receive callback function. + + - ``src_addr`` can be used to replace original ``mac_addr``. + + - ``des_addr`` is the destination MAC address of ESP-NOW packet, which can be unitcast or broadcast address. With ``des_addr``, the user can distinguish unitcast and broadcast ESP-NOW packets where broadcast ESP-NOW packets can be non-encrypted even when encryption policy is configured for the ESP-NOW. + + - ``rx_ctrl`` is Rx control info of the ESP-NOW packet, which provides more information about the packet. + +Please refer to the ESP-NOW example: :example_file:`wifi/espnow/main/espnow_example_main.c` + Ethernet ******** diff --git a/docs/zh_CN/migration-guides/release-5.x/5.0/networking.rst b/docs/zh_CN/migration-guides/release-5.x/5.0/networking.rst index 7c4f04cb78..59cad3cbb1 100644 --- a/docs/zh_CN/migration-guides/release-5.x/5.0/networking.rst +++ b/docs/zh_CN/migration-guides/release-5.x/5.0/networking.rst @@ -3,6 +3,27 @@ :link_to_translation:`en:[English]` +Wi-Fi +***** + + +回调函数类型 esp_now_recv_cb_t +------------------------------ + +先前, ``esp_now_recv_cb_t`` 的第一个参数的类型是 ``const uint8_t *mac_addr``, 它只包含对端 ESP-NOW 设备的地址。 + +类型定义已更新。 第一个参数的类型是 ``esp_now_recv_info_t``, 它包含三个成员变量 ``src_addr``,``des_addr`` 和 ``rx_ctrl``。 因此,以下更新是需要的: + + - 重新定义的 ESP-NOW 收包回调函数。 + + - ``src_addr`` 可以等价替换原来的 ``mac_addr`` 。 + + - ``des_addr`` 是 ESP-NOW 包的目的 MAC 地址,它可以是单播地址或广播地址。有了 ``des_addr``,可以区分单播和广播的 ESP-NOW ,其中广播的 ESP-NOW 包在加密的 ESP-NOW 配置中也可以是非加密的。 + + - ``rx_ctrl`` 是 ESP-NOW 包的 Rx control info,它包含此包的更多有用信息。 + +请参考 ESP-NOW 样例::example_file:`wifi/espnow/main/espnow_example_main.c` + 以太网 **************