Chapter 2. API Reference
• ESP_OK : succeed
• ESP_ERR_ESPNOW_NOT_INIT : ESPNOW is not initialized
• ESP_ERR_ESPNOW_ARG : invalid argument
Parameters
• pmk: primary master key
esp_err_t
esp_now_set_wake_window(uint16_t window)
Set esp_now wake window for sta_disconnected power management.
Attention 1. Only when ESP_WIFI_STA_DISCONNECTED_PM_ENABLE is enabled, this configuration
could work
Attention 2. This configuration only work for station mode and disconnected status
Attention 3. If more than one module has configured its wake_window, chip would choose the largest one to
stay waked
Attention 4. If the gap between interval and window is smaller than 5ms, the chip would keep waked all the
time
Attention 5. If never configured wake_window, the chip would keep waked at disconnected once it uses
esp_now
Return
• ESP_OK : succeed
• ESP_ERR_ESPNOW_NOT_INIT : ESPNOW is not initialized
Parameters
• window: how much microsecond would the chip keep waked each interval, vary from 0 to 65535
Structures
struct esp_now_peer_info
ESPNOW peer information parameters.
Public Members
uint8_t peer_addr[ESP_NOW_ETH_ALEN]
ESPNOW peer MAC address that is also the MAC address of station or softap
uint8_t lmk[ESP_NOW_KEY_LEN]
ESPNOW peer local master key that is used to encrypt data
uint8_t channel
Wi-Fi channel that peer uses to send/receive ESPNOW data. If the value is 0, use the current channel
which station or softap is on. Otherwise, it must be set as the channel that station or softap is on.
wifi_interface_t
ifidx
Wi-Fi interface that peer uses to send/receive ESPNOW data
bool encrypt
ESPNOW data that this peer sends/receives is encrypted or not
void *priv
ESPNOW peer private data
struct esp_now_peer_num
Number of ESPNOW peers which exist currently.
Public Members
int total_num
Total number of ESPNOW peers, maximum value is ESP_NOW_MAX_TOTAL_PEER_NUM
int encrypt_num
Number of encrypted ESPNOW peers, maximum value is ESP_NOW_MAX_ENCRYPT_PEER_NUM
Espressif Systems
133
Submit Document Feedback
Release v4.4
Need help?
Do you have a question about the ESP32-S2 and is the answer not in the manual?
Questions and answers