Skip to content

Conversation

nrwiersma
Copy link

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.

w5500/w5500.go Outdated
//
// The SPI bus must be fully configured.
type Config struct {
SPI drivers.SPI
Copy link
Contributor

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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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)
Copy link
Contributor

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.

Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants