-
Notifications
You must be signed in to change notification settings - Fork 230
feat: add w5500 driver #788
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
base: dev
Are you sure you want to change the base?
Conversation
w5500/w5500.go
Outdated
// | ||
// The SPI bus must be fully configured. | ||
type Config struct { | ||
SPI drivers.SPI |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe we usually pass things like drivers.SPI
and pins into New()
method, instead of having them in Config struct.
w5500/w5500.go
Outdated
sockets []*socket | ||
laddr netip.Addr | ||
|
||
cmdBuf []byte |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cmdBuf []byte | |
cmdBuf [3]byte |
and then make()
can be dropped in New()
type Resolver func(host string) (netip.Addr, error) | ||
|
||
// PinOutput is a function that sets a pin high or low. | ||
type PinOutput func(level bool) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You may want to wait for #753 be merged and use PinOutput defined in drivers
package then.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Happy to wait if that is what you feel is best.
This adds a driver for the w5500 ethernet chip:
https://docs.wiznet.io/img/products/w5500/W5500_ds_v110e.pdf
While it uses interrupts, it does not use the interrupt pin as there is currently no way to implement a timed wait (something akin to a Futex). For this reason it is not as fast as it could be.
It also does not attempt to tackle DNS, just copping out and allowing the user to set a resolver when they configure the device.
I tried to abide by your Driver guide, let me know if anything is amiss.