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

     1  package region
     2  
     3  type Channel interface {
     4  	Next() bool
     5  	Frequency() uint32
     6  	Bandwidth() uint8
     7  	SpreadingFactor() uint8
     8  	CodingRate() uint8
     9  	PreambleLength() uint16
    10  	TxPowerDBm() int8
    11  	SetFrequency(v uint32)
    12  	SetBandwidth(v uint8)
    13  	SetSpreadingFactor(v uint8)
    14  	SetCodingRate(v uint8)
    15  	SetPreambleLength(v uint16)
    16  	SetTxPowerDBm(v int8)
    17  }
    18  
    19  type channel struct {
    20  	frequency       uint32
    21  	bandwidth       uint8
    22  	spreadingFactor uint8
    23  	codingRate      uint8
    24  	preambleLength  uint16
    25  	txPowerDBm      int8
    26  }
    27  
    28  // Getter functions
    29  func (c *channel) Frequency() uint32      { return c.frequency }
    30  func (c *channel) Bandwidth() uint8       { return c.bandwidth }
    31  func (c *channel) SpreadingFactor() uint8 { return c.spreadingFactor }
    32  func (c *channel) CodingRate() uint8      { return c.codingRate }
    33  func (c *channel) PreambleLength() uint16 { return c.preambleLength }
    34  func (c *channel) TxPowerDBm() int8       { return c.txPowerDBm }
    35  
    36  // Set functions
    37  func (c *channel) SetFrequency(v uint32)      { c.frequency = v }
    38  func (c *channel) SetBandwidth(v uint8)       { c.bandwidth = v }
    39  func (c *channel) SetSpreadingFactor(v uint8) { c.spreadingFactor = v }
    40  func (c *channel) SetCodingRate(v uint8)      { c.codingRate = v }
    41  func (c *channel) SetPreambleLength(v uint16) { c.preambleLength = v }
    42  func (c *channel) SetTxPowerDBm(v int8)       { c.txPowerDBm = v }