master
Friedl Ulrich 10 years ago
parent d9d9b0837e
commit 23f88df1ad

@ -5,11 +5,12 @@ import (
"log" "log"
"github.com/davecheney/gpio" "github.com/davecheney/gpio"
spidev "github.com/fulr/spidev"
) )
// Device RFM69 Device // Device RFM69 Device
type Device struct { type Device struct {
SpiDevice *SPIDevice SpiDevice *spidev.SPIDevice
gpio gpio.Pin gpio gpio.Pin
mode byte mode byte
address byte address byte
@ -35,7 +36,7 @@ type Data struct {
} }
// NewDevice creates a new device // NewDevice creates a new device
func NewDevice(spi *SPIDevice, gpio gpio.Pin, nodeID, networkID byte, isRfm69HW bool) (*Device, error) { func NewDevice(spi *spidev.SPIDevice, gpio gpio.Pin, nodeID, networkID byte, isRfm69HW bool) (*Device, error) {
ret := &Device{ ret := &Device{
SpiDevice: spi, SpiDevice: spi,
gpio: gpio, gpio: gpio,

@ -4,6 +4,7 @@ import (
"log" "log"
"github.com/davecheney/gpio" "github.com/davecheney/gpio"
spidev "github.com/fulr/spidev"
) )
const ( const (
@ -19,7 +20,7 @@ func main() {
} }
defer pin.Close() defer pin.Close()
spiBus, err := NewSPIDevice("/dev/spidev0.0") spiBus, err := spidev.NewSPIDevice("/dev/spidev0.0")
if err != nil { if err != nil {
panic(err) panic(err)
} }

Loading…
Cancel
Save