Lorawan uplink support and new lorawan 'basic-demo' example

This commit is contained in:
Olivier Fauchon
2023-01-10 23:15:39 +01:00
committed by Ron Evans
parent 301e6bc35b
commit 889536f7f0
15 changed files with 195 additions and 28 deletions
+11 -1
View File
@@ -71,7 +71,17 @@ func Join(otaa *Otaa, session *Session) error {
return nil
}
func SendUplink() error {
func SendUplink(data []uint8, session *Session) error {
payload, err := session.GenMessage(0, []byte(data))
if err != nil {
return err
}
ActiveRadio.SetCrc(true)
ActiveRadio.SetIqMode(0) // IQ Standard
ActiveRadio.Tx(payload, LORA_RXTX_TIMEOUT)
if err != nil {
return err
}
return nil
}
+1 -1
View File
@@ -87,7 +87,7 @@ func (o *Otaa) GenerateJoinRequest() ([]uint8, error) {
o.buf = append(o.buf, 0x00)
o.buf = append(o.buf, reverseBytes(o.AppEUI[:])...)
o.buf = append(o.buf, reverseBytes(o.DevEUI[:])...)
o.buf = append(o.buf, reverseBytes(o.DevNonce[:])...)
o.buf = append(o.buf, o.DevNonce[:]...)
mic := genPayloadMIC(o.buf, o.AppKey)
o.buf = append(o.buf, mic[:]...)