Skip to content

Ethernet.MACAddress should be a getter, not setter #81

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

Closed
JAndrassy opened this issue Dec 24, 2023 · 5 comments · Fixed by #89
Closed

Ethernet.MACAddress should be a getter, not setter #81

JAndrassy opened this issue Dec 24, 2023 · 5 comments · Fixed by #89
Labels
Milestone

Comments

@JAndrassy
Copy link
Contributor

Ethernet.MACAddress should be a getter, not setter

https://github.com./arduino-libraries/Ethernet/blob/39103da0e1bc569023625ee4693272773397dbb6/src/Ethernet.cpp#L147-L153

void EthernetClass::MACAddress(uint8_t *mac_address)
{
	SPI.beginTransaction(SPI_ETHERNET_SETTINGS);
	W5100.getMACAddress(mac_address);
	SPI.endTransaction();
}
@JAndrassy JAndrassy added the bug label Dec 24, 2023
@sstaub
Copy link
Contributor

sstaub commented Dec 24, 2023

I'm confused, what is the problem for this library? You mention the Arduino Ethernet library which uses the WIZnet chips.

@JAndrassy
Copy link
Contributor Author

in this library it is a setter. that is wrong

@sstaub
Copy link
Contributor

sstaub commented Dec 24, 2023

Have a look to the documentation. The implementation is different to the original Arduino library. This is necessary to override builtin mac address.

@fpistm
Copy link
Member

fpistm commented Dec 24, 2023

@fpistm fpistm removed the bug label Dec 24, 2023
@JAndrassy
Copy link
Contributor Author

JAndrassy commented Dec 24, 2023

isn't Arduino about using same functions on different hardware? at least functions with the same name should do the same thing.

Arduino Ethernet libraries have MACAddress and WiFi libraries have macAddress as a getter, as a way to read the MAC address. I few libraries have setMACAddress, but usually the way to set the MAC address in Ethernet library is the first parameter of begin

A few months back I stared to write down all my experience with creating and maintaining Arduino networking libraries, because new libraries appear and have the same mistakes I try to eliminate in old libraries. But writing the Guide let to necessity of defining the networking API by analyzing the significant libraries. I found many often simple differences so I started to do PR in all repositories. Then I wrote test sketches for basic functions and those found more errors in implementations than I would expect (even in my libraries.). So more PR.

https://github.com./JAndrassy/Arduino-Networking-API

@fpistm fpistm added this to the 1.4.1/1.5.0 milestone Jan 3, 2024
fpistm added a commit to fpistm/STM32Ethernet that referenced this issue Sep 11, 2024
fpistm added a commit to fpistm/STM32Ethernet that referenced this issue Sep 11, 2024
@github-project-automation github-project-automation bot moved this from To do to Done in STM32duino libraries Sep 11, 2024
@fpistm fpistm added arduino compatibility enhancement New feature or request labels Sep 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Development

Successfully merging a pull request may close this issue.

3 participants