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.

42 lines
676 B
Go

10 years ago
package rfm69
10 years ago
import (
10 years ago
"testing"
10 years ago
10 years ago
"github.com/fulr/embd"
10 years ago
_ "github.com/fulr/rfm69/rpi"
10 years ago
)
10 years ago
func TestRfm69(t *testing.T) {
10 years ago
t.Log("Test")
10 years ago
if err := embd.InitSPI(); err != nil {
10 years ago
t.Error(err)
10 years ago
}
defer embd.CloseSPI()
10 years ago
if err := embd.InitGPIO(); err != nil {
panic(err)
}
defer embd.CloseGPIO()
gpio, err := embd.NewDigitalPin(10)
if err != nil {
panic(err)
}
defer gpio.Close()
10 years ago
//if err := gpio.SetDirection(embd.In); err != nil {
// panic(err)
//}
//gpio.ActiveLow(false)
10 years ago
10 years ago
spiBus := embd.NewSPIBus(embd.SPIMode0, 0, 4000000, 8, 0)
10 years ago
defer spiBus.Close()
10 years ago
rfm, err := NewDevice(spiBus, gpio, 1, 10, true)
10 years ago
if err != nil {
10 years ago
t.Error(err)
10 years ago
}
10 years ago
t.Log(rfm)
10 years ago
}