Skip to content

Commit

Permalink
LoRa WAN add setter functions
Browse files Browse the repository at this point in the history
  • Loading branch information
iamemilio committed Oct 13, 2023
1 parent 44aa2ea commit fd42ee3
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lora/lorawan/region/au915.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@ func (c *ChannelAU) CodingRate() uint8 { return c.codingRate }
func (c *ChannelAU) PreambleLength() uint16 { return c.preambleLength }
func (c *ChannelAU) TxPowerDBm() int8 { return c.txPowerDBm }

// Set functions
func (c *ChannelAU) SetFrequency(v uint32) { c.frequency = v }
func (c *ChannelAU) SetBandwidth(v uint8) { c.bandwidth = v }
func (c *ChannelAU) SetSpreadingFactor(v uint8) { c.spreadingFactor = v }
func (c *ChannelAU) SetCodingRate(v uint8) { c.codingRate = v }
func (c *ChannelAU) SetPreambleLength(v uint16) { c.preambleLength = v }
func (c *ChannelAU) SetTxPowerDBm(v int8) { c.txPowerDBm = v }

func (c *ChannelAU) Next() bool {
return false
}
Expand Down
8 changes: 8 additions & 0 deletions lora/lorawan/region/eu868.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@ func (c *ChannelEU) CodingRate() uint8 { return c.codingRate }
func (c *ChannelEU) PreambleLength() uint16 { return c.preambleLength }
func (c *ChannelEU) TxPowerDBm() int8 { return c.txPowerDBm }

// Set functions
func (c *ChannelEU) SetFrequency(v uint32) { c.frequency = v }
func (c *ChannelEU) SetBandwidth(v uint8) { c.bandwidth = v }
func (c *ChannelEU) SetSpreadingFactor(v uint8) { c.spreadingFactor = v }
func (c *ChannelEU) SetCodingRate(v uint8) { c.codingRate = v }
func (c *ChannelEU) SetPreambleLength(v uint16) { c.preambleLength = v }
func (c *ChannelEU) SetTxPowerDBm(v int8) { c.txPowerDBm = v }

func (c *ChannelEU) Next() bool {
return false
}
Expand Down
9 changes: 9 additions & 0 deletions lora/lorawan/region/us915.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,15 @@ func (c *ChannelUS) CodingRate() uint8 { return c.codingRate }
func (c *ChannelUS) PreambleLength() uint16 { return c.preambleLength }
func (c *ChannelUS) TxPowerDBm() int8 { return c.txPowerDBm }

// Set functions
// TODO: validate input
func (c *ChannelUS) SetFrequency(v uint32) { c.frequency = v }
func (c *ChannelUS) SetBandwidth(v uint8) { c.bandwidth = v }
func (c *ChannelUS) SetSpreadingFactor(v uint8) { c.spreadingFactor = v }
func (c *ChannelUS) SetCodingRate(v uint8) { c.codingRate = v }
func (c *ChannelUS) SetPreambleLength(v uint16) { c.preambleLength = v }
func (c *ChannelUS) SetTxPowerDBm(v int8) { c.txPowerDBm = v }

func (c *ChannelUS) Next() bool {
switch c.Bandwidth() {
case lora.Bandwidth_125_0:
Expand Down

0 comments on commit fd42ee3

Please sign in to comment.