-
Notifications
You must be signed in to change notification settings - Fork 33
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
Serial Interface Update Question #18
Comments
You mention Connect, you mean https://pkg.go.dev/periph.io/x/conn/v3/uart#Port ? I'm confused because you refer to 1-wire but the 1-wire API doesn't have a Connect() function; https://pkg.go.dev/periph.io/x/conn/v3/onewire This is because UART is a Port, and 1-wire is a Bus. |
Sorry for the confusion. I'll try to clarify. I am interested in doing is bringing support in for the ds2480 chip (serial <-> 1-wire adapter chip). For our purposes, only the serial side of the chip is of concern. I looked at the Port interface but it doesn't seem flexible enough to support the ds2480 chip for a few reasons:
This interface: https://pkg.go.dev/go.bug.st/serial#pkg-types does a pretty good job of showing the different features a serial interface needs. Specifically, the methods I am using from that interface that don't appear to have equivalents are:
The ds2480 driver code needs to change the serial port to operate & needs an interface to be portable to all the supported serial implementations. |
Oh ok so it would work over UART instead of I2C like https://pkg.go.dev/periph.io/x/devices/v3/ds248x does? |
Yes, that's right. Sorry for the delay - I missed the update email & just saw your post. |
The serial port sub-system was mentioned as one that you're ok bringing in other implementations.
I'm presently using this one as the basis for a ds2480 1-wire chip: https://github.com/bugst/go-serial. Based on my searching this seems to be the best cross-platform, no cgo version around.
I'm curious how you envision supporting other impls. I think the
conn.Conn
interface works for most simple serial devices, but theConnect()
function may not be enough to support devices like a ds2480, where uart focused changes need to happen on the fly.If there is a set of interfaces that are the right ones for implementing as external serial port adapters, then it will be pretty easy to write a small adapter library. The adapter can be external to the host project (like
periph/bugst-serial-adapter
) that can adapt the two & allow for the drivers & that logic to live in periph/drivers.I'm happy to do the coding for these two things (ds2480 and the bugst/go-serial bridge) as long as I know what you want it to look like & you're cool with the approach.
The text was updated successfully, but these errors were encountered: