You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
477 B
Go
35 lines
477 B
Go
package rfm69
|
|
|
|
import (
|
|
"log"
|
|
|
|
"github.com/davecheney/gpio"
|
|
"github.com/fulr/spidev"
|
|
)
|
|
|
|
const (
|
|
irqPin = gpio.GPIO25
|
|
)
|
|
|
|
func main() {
|
|
log.Print("Start")
|
|
|
|
pin, err := gpio.OpenPin(irqPin, gpio.ModeInput)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
defer pin.Close()
|
|
|
|
spiBus, err := spidev.NewSPIDevice("/dev/spidev0.0")
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
defer spiBus.Close()
|
|
|
|
rfm, err := NewDevice(spiBus, pin, 1, 10, false)
|
|
if err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
log.Print(rfm)
|
|
}
|