LoRa WAN US915 Support

Adds a driver for us 915 protocol to the lora WAN drivers.
This commit is contained in:
Mirac Kara
2023-09-26 17:02:18 -07:00
committed by Ron Evans
parent 4edb58c0c5
commit e95cfe66c1
6 changed files with 218 additions and 52 deletions
+30 -9
View File
@@ -7,27 +7,48 @@ const (
EU868_DEFAULT_TX_POWER_DBM = 20
)
type ChannelEU struct {
frequency uint32
bandwidth uint8
spreadingFactor uint8
codingRate uint8
preambleLength uint16
txPowerDBm int8
}
// Getter functions
func (c *ChannelEU) Frequency() uint32 { return c.frequency }
func (c *ChannelEU) Bandwidth() uint8 { return c.bandwidth }
func (c *ChannelEU) SpreadingFactor() uint8 { return c.spreadingFactor }
func (c *ChannelEU) CodingRate() uint8 { return c.codingRate }
func (c *ChannelEU) PreambleLength() uint16 { return c.preambleLength }
func (c *ChannelEU) TxPowerDBm() int8 { return c.txPowerDBm }
func (c *ChannelEU) Next() bool {
return false
}
type RegionSettingsEU868 struct {
joinRequestChannel *Channel
joinAcceptChannel *Channel
uplinkChannel *Channel
joinRequestChannel *ChannelEU
joinAcceptChannel *ChannelEU
uplinkChannel *ChannelEU
}
func EU868() *RegionSettingsEU868 {
return &RegionSettingsEU868{
joinRequestChannel: &Channel{lora.MHz_868_1,
joinRequestChannel: &ChannelEU{lora.MHz_868_1,
lora.Bandwidth_125_0,
lora.SpreadingFactor9,
lora.CodingRate4_7,
EU868_DEFAULT_PREAMBLE_LEN,
EU868_DEFAULT_TX_POWER_DBM},
joinAcceptChannel: &Channel{lora.MHz_868_1,
joinAcceptChannel: &ChannelEU{lora.MHz_868_1,
lora.Bandwidth_125_0,
lora.SpreadingFactor9,
lora.CodingRate4_7,
EU868_DEFAULT_PREAMBLE_LEN,
EU868_DEFAULT_TX_POWER_DBM},
uplinkChannel: &Channel{lora.MHz_868_1,
uplinkChannel: &ChannelEU{lora.MHz_868_1,
lora.Bandwidth_125_0,
lora.SpreadingFactor9,
lora.CodingRate4_7,
@@ -36,14 +57,14 @@ func EU868() *RegionSettingsEU868 {
}
}
func (r *RegionSettingsEU868) JoinRequestChannel() *Channel {
func (r *RegionSettingsEU868) JoinRequestChannel() Channel {
return r.joinRequestChannel
}
func (r *RegionSettingsEU868) JoinAcceptChannel() *Channel {
func (r *RegionSettingsEU868) JoinAcceptChannel() Channel {
return r.joinAcceptChannel
}
func (r *RegionSettingsEU868) UplinkChannel() *Channel {
func (r *RegionSettingsEU868) UplinkChannel() Channel {
return r.uplinkChannel
}