SX1276 library for modtronix inair9. Edited for use with NRF51DK board.

Dependents:   InAir9_PingPong

Fork of SX1276Lib_modtronix by modtronix H

Revision:
16:0927c093fd82
Parent:
15:04374b1c33fa
Child:
18:cdb08d710838
--- a/sx1276/sx1276.cpp	Thu Jan 22 12:47:47 2015 +0000
+++ b/sx1276/sx1276.cpp	Mon Mar 02 23:54:25 2015 +0000
@@ -251,12 +251,12 @@
         break;
     case MODEM_LORA:
         {
-            if( bandwidth > 2 )
+            if( bandwidth > 9 )
             {
-                // Fatal error: When using LoRa modem only bandwidths 125, 250 and 500 kHz are supported
+                // Fatal error: Bandwidth must be 0-9 (7.8 - 500khz)
                 while( 1 );
             }
-            bandwidth += 7;
+            //bandwidth += 7;   //Changed bandwidth from 0-2 to 0-10
             this->settings.LoRa.Bandwidth = bandwidth;
             this->settings.LoRa.Datarate = datarate;
             this->settings.LoRa.Coderate = coderate;
@@ -277,6 +277,7 @@
                 datarate = 6;
             }
         
+            //bandwidth 7=125, 8=250, 9=500, datarate=SF
             if( ( ( bandwidth == 7 ) && ( ( datarate == 11 ) || ( datarate == 12 ) ) ) ||
                 ( ( bandwidth == 8 ) && ( datarate == 12 ) ) )
             {
@@ -450,12 +451,12 @@
     case MODEM_LORA:
         {
             this->settings.LoRa.Power = power;
-            if( bandwidth > 2 )
+            if( bandwidth > 9 )
             {
-                // Fatal error: When using LoRa modem only bandwidths 125, 250 and 500 kHz are supported
+                // Fatal error: Bandwidth must be 0-9 (7.8 - 500khz)
                 while( 1 );
             }
-            bandwidth += 7;
+            //bandwidth += 7;
             this->settings.LoRa.Bandwidth = bandwidth;
             this->settings.LoRa.Datarate = datarate;
             this->settings.LoRa.Coderate = coderate;
@@ -475,6 +476,7 @@
             {
                 datarate = 6;
             }
+            //bandwidth 7=125, 8=250, 9=500, datarate=SF
             if( ( ( bandwidth == 7 ) && ( ( datarate == 11 ) || ( datarate == 12 ) ) ) ||
                 ( ( bandwidth == 8 ) && ( datarate == 12 ) ) )
             {
@@ -556,30 +558,29 @@
     case MODEM_LORA:
         {
             double bw = 0.0;
-            // REMARK: When using LoRa modem only bandwidths 125, 250 and 500 kHz are supported
             switch( this->settings.LoRa.Bandwidth )
             {
-            //case 0: // 7.8 kHz
-            //    bw = 78e2;
-            //    break;
-            //case 1: // 10.4 kHz
-            //    bw = 104e2;
-            //    break;
-            //case 2: // 15.6 kHz
-            //    bw = 156e2;
-            //    break;
-            //case 3: // 20.8 kHz
-            //    bw = 208e2;
-            //    break;
-            //case 4: // 31.2 kHz
-            //    bw = 312e2;
-            //    break;
-            //case 5: // 41.4 kHz
-            //    bw = 414e2;
-            //    break;
-            //case 6: // 62.5 kHz
-            //    bw = 625e2;
-            //    break;
+            case 0: // 7.8 kHz
+                bw = 78e2;
+                break;
+            case 1: // 10.4 kHz
+                bw = 104e2;
+                break;
+            case 2: // 15.6 kHz
+                bw = 156e2;
+                break;
+            case 3: // 20.8 kHz
+                bw = 208e2;
+                break;
+            case 4: // 31.2 kHz
+                bw = 312e2;
+                break;
+            case 5: // 41.4 kHz
+                bw = 414e2;
+                break;
+            case 6: // 62.5 kHz
+                bw = 625e2;
+                break;
             case 7: // 125 kHz
                 bw = 125e3;
                 break;