2018-10-05 15:23:51 +02:00
|
|
|
package rpio
|
|
|
|
|
|
|
|
import ()
|
|
|
|
|
2018-10-05 17:04:53 +02:00
|
|
|
func ExampleSpiTransmit() {
|
|
|
|
SpiTransmit(0xFF) // send single byte
|
|
|
|
SpiTransmit(0xDE, 0xAD, 0xBE) // send several bytes
|
2018-10-05 15:23:51 +02:00
|
|
|
|
2018-10-05 17:04:53 +02:00
|
|
|
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)
|
|
|
|
}
|
2018-10-05 15:23:51 +02:00
|
|
|
|
2018-10-05 17:04:53 +02:00
|
|
|
// any Spi functions must go there...
|
|
|
|
SpiTransmit(42)
|
2018-10-05 15:23:51 +02:00
|
|
|
|
2018-10-05 17:04:53 +02:00
|
|
|
SpiEnd(Spi0)
|
2018-10-05 15:23:51 +02:00
|
|
|
}
|