ESP32 以太网:如何获取当前链路速度
这是你如何使用 ESP-IDF 框架在 ESP32 上获取以太网连接的当前链路速度。
esp_eth_get_speed.cpp
#include <esp_eth.h>
// 获取链路速度
eth_speed_t link_speed;
if (esp_eth_ioctl(eth_handle, ETH_CMD_G_SPEED, &link_speed) == ESP_OK) {
const char* speed_str = (link_speed == ETH_SPEED_10M) ? "10 Mbps" :
(link_speed == ETH_SPEED_100M) ? "100 Mbps" : "1000 Mbps";
ESP_LOGI(TAG, "Ethernet Speed: %s", speed_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