ESP32 以太网:如何获取当前链路双工状态
这是你如何使用 ESP-IDF 框架在 ESP32 上获取以太网连接的当前链路速度。
eth_duplex_example.cpp
#include <esp_eth.h>
// 获取双工模式
eth_duplex_t duplex_mode;
if (esp_eth_ioctl(eth_handle, ETH_CMD_G_DUPLEX_MODE, &duplex_mode) == ESP_OK) {
const char* duplex_str = (duplex_mode == ETH_DUPLEX_HALF) ? "Half Duplex" : "Full Duplex";
ESP_LOGI(TAG, "Ethernet Duplex: %s", duplex_str);
}If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow