tinygo.org/x/drivers@v0.27.1-0.20240509133757-7dbca2a54349/lora/config.go (about)

     1  package lora
     2  
     3  import "errors"
     4  
     5  // Config holds the LoRa configuration parameters
     6  type Config struct {
     7  	Freq           uint32 // Frequency
     8  	Cr             uint8  // Coding Rate
     9  	Sf             uint8  // Spread Factor
    10  	Bw             uint8  // Bandwidth
    11  	Ldr            uint8  // Low Data Rate
    12  	Preamble       uint16 // PreambleLength
    13  	SyncWord       uint16 // Sync Word
    14  	HeaderType     uint8  // Header : Implicit/explicit
    15  	Crc            uint8  // CRC : Yes/No
    16  	Iq             uint8  // iq : Standard/inverted
    17  	LoraTxPowerDBm int8   // Tx power in Dbm
    18  }
    19  
    20  var (
    21  	ErrUndefinedLoraConf = errors.New("Undefined Lora configuration")
    22  )
    23  
    24  const (
    25  	SpreadingFactor5  = 0x05
    26  	SpreadingFactor6  = 0x06
    27  	SpreadingFactor7  = 0x07
    28  	SpreadingFactor8  = 0x08
    29  	SpreadingFactor9  = 0x09
    30  	SpreadingFactor10 = 0x0A
    31  	SpreadingFactor11 = 0x0B
    32  	SpreadingFactor12 = 0x0C
    33  )
    34  
    35  const (
    36  	CodingRate4_5 = 0x01 //  7     0     LoRa coding rate: 4/5
    37  	CodingRate4_6 = 0x02 //  7     0                       4/6
    38  	CodingRate4_7 = 0x03 //  7     0                       4/7
    39  	CodingRate4_8 = 0x04 //  7     0                       4/8
    40  )
    41  
    42  const (
    43  	HeaderExplicit = 0x00 //  7     0     LoRa header mode: explicit
    44  	HeaderImplicit = 0x01 //  7     0                       implicit
    45  )
    46  
    47  const (
    48  	LowDataRateOptimizeOff = 0x00 //  7     0     LoRa low data rate optimization: disabled
    49  	LowDataRateOptimizeOn  = 0x01 //  7     0                                      enabled
    50  )
    51  
    52  const (
    53  	CRCOff = 0x00 //  7     0     LoRa CRC mode: disabled
    54  	CRCOn  = 0x01 //  7     0                    enabled
    55  )
    56  
    57  const (
    58  	IQStandard = 0x00 //  7     0     LoRa IQ setup: standard
    59  	IQInverted = 0x01 //  7     0                    inverted
    60  )
    61  
    62  const (
    63  	Bandwidth_7_8   = iota // 7.8 kHz
    64  	Bandwidth_10_4         // 10.4 kHz
    65  	Bandwidth_15_6         // 15.6 kHz
    66  	Bandwidth_20_8         // 20.8 kHz
    67  	Bandwidth_31_25        // 31.25 kHz
    68  	Bandwidth_41_7         // 41.7 kHz
    69  	Bandwidth_62_5         // 62.5 kHz
    70  	Bandwidth_125_0        // 125.0 kHz
    71  	Bandwidth_250_0        // 250.0 kHz
    72  	Bandwidth_500_0        // 500.0 kHz
    73  )
    74  
    75  const (
    76  	SyncPublic = iota
    77  	SyncPrivate
    78  )
    79  
    80  const (
    81  	MHz_868_1 = 868100000
    82  	MHz_868_5 = 868500000
    83  	MHz_902_3 = 902300000
    84  	Mhz_903_0 = 903000000
    85  	MHZ_915_0 = 915000000
    86  	MHz_916_8 = 916800000
    87  	MHz_923_3 = 923300000
    88  )