|
|
@@ -1,6 +1,10 @@
|
|
|
#ifndef _ESPNOW_SERIAL_H_
|
|
|
#define _ESPNOW_SERIAL_H_
|
|
|
|
|
|
+#include "soc/soc_caps.h"
|
|
|
+#include "sdkconfig.h"
|
|
|
+#if SOC_WIFI_SUPPORTED || CONFIG_ESP_HOSTED_ENABLED
|
|
|
+
|
|
|
#include <Stream.h>
|
|
|
#include <WiFi.h>
|
|
|
#include <esp_wifi.h>
|
|
|
@@ -132,6 +136,7 @@ public:
|
|
|
|
|
|
private:
|
|
|
|
|
|
+#if !defined(ARDUINO_CORE_3X)
|
|
|
/**
|
|
|
* @brief ESP-NOW send-complete callback.
|
|
|
*
|
|
|
@@ -151,6 +156,25 @@ private:
|
|
|
static void _on_data_recv(const uint8_t *mac_addr,
|
|
|
const uint8_t *data,
|
|
|
int len);
|
|
|
+#else // ARDUINO_CORE_3X
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @brief Callback function of sending ESPNOW data
|
|
|
+ * @param tx_info Sending information for ESPNOW data
|
|
|
+ * @param status status of sending ESPNOW data (succeed or fail).
|
|
|
+ */
|
|
|
+ static void _on_data_sent(const esp_now_send_info_t *tx_info, esp_now_send_status_t status);
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @brief Callback function of receiving ESPNOW data
|
|
|
+ * @param esp_now_info received ESPNOW packet information
|
|
|
+ * @param data received data
|
|
|
+ * @param data_len length of received data
|
|
|
+ * @attention esp_now_info is a local variable,it can only be used in the callback.
|
|
|
+ */
|
|
|
+ static void _on_data_recv(const esp_now_recv_info_t * esp_now_info, const uint8_t *data, int data_len);
|
|
|
+
|
|
|
+#endif // ARDUINO_CORE_3X
|
|
|
|
|
|
wifi_mode_t _wifi_mode; ///< Configured WiFi mode
|
|
|
wifi_interface_t _wifi_if; ///< WiFi interface in use
|
|
|
@@ -165,4 +189,8 @@ private:
|
|
|
IoQueue<ESP_NOW_MAX_DATA_LEN> _rx_queue; ///< Internal RX buffer
|
|
|
};
|
|
|
|
|
|
+
|
|
|
+#endif /* SOC_WIFI_SUPPORTED */
|
|
|
+
|
|
|
+
|
|
|
#endif // _ESPNOW_SERIAL_H_
|