mirror of
https://github.com/kidoman/embd
synced 2024-12-21 20:30:05 +01:00
spi: code fixes in samples
This commit is contained in:
parent
5965ddf789
commit
bb82613c64
@ -13,6 +13,13 @@ import (
|
||||
_ "github.com/kidoman/embd/host/all"
|
||||
)
|
||||
|
||||
const (
|
||||
channel = 0
|
||||
speed = 1000000
|
||||
bpw = 8
|
||||
delay = 0
|
||||
)
|
||||
|
||||
func main() {
|
||||
flag.Parse()
|
||||
fmt.Println("this is a sample code for mcp3008 10bit 8 channel ADC")
|
||||
@ -22,10 +29,6 @@ func main() {
|
||||
}
|
||||
defer embd.CloseSPI()
|
||||
|
||||
channel := 0
|
||||
speed := 1000000
|
||||
bpw := 8
|
||||
delay := 0
|
||||
spiBus := embd.NewSPIBus(embd.SPIMode0, channel, speed, bpw, delay)
|
||||
defer spiBus.Close()
|
||||
|
||||
|
@ -11,6 +11,13 @@ import (
|
||||
_ "github.com/kidoman/embd/host/all"
|
||||
)
|
||||
|
||||
const (
|
||||
channel = 0
|
||||
speed = 1000000
|
||||
bpw = 8
|
||||
delay = 0
|
||||
)
|
||||
|
||||
func main() {
|
||||
flag.Parse()
|
||||
if err := embd.InitSPI(); err != nil {
|
||||
@ -18,10 +25,6 @@ func main() {
|
||||
}
|
||||
defer embd.CloseSPI()
|
||||
|
||||
channel := 0
|
||||
speed := 1000000
|
||||
bpw := 8
|
||||
delay := 0
|
||||
bus := embd.NewSPIBus(embd.SPIMode0, channel, speed, bpw, delay)
|
||||
defer bus.Close()
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user