|
ESP8266_RTOS_SDK
v1.4.0
|
ESP-NOW APIs. More...
Typedefs | |
| typedef void(* | esp_now_recv_cb_t) (uint8 *mac_addr, uint8 *data, uint8 len) |
| ESP-NOW send callback. More... | |
| typedef void(* | esp_now_send_cb_t) (uint8 *mac_addr, uint8 status) |
| ESP-NOW send callback. More... | |
Enumerations | |
| enum | esp_now_role { ESP_NOW_ROLE_IDLE = 0, ESP_NOW_ROLE_CONTROLLER, ESP_NOW_ROLE_SLAVE, ESP_NOW_ROLE_MAX } |
Functions | |
| sint32 | esp_now_init (void) |
| ESP-NOW initialization. More... | |
| sint32 | esp_now_deinit (void) |
| Deinitialize ESP-NOW. More... | |
| sint32 | esp_now_register_send_cb (esp_now_send_cb_t cb) |
| Register ESP-NOW send callback. More... | |
| sint32 | esp_now_unregister_send_cb (void) |
| Unregister ESP-NOW send callback. More... | |
| sint32 | esp_now_register_recv_cb (esp_now_recv_cb_t cb) |
| Register ESP-NOW receive callback. More... | |
| sint32 | esp_now_unregister_recv_cb (void) |
| Unregister ESP-NOW receive callback. More... | |
| sint32 | esp_now_send (uint8 *da, uint8 *data, uint8 len) |
| Send ESP-NOW packet. More... | |
| sint32 | esp_now_add_peer (uint8 *mac_addr, uint8 role, uint8 channel, uint8 *key, uint8 key_len) |
| Add an ESP-NOW peer, store MAC address of target device into ESP-NOW MAC list. More... | |
| sint32 | esp_now_del_peer (uint8 *mac_addr) |
| Delete an ESP-NOW peer, delete MAC address of the device from ESP-NOW MAC list. More... | |
| sint32 | esp_now_set_self_role (uint8 role) |
| Set ESP-NOW role of device itself. More... | |
| sint32 | esp_now_get_self_role (void) |
| Get ESP-NOW role of device itself. More... | |
| sint32 | esp_now_set_peer_role (uint8 *mac_addr, uint8 role) |
| Set ESP-NOW role for a target device. If it is set multiple times, new role will cover the old one. More... | |
| sint32 | esp_now_get_peer_role (uint8 *mac_addr) |
| Get ESP-NOW role of a target device. More... | |
| sint32 | esp_now_set_peer_channel (uint8 *mac_addr, uint8 channel) |
| Record channel information of a ESP-NOW device. More... | |
| sint32 | esp_now_get_peer_channel (uint8 *mac_addr) |
| Get channel information of a ESP-NOW device. More... | |
| sint32 | esp_now_set_peer_key (uint8 *mac_addr, uint8 *key, uint8 key_len) |
| Set ESP-NOW key for a target device. More... | |
| sint32 | esp_now_get_peer_key (uint8 *mac_addr, uint8 *key, uint8 *key_len) |
| Get ESP-NOW key of a target device. More... | |
| uint8 * | esp_now_fetch_peer (bool restart) |
| Get MAC address of ESP-NOW device. More... | |
| sint32 | esp_now_is_peer_exist (uint8 *mac_addr) |
| Check if target device exists or not. More... | |
| sint32 | esp_now_get_cnt_info (uint8 *all_cnt, uint8 *encrypt_cnt) |
| Get the total number of ESP-NOW devices which are associated, and the number count of encrypted devices. More... | |
| sint32 | esp_now_set_kok (uint8 *key, uint8 len) |
| Set the encrypt key of communication key. More... | |
ESP-NOW APIs.
| typedef void(* esp_now_recv_cb_t) (uint8 *mac_addr, uint8 *data, uint8 len) |
ESP-NOW send callback.
| uint8 | *mac_addr : MAC address of target device |
| uint8 | *data : data received |
| uint8 | len : data length |
| typedef void(* esp_now_send_cb_t) (uint8 *mac_addr, uint8 status) |
ESP-NOW send callback.
| uint8 | *mac_addr : MAC address of target device |
| uint8 | status : status of ESP-NOW sending packet, 0, OK; 1, fail. |
| sint32 esp_now_add_peer | ( | uint8 * | mac_addr, |
| uint8 | role, | ||
| uint8 | channel, | ||
| uint8 * | key, | ||
| uint8 | key_len | ||
| ) |
Add an ESP-NOW peer, store MAC address of target device into ESP-NOW MAC list.
| uint8 | *mac_addr : MAC address of device |
| uint8 | role : role type of device, enum esp_now_role |
| uint8 | channel : channel of device |
| uint8 | *key : 16 bytes key which is needed for ESP-NOW communication |
| uint8 | key_len : length of key, has to be 16 bytes now |
| sint32 esp_now_deinit | ( | void | ) |
Deinitialize ESP-NOW.
| null |
| sint32 esp_now_del_peer | ( | uint8 * | mac_addr | ) |
Delete an ESP-NOW peer, delete MAC address of the device from ESP-NOW MAC list.
| u8 | *mac_addr : MAC address of device |
| uint8* esp_now_fetch_peer | ( | bool | restart | ) |
Get MAC address of ESP-NOW device.
Get MAC address of ESP-NOW device which is pointed now, and move the pointer to next one in ESP-NOW MAC list or move the pointer to the first one in ESP-NOW MAC list.
| bool | restart : true, move pointer to the first one in ESP-NOW MAC list; false, move pointer to the next one in ESP-NOW MAC list |
| sint32 esp_now_get_cnt_info | ( | uint8 * | all_cnt, |
| uint8 * | encrypt_cnt | ||
| ) |
Get the total number of ESP-NOW devices which are associated, and the number count of encrypted devices.
| uint8 | *all_cnt : total number of ESP-NOW devices which are associated. |
| uint8 | *encryp_cnt : number count of encrypted devices |
| sint32 esp_now_get_peer_channel | ( | uint8 * | mac_addr | ) |
Get channel information of a ESP-NOW device.
| uint8 | *mac_addr : MAC address of target device. |
| sint32 esp_now_get_peer_key | ( | uint8 * | mac_addr, |
| uint8 * | key, | ||
| uint8 * | key_len | ||
| ) |
Get ESP-NOW key of a target device.
If it is set multiple times, new key will cover the old one.
| uint8 | *mac_addr : MAC address of target device. |
| uint8 | *key : pointer of key, buffer size has to be 16 bytes at least |
| uint8 | key_len : key length |
| sint32 esp_now_get_peer_role | ( | uint8 * | mac_addr | ) |
Get ESP-NOW role of a target device.
| uint8 | *mac_addr : MAC address of device. |
| sint32 esp_now_get_self_role | ( | void | ) |
Get ESP-NOW role of device itself.
| uint8 | role : role type of device, enum esp_now_role. |
| sint32 esp_now_init | ( | void | ) |
ESP-NOW initialization.
| null |
| sint32 esp_now_is_peer_exist | ( | uint8 * | mac_addr | ) |
Check if target device exists or not.
| uint8 | *mac_addr : MAC address of target device. |
| sint32 esp_now_register_recv_cb | ( | esp_now_recv_cb_t | cb | ) |
Register ESP-NOW receive callback.
| esp_now_recv_cb_t | cb : receive callback |
| sint32 esp_now_register_send_cb | ( | esp_now_send_cb_t | cb | ) |
Register ESP-NOW send callback.
| esp_now_send_cb_t | cb : send callback |
| sint32 esp_now_send | ( | uint8 * | da, |
| uint8 * | data, | ||
| uint8 | len | ||
| ) |
Send ESP-NOW packet.
| uint8 | *da : destination MAC address. If it's NULL, send packet to all MAC addresses recorded by ESP-NOW; otherwise, send packet to target MAC address. |
| uint8 | *data : data need to send |
| uint8 | len : data length |
| sint32 esp_now_set_kok | ( | uint8 * | key, |
| uint8 | len | ||
| ) |
Set the encrypt key of communication key.
All ESP-NOW devices share the same encrypt key. If users do not set the encrypt key, ESP-NOW communication key will be encrypted by a default key.
| uint8 | *key : pointer of encrypt key. |
| uint8 | len : key length, has to be 16 bytes now. |
| sint32 esp_now_set_peer_channel | ( | uint8 * | mac_addr, |
| uint8 | channel | ||
| ) |
Record channel information of a ESP-NOW device.
When communicate with this device,
| uint8 | *mac_addr : MAC address of target device. |
| uint8 | channel : channel, usually to be 1 ~ 13, some area may use channel 14. |
| sint32 esp_now_set_peer_key | ( | uint8 * | mac_addr, |
| uint8 * | key, | ||
| uint8 | key_len | ||
| ) |
Set ESP-NOW key for a target device.
If it is set multiple times, new key will cover the old one.
| uint8 | *mac_addr : MAC address of target device. |
| uint8 | *key : 16 bytes key which is needed for ESP-NOW communication, if it is NULL, current key will be reset to be none. |
| uint8 | key_len : key length, has to be 16 bytes now |
| sint32 esp_now_set_peer_role | ( | uint8 * | mac_addr, |
| uint8 | role | ||
| ) |
Set ESP-NOW role for a target device. If it is set multiple times, new role will cover the old one.
| uint8 | *mac_addr : MAC address of device. |
| uint8 | role : role type, enum esp_now_role. |
| sint32 esp_now_set_self_role | ( | uint8 | role | ) |
Set ESP-NOW role of device itself.
| uint8 | role : role type of device, enum esp_now_role. |
| sint32 esp_now_unregister_recv_cb | ( | void | ) |
Unregister ESP-NOW receive callback.
| null |
| sint32 esp_now_unregister_send_cb | ( | void | ) |
Unregister ESP-NOW send callback.
| null |
1.8.10