mirror of
https://github.com/stianeikeland/go-rpio.git
synced 2025-01-23 02:31:05 +01:00
Use v4 modules version in examples
This commit is contained in:
parent
6ea7dcc05f
commit
96203992c9
|
@ -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"
|
||||||
)
|
)
|
||||||
|
|
|
@ -15,7 +15,7 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/stianeikeland/go-rpio"
|
"github.com/stianeikeland/go-rpio/v4"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
|
@ -2,7 +2,7 @@ package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/stianeikeland/go-rpio"
|
"github.com/stianeikeland/go-rpio/v4"
|
||||||
"os"
|
"os"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -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() {
|
||||||
|
|
|
@ -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
2
go.mod
|
@ -1,3 +1,3 @@
|
||||||
module github.com/stianeikeland/go-rpio/v4
|
module github.com/stianeikeland/go-rpio/v4
|
||||||
|
|
||||||
go 1.13
|
go 1.15
|
||||||
|
|
Loading…
Reference in New Issue
Block a user