lora

package
v0.27.0 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2024 License: BSD-3-Clause Imports: 1 Imported by: 22

Documentation

Index

Constants

View Source
const (
	SpreadingFactor5  = 0x05
	SpreadingFactor6  = 0x06
	SpreadingFactor7  = 0x07
	SpreadingFactor8  = 0x08
	SpreadingFactor9  = 0x09
	SpreadingFactor10 = 0x0A
	SpreadingFactor11 = 0x0B
	SpreadingFactor12 = 0x0C
)
View Source
const (
	CodingRate4_5 = 0x01 //  7     0     LoRa coding rate: 4/5
	CodingRate4_6 = 0x02 //  7     0                       4/6
	CodingRate4_7 = 0x03 //  7     0                       4/7
	CodingRate4_8 = 0x04 //  7     0                       4/8
)
View Source
const (
	HeaderExplicit = 0x00 //  7     0     LoRa header mode: explicit
	HeaderImplicit = 0x01 //  7     0                       implicit
)
View Source
const (
	LowDataRateOptimizeOff = 0x00 //  7     0     LoRa low data rate optimization: disabled
	LowDataRateOptimizeOn  = 0x01 //  7     0                                      enabled
)
View Source
const (
	CRCOff = 0x00 //  7     0     LoRa CRC mode: disabled
	CRCOn  = 0x01 //  7     0                    enabled
)
View Source
const (
	IQStandard = 0x00 //  7     0     LoRa IQ setup: standard
	IQInverted = 0x01 //  7     0                    inverted
)
View Source
const (
	Bandwidth_7_8   = iota // 7.8 kHz
	Bandwidth_10_4         // 10.4 kHz
	Bandwidth_15_6         // 15.6 kHz
	Bandwidth_20_8         // 20.8 kHz
	Bandwidth_31_25        // 31.25 kHz
	Bandwidth_41_7         // 41.7 kHz
	Bandwidth_62_5         // 62.5 kHz
	Bandwidth_125_0        // 125.0 kHz
	Bandwidth_250_0        // 250.0 kHz
	Bandwidth_500_0        // 500.0 kHz
)
View Source
const (
	SyncPublic = iota
	SyncPrivate
)
View Source
const (
	MHz_868_1 = 868100000
	MHz_868_5 = 868500000
	MHz_902_3 = 902300000
	Mhz_903_0 = 903000000
	MHZ_915_0 = 915000000
	MHz_916_8 = 916800000
	MHz_923_3 = 923300000
)
View Source
const (
	RadioEventRxDone = iota
	RadioEventTxDone
	RadioEventTimeout
	RadioEventWatchdog
	RadioEventCrcError
	RadioEventUnhandled
)

Variables

View Source
var (
	ErrUndefinedLoraConf = errors.New("Undefined Lora configuration")
)

Functions

This section is empty.

Types

type Config

type Config struct {
	Freq           uint32 // Frequency
	Cr             uint8  // Coding Rate
	Sf             uint8  // Spread Factor
	Bw             uint8  // Bandwidth
	Ldr            uint8  // Low Data Rate
	Preamble       uint16 // PreambleLength
	SyncWord       uint16 // Sync Word
	HeaderType     uint8  // Header : Implicit/explicit
	Crc            uint8  // CRC : Yes/No
	Iq             uint8  // iq : Standard/inverted
	LoraTxPowerDBm int8   // Tx power in Dbm
}

Config holds the LoRa configuration parameters

type Radio

type Radio interface {
	Reset()
	Tx(pkt []uint8, timeoutMs uint32) error
	Rx(timeoutMs uint32) ([]uint8, error)
	SetFrequency(freq uint32)
	SetIqMode(mode uint8)
	SetCodingRate(cr uint8)
	SetBandwidth(bw uint8)
	SetCrc(enable bool)
	SetSpreadingFactor(sf uint8)
	SetPreambleLength(plen uint16)
	SetTxPower(txpow int8)
	SetSyncWord(syncWord uint16)
	SetPublicNetwork(enable bool)
	SetHeaderType(headerType uint8)
	LoraConfig(cnf Config)
}

type RadioEvent

type RadioEvent struct {
	EventType int
	IRQStatus uint16
	EventData []byte
}

RadioEvent are used for communicating in the radio Event Channel

func NewRadioEvent

func NewRadioEvent(eType int, irqStatus uint16, eData []byte) RadioEvent

NewRadioEvent() returns a new RadioEvent that can be used in the RadioChannel

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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