ST-DEVKIT-LRWAN

Dependents:   DISCO-L072CZ-LRWAN1-base

Fork of SX1276GenericLib by Helmut Tschemernjak

Revision:
63:5b9d391244dc
Parent:
62:835c5e20834e
Child:
64:b721e6ab656a
--- a/sx1276/sx1276.cpp	Mon Jun 05 01:35:40 2017 +0200
+++ b/sx1276/sx1276.cpp	Thu Jun 29 19:30:24 2017 +0200
@@ -1230,9 +1230,9 @@
                 SetTimeout(RXTimeoutSyncWordTimer, NULL);
             }
         }
-        if( ( this->RadioEvents != NULL ) && ( this->RadioEvents->RxTimeout != NULL ) )
+        if (this->RadioEvents && this->RadioEvents->RxTimeout)
         {
-            this->RadioEvents->RxTimeout(this);
+            this->RadioEvents->RxTimeout(this, this->RadioEvents->userThisPtr, this->RadioEvents->userData);
         }
         break;
     case RF_TX_RUNNING:
@@ -1261,9 +1261,9 @@
 		// END WORKAROUND
             
         this->settings.State = RF_IDLE;
-        if( ( this->RadioEvents != NULL ) && ( this->RadioEvents->TxTimeout != NULL ) )
+        if (this->RadioEvents && this->RadioEvents->TxTimeout)
         {
-            this->RadioEvents->TxTimeout(this);
+            this->RadioEvents->TxTimeout(this, this->RadioEvents->userThisPtr, this->RadioEvents->userData);
         }
         break;
     default:
@@ -1308,9 +1308,9 @@
                             SetTimeout(RXTimeoutSyncWordTimer, &SX1276::OnTimeoutIrq, this->settings.Fsk.RxSingleTimeout * 1e3);
                         }
 
-                        if( ( this->RadioEvents != NULL ) && ( this->RadioEvents->RxError != NULL ) )
+                        if (this->RadioEvents && this->RadioEvents->RxError)
                         {
-                            this->RadioEvents->RxError(this);
+                            this->RadioEvents->RxError(this, this->RadioEvents->userThisPtr, this->RadioEvents->userData);
                         }
                         this->settings.FskPacketHandler.PreambleDetected = false;
                         this->settings.FskPacketHandler.SyncWordDetected = false;
@@ -1354,9 +1354,9 @@
                     SetTimeout(RXTimeoutSyncWordTimer, &SX1276::OnTimeoutIrq, this->settings.Fsk.RxSingleTimeout * 1e3);
 				}
 
-                if( ( this->RadioEvents != NULL ) && ( this->RadioEvents->RxDone != NULL ) )
+                if (this->RadioEvents && this->RadioEvents->RxDone)
                 {
-                    this->RadioEvents->RxDone(this, rxtxBuffer, this->settings.FskPacketHandler.Size, this->settings.FskPacketHandler.RssiValue, 0 );
+                    this->RadioEvents->RxDone(this, this->RadioEvents->userThisPtr, this->RadioEvents->userData, rxtxBuffer, this->settings.FskPacketHandler.Size, this->settings.FskPacketHandler.RssiValue, 0 );
                 }
                 this->settings.FskPacketHandler.PreambleDetected = false;
                 this->settings.FskPacketHandler.SyncWordDetected = false;
@@ -1382,9 +1382,9 @@
                         }
                         SetTimeout(RXTimeoutTimer, NULL);
                         
-                        if( ( this->RadioEvents != NULL ) && ( this->RadioEvents->RxError != NULL ) )
+                        if(this->RadioEvents && this->RadioEvents->RxError)
                         {
-                            this->RadioEvents->RxError(this);
+                            this->RadioEvents->RxError(this, this->RadioEvents->userThisPtr, this->RadioEvents->userData);
                         }
                         break;
                     }
@@ -1437,9 +1437,9 @@
                     }
                     SetTimeout(RXTimeoutTimer, NULL);
                     
-                    if( ( this->RadioEvents != NULL ) && ( this->RadioEvents->RxDone != NULL ) )
+                    if(this->RadioEvents && this->RadioEvents->RxDone)
                     {
-                        this->RadioEvents->RxDone(this, rxtxBuffer, this->settings.LoRaPacketHandler.Size, this->settings.LoRaPacketHandler.RssiValue, this->settings.LoRaPacketHandler.SnrValue );
+                        this->RadioEvents->RxDone(this, this->RadioEvents->userThisPtr, this->RadioEvents->userData, rxtxBuffer, this->settings.LoRaPacketHandler.Size, this->settings.LoRaPacketHandler.RssiValue, this->settings.LoRaPacketHandler.SnrValue );
                     }
                 }
                 break;
