diff --git a/samples/mcp3008.go b/samples/mcp3008.go index 368d9ee..791d56a 100644 --- a/samples/mcp3008.go +++ b/samples/mcp3008.go @@ -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() diff --git a/samples/spimcp3008.go b/samples/spimcp3008.go index 045106c..efff661 100644 --- a/samples/spimcp3008.go +++ b/samples/spimcp3008.go @@ -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()