go-rpio/spi_test.go
2018-11-28 10:22:30 +01:00

24 lines
421 B
Go

package rpio
import ()
func ExampleSpiTransmit() {
SpiTransmit(0xFF) // send single byte
SpiTransmit(0xDE, 0xAD, 0xBE) // send several bytes
data := []byte{'H', 'e', 'l', 'l', 'o', 0}
SpiTransmit(data...) // send slice of bytes
}
func ExampleSpiBegin() {
err := SpiBegin(Spi0) // pins 7 to 11
if err != nil {
panic(err)
}
// any Spi functions must go there...
SpiTransmit(42)
SpiEnd(Spi0)
}