mirror of
https://github.com/stianeikeland/go-rpio.git
synced 2025-01-22 18:21:04 +01:00
Use v4 modules version in examples
This commit is contained in:
parent
6ea7dcc05f
commit
96203992c9
|
@ -12,7 +12,7 @@ package main
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/stianeikeland/go-rpio"
|
||||
"github.com/stianeikeland/go-rpio/v4"
|
||||
"os"
|
||||
"time"
|
||||
)
|
||||
|
|
|
@ -15,7 +15,7 @@ import (
|
|||
"os"
|
||||
"time"
|
||||
|
||||
"github.com/stianeikeland/go-rpio"
|
||||
"github.com/stianeikeland/go-rpio/v4"
|
||||
)
|
||||
|
||||
var (
|
||||
|
|
|
@ -2,7 +2,7 @@ package main
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/stianeikeland/go-rpio"
|
||||
"github.com/stianeikeland/go-rpio/v4"
|
||||
"os"
|
||||
)
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ package main
|
|||
import (
|
||||
"os"
|
||||
"time"
|
||||
"github.com/stianeikeland/go-rpio"
|
||||
"github.com/stianeikeland/go-rpio/v4"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
|
|
@ -7,7 +7,7 @@ SPI example
|
|||
package main
|
||||
|
||||
import (
|
||||
"github.com/stianeikeland/go-rpio"
|
||||
"github.com/stianeikeland/go-rpio/v4"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
|
@ -22,22 +22,18 @@ func main() {
|
|||
|
||||
rpio.SpiChipSelect(0) // Select CE0 slave
|
||||
|
||||
|
||||
// Send
|
||||
|
||||
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}
|
||||
rpio.SpiTransmit(data...) // send slice of bytes
|
||||
rpio.SpiTransmit(data...) // send slice of bytes
|
||||
|
||||
|
||||
// Receive
|
||||
|
||||
received := rpio.SpiReceive(5) // receive 5 bytes, (sends 5 x 0s)
|
||||
fmt.Println(received)
|
||||
|
||||
|
||||
// Send & Receive
|
||||
|
||||
buffer := []byte{ 0xDE, 0xED, 0xBE, 0xEF }
|
||||
|
|
Loading…
Reference in New Issue
Block a user