@@ -1459,9 +1459,9 @@
             case MODEM_FSK:
             default:
                 this->settings.State = RF_IDLE;
-                if( ( this->RadioEvents != NULL ) && ( this->RadioEvents->TxDone != NULL ) )
+                if (this->RadioEvents && this->RadioEvents->TxDone)
                 {
-                    this->RadioEvents->TxDone(this);
+                    this->RadioEvents->TxDone(this, this->RadioEvents->userThisPtr, this->RadioEvents->userData);
                 }
                 break;
             }
@@ -1511,9 +1511,9 @@
 				Write( REG_LR_IRQFLAGS, RFLR_IRQFLAGS_RXTIMEOUT );
 
                 this->settings.State = RF_IDLE;
-                if( ( this->RadioEvents != NULL ) && ( this->RadioEvents->RxTimeout != NULL ) )
+                if (this->RadioEvents &&  this->RadioEvents->RxTimeout)
                 {
-                    this->RadioEvents->RxTimeout(this);
+                    this->RadioEvents->RxTimeout(this, this->RadioEvents->userThisPtr, this->RadioEvents->userData);
                 }
                 break;
             default:
@@ -1582,9 +1582,9 @@
                     // Clear Irq
                     Write( REG_LR_IRQFLAGS, RFLR_IRQFLAGS_FHSSCHANGEDCHANNEL );
 
-                    if( ( this->RadioEvents != NULL ) && ( this->RadioEvents->FhssChangeChannel != NULL ) )
+                    if (this->RadioEvents &&  this->RadioEvents->FhssChangeChannel)
                     {
-                        this->RadioEvents->FhssChangeChannel(this, ( Read( REG_LR_HOPCHANNEL ) & RFLR_HOPCHANNEL_CHANNEL_MASK ) );
+                        this->RadioEvents->FhssChangeChannel(this, this->RadioEvents->userThisPtr, this->RadioEvents->userData, ( Read( REG_LR_HOPCHANNEL ) & RFLR_HOPCHANNEL_CHANNEL_MASK ) );
                     }
                 }
                 break;
@@ -1603,9 +1603,9 @@
                     // Clear Irq
                     Write( REG_LR_IRQFLAGS, RFLR_IRQFLAGS_FHSSCHANGEDCHANNEL );
 
-                    if( ( this->RadioEvents != NULL ) && ( this->RadioEvents->FhssChangeChannel != NULL ) )
+                    if (this->RadioEvents && this->RadioEvents->FhssChangeChannel)
                     {
-                        this->RadioEvents->FhssChangeChannel(this, ( Read( REG_LR_HOPCHANNEL ) & RFLR_HOPCHANNEL_CHANNEL_MASK ) );
+                        this->RadioEvents->FhssChangeChannel(this, this->RadioEvents->userThisPtr, this->RadioEvents->userData, ( Read( REG_LR_HOPCHANNEL ) & RFLR_HOPCHANNEL_CHANNEL_MASK ) );
                     }
                 }
                 break;
@@ -1629,18 +1629,18 @@
         {
             // Clear Irq
             Write( REG_LR_IRQFLAGS, RFLR_IRQFLAGS_CADDETECTED | RFLR_IRQFLAGS_CADDONE );
-            if( ( this->RadioEvents != NULL ) && ( this->RadioEvents->CadDone != NULL ) )
+            if (this->RadioEvents && this->RadioEvents->CadDone)
             {
-                this->RadioEvents->CadDone(this, true );
+                this->RadioEvents->CadDone(this, this->RadioEvents->userThisPtr, this->RadioEvents->userData, true );
             }
         }
         else
         {
             // Clear Irq
             Write( REG_LR_IRQFLAGS, RFLR_IRQFLAGS_CADDONE );
-            if( ( this->RadioEvents != NULL ) && ( this->RadioEvents->CadDone != NULL ) )
+            if (this->RadioEvents && this->RadioEvents->CadDone)
             {
-                this->RadioEvents->CadDone(this, false );
+                this->RadioEvents->CadDone(this, this->RadioEvents->userThisPtr, this->RadioEvents->userData, false );
             }
         }
         break;