rfm69

package
v0.0.0-...-fe88680 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 18, 2016 License: MIT Imports: 5 Imported by: 0

README

RFM69 Driver Info

Documentation

Overview

The RFM69 package interfaces with a HopeRF RFM69 radio connected to an SPI bus. In addition, an interrupt capable GPIO pin may be used to avoid having to poll the radio.

Index

Constants

View Source
const (
	REG_FIFO        = 0x00
	REG_OPMODE      = 0x01
	REG_DATAMODUL   = 0x02
	REG_BITRATEMSB  = 0x03
	REG_FDEVMSB     = 0x05
	REG_FRFMSB      = 0x07
	REG_AFCCTRL     = 0x0B
	REG_VERSION     = 0x10
	REG_PALEVEL     = 0x11
	REG_LNAVALUE    = 0x18
	REG_RXBW        = 0x19
	REG_AFCBW       = 0x1A
	REG_AFCMSB      = 0x1F
	REG_AFCLSB      = 0x20
	REG_FEIMSB      = 0x21
	REG_FEILSB      = 0x22
	REG_RSSICONFIG  = 0x23
	REG_RSSIVALUE   = 0x24
	REG_DIOMAPPING1 = 0x25
	REG_IRQFLAGS1   = 0x27
	REG_IRQFLAGS2   = 0x28
	REG_SYNCCONFIG  = 0x2E
	REG_SYNCVALUE1  = 0x2F
	REG_SYNCVALUE2  = 0x30
	REG_NODEADDR    = 0x39
	REG_BCASTADDR   = 0x3A
	REG_FIFOTHRESH  = 0x3C
	REG_PKTCONFIG2  = 0x3D
	REG_AESKEYMSB   = 0x3E

	MODE_SLEEP    = 0 << 2
	MODE_STANDBY  = 1 << 2
	MODE_FS       = 2 << 2
	MODE_TRANSMIT = 3 << 2
	MODE_RECEIVE  = 4 << 2

	START_TX = 0xC2
	STOP_TX  = 0x42

	RCCALSTART        = 0x80
	IRQ1_MODEREADY    = 1 << 7
	IRQ1_RXREADY      = 1 << 6
	IRQ1_PLLLOCK      = 1 << 4
	IRQ1_SYNADDRMATCH = 1 << 0

	IRQ2_FIFONOTEMPTY = 1 << 6
	IRQ2_PACKETSENT   = 1 << 3
	IRQ2_PAYLOADREADY = 1 << 2

	DIO_MAPPING  = 0x32
	DIO_RSSI     = 0xC0
	DIO_SYNC     = 0x80
	DIO_PAYREADY = 0x40
	DIO_PKTSENT  = 0x00
)

Variables

View Source
var Rates = map[uint32]Rate{
	49230: {45000, 0, 0x4A, 0x42},
	50000: {45000, 0, 0x4A, 0x42},
}

Rates is the table of supported bit rates and their corresponding register settings. The map key is the bit rate in bits per second.

Functions

func New

func New(bus embd.SPIBus, intr embd.InterruptPin, sync []byte, freq, rate uint32) *rfm69

New creates a connection to an rfm69 radio connected to the provided SPI bus and interrupt pin. the bufCount determines how many transmit buffers are allocated to allow for the queueing of transmit packets. For the RFM69 the SPI bus must be set to 10Mhz and mode 0.

Types

type Rate

type Rate struct {
	Fdev    int  // TX frequency deviation in Hz
	Shaping byte // 0:none, 1:gaussian BT=1, 2:gaussian BT=0.5, 3:gaussian BT=0.3
	RxBw    byte // value for rxBw register (0x19)
	AfcBw   byte // value for afcBw register (0x1A)
}

Rate describes the RFM69 configuration to achieve a specific bit rate

type RxInfo

type RxInfo struct {
	// contains filtered or unexported fields
}

RxInfo contains stats about a received packet

type RxPacket

type RxPacket struct {
	Payload []byte  // payload, from address to last data byte, excluding length & crc
	CrcOK   bool    // whether received CRC is OK
	Crc     uint16  // received CRC
	Info    *RxInfo // stats about the reception
}

RxPacket is a received packet with stats

type TemporaryError

type TemporaryError interface {
	Temporary() bool // true if the error is temporary (retryable)
}

TemporaryError is an interface that is implemented by errors that may be temporary, i.e., that are retryable

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL