Use v4 modules version in examples

This commit is contained in:
Draho 2021-08-19 03:39:30 +02:00
parent 6ea7dcc05f
commit 96203992c9
7 changed files with 8 additions and 12 deletions

View File

@ -12,7 +12,7 @@ package main
import ( import (
"fmt" "fmt"
"github.com/stianeikeland/go-rpio" "github.com/stianeikeland/go-rpio/v4"
"os" "os"
"time" "time"
) )

View File

@ -15,7 +15,7 @@ import (
"os" "os"
"time" "time"
"github.com/stianeikeland/go-rpio" "github.com/stianeikeland/go-rpio/v4"
) )
var ( var (

View File

@ -2,7 +2,7 @@ package main
import ( import (
"fmt" "fmt"
"github.com/stianeikeland/go-rpio" "github.com/stianeikeland/go-rpio/v4"
"os" "os"
) )

View File

@ -12,7 +12,7 @@ package main
import ( import (
"os" "os"
"time" "time"
"github.com/stianeikeland/go-rpio" "github.com/stianeikeland/go-rpio/v4"
) )
func main() { func main() {

View File

@ -7,7 +7,7 @@ SPI example
package main package main
import ( import (
"github.com/stianeikeland/go-rpio" "github.com/stianeikeland/go-rpio/v4"
"fmt" "fmt"
) )
@ -22,22 +22,18 @@ func main() {
rpio.SpiChipSelect(0) // Select CE0 slave rpio.SpiChipSelect(0) // Select CE0 slave
// Send // Send
rpio.SpiTransmit(0xFF) // send single byte rpio.SpiTransmit(0xFF) // send single byte
rpio.SpiTransmit(0xDE, 0xAD, 0xBE) // send several bytes rpio.SpiTransmit(0xDE, 0xAD, 0xBE) // send several bytes
data := []byte{'H', 'e', 'l', 'l', 'o', 0} data := []byte{'H', 'e', 'l', 'l', 'o', 0}
rpio.SpiTransmit(data...) // send slice of bytes rpio.SpiTransmit(data...) // send slice of bytes
// Receive // Receive
received := rpio.SpiReceive(5) // receive 5 bytes, (sends 5 x 0s) received := rpio.SpiReceive(5) // receive 5 bytes, (sends 5 x 0s)
fmt.Println(received) fmt.Println(received)
// Send & Receive // Send & Receive
buffer := []byte{ 0xDE, 0xED, 0xBE, 0xEF } buffer := []byte{ 0xDE, 0xED, 0xBE, 0xEF }

2
go.mod
View File

@ -1,3 +1,3 @@
module github.com/stianeikeland/go-rpio/v4 module github.com/stianeikeland/go-rpio/v4
go 1.13 go 1.15

0
go.sum Normal file
View File