|
|
@ -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,
|
|
|
|