Skip to content

feat(eth): Add setters for negotiation, speed and duplex modes #11053

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 10, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
ci(pre-commit): Apply automatic fixes
  • Loading branch information
pre-commit-ci-lite[bot] authored Mar 10, 2025
commit 922ef56da5ef1884b3addff3c85cc8ec36257a7a
4 changes: 2 additions & 2 deletions libraries/Ethernet/src/ETH.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1014,7 +1014,7 @@ bool ETHClass::setFullDuplex(bool on) {
if (_eth_handle == NULL) {
return false;
}
eth_duplex_t link_duplex = on?ETH_DUPLEX_FULL:ETH_DUPLEX_HALF;
eth_duplex_t link_duplex = on ? ETH_DUPLEX_FULL : ETH_DUPLEX_HALF;
esp_err_t err = esp_eth_ioctl(_eth_handle, ETH_CMD_S_DUPLEX_MODE, &link_duplex);
if (err != ESP_OK) {
log_e("Failed to set duplex mode: 0x%x: %s", err, esp_err_to_name(err));
Expand Down Expand Up @@ -1064,7 +1064,7 @@ bool ETHClass::setLinkSpeed(uint16_t speed) {
if (_eth_handle == NULL) {
return false;
}
eth_speed_t link_speed = (speed == 10)?ETH_SPEED_10M:ETH_SPEED_100M;
eth_speed_t link_speed = (speed == 10) ? ETH_SPEED_10M : ETH_SPEED_100M;
esp_err_t err = esp_eth_ioctl(_eth_handle, ETH_CMD_S_SPEED, &link_speed);
if (err != ESP_OK) {
log_e("Failed to set link speed: 0x%x: %s", err, esp_err_to_name(err));
Expand Down
4 changes: 2 additions & 2 deletions libraries/Ethernet/src/ETH.h
Original file line number Diff line number Diff line change
Expand Up @@ -193,9 +193,9 @@ class ETHClass : public NetworkInterface {
// ETH Handle APIs
bool fullDuplex() const;
bool setFullDuplex(bool on);

uint16_t linkSpeed() const;
bool setLinkSpeed(uint16_t speed);//10 or 100
bool setLinkSpeed(uint16_t speed); //10 or 100

bool autoNegotiation() const;
bool setAutoNegotiation(bool on);
Expand Down
Loading