mirror of
https://github.com/tinygo-org/drivers.git
synced 2026-08-11 02:13:42 +00:00
Lorawan uplink support and new lorawan 'basic-demo' example
This commit is contained in:
committed by
Ron Evans
parent
301e6bc35b
commit
889536f7f0
+11
-1
@@ -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
|
||||
}
|
||||
|
||||
|
||||
@@ -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[:]...)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user