-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Support different SPI devices. #509
Comments
There is a problem with reading SPI data that I am currently working on. There is a very high probability of Gobot changing out the SPI API, which will fix the devices, but break the API for device implementors. One of the needed changes would accommodate setting both the device bus ID, and chip ID. This would address your particular concerns, @bodokaiser More soon... |
Hi @bodokaiser please take a look at the All the the spi drivers now support optional params. You can now set the specific device bus and chip like this: a := raspi.NewAdaptor()
adc := spi.NewMCP3008Driver(a, spi.WithBus(1), spi.WithChip(0)) Which should give you access to Please give it a try, your feedback is appreciated. |
I can confirm that package main
import (
"log"
"gobot.io/x/gobot/platforms/beaglebone"
)
func main() {
beagle := beaglebone.NewAdaptor()
c, err := beagle.GetSpiConnection(1, 0, 0, 8, 5e6)
if err != nil {
log.Fatal(err)
}
w := []byte{
8, 0, 0,
1, 3, 64, 8, 32,
14, 63, 255, 0, 0, 1, 137, 0, 0,
0, 0, 128, 2, 2,
9, 0, 0, 255, 252,
7, 1, 137, 0, 0,
}
r := make([]byte, len(w))
err = c.Tx(w, r)
if err != nil {
log.Fatal(err)
}
log.Printf("%v", r)
} works as expected. Thank you! |
This has now been released as part of v1.10.0 so now closing this issue. Thanks everyone! |
I would like to use the
/dev/spidev1.0
(which works with python) but gobot only supports/dev/spidev0.0
and/dev/spidev0.1
.I can access
/dev/spidev1.0
if I change the device path here.To support different spi devices I would suggest to add another
device int
parameter toGetSpiConnection()
, however this would break API compatibility.The text was updated successfully, but these errors were encountered: