SX126xDevKit

Dependencies:   mbed DmTftLibrary SX126xLib

Revision:
2:8e1b4210df6b
Parent:
1:b96176a4ccb8
--- a/Peripherals/Eeprom.cpp	Fri Mar 09 13:28:34 2018 +0000
+++ b/Peripherals/Eeprom.cpp	Wed Jul 18 13:34:10 2018 +0000
@@ -311,7 +311,22 @@
     Eeprom.EepromData.PacketParams.PacketType     = PACKET_TYPE_LORA;
 
     Eeprom.EepromData.DemoSettings.ModulationParam1 = LORA_SF7;
-    Eeprom.EepromData.DemoSettings.ModulationParam2 = LORA_BW_500;
+    
+    if( deviceConnected == SX1268 )
+    {
+        if( matchingFreq == MATCHING_FREQ_780 )
+        {
+            Eeprom.EepromData.DemoSettings.ModulationParam2 = LORA_BW_125;
+        }
+        else
+        {
+            Eeprom.EepromData.DemoSettings.ModulationParam2 = LORA_BW_500;
+        }
+    }
+    else
+    {
+        Eeprom.EepromData.DemoSettings.ModulationParam2 = LORA_BW_500;
+    }
     Eeprom.EepromData.DemoSettings.ModulationParam3 = LORA_CR_4_5;
     Eeprom.EepromData.DemoSettings.ModulationParam4 = 0x00;
 
@@ -351,20 +366,55 @@
         Eeprom.EepromData.DemoSettings.RadioPowerMode = USE_DCDC;
         Eeprom.EepromData.DemoSettings.TxPower        = SX1261_POWER_TX_MAX;
     }
-    else
+    else if( deviceConnected == SX1268 )
+    {
+        if( matchingFreq == MATCHING_FREQ_490 )
+        {
+            Eeprom.EepromData.DemoSettings.LastDeviceConnected = deviceConnected;
+            Eeprom.EepromData.DemoSettings.RadioPowerMode = USE_LDO;
+            Eeprom.EepromData.DemoSettings.TxPower        = SX1262_POWER_TX_MAX;
+        }
+        else
+        {
+            Eeprom.EepromData.DemoSettings.LastDeviceConnected = deviceConnected;
+            Eeprom.EepromData.DemoSettings.RadioPowerMode = USE_DCDC;
+            Eeprom.EepromData.DemoSettings.TxPower        = 10;
+        }
+    }
+    else if( deviceConnected == SX1262 )
     {
         Eeprom.EepromData.DemoSettings.LastDeviceConnected = deviceConnected;
         Eeprom.EepromData.DemoSettings.RadioPowerMode = USE_LDO;
         Eeprom.EepromData.DemoSettings.TxPower        = SX1262_POWER_TX_MAX;
     }
-    
-    if( matchingFreq == 1 )
+
+    if( matchingFreq == MATCHING_FREQ_169 )
+    {
+        Eeprom.EepromData.DemoSettings.Frequency      = DEMO_CENTRAL_FREQ_PRESET1;
+    }
+    else if( matchingFreq == MATCHING_FREQ_280 )
+    {
+        Eeprom.EepromData.DemoSettings.Frequency      = DEMO_CENTRAL_FREQ_PRESET2;
+    }
+    else if( matchingFreq == MATCHING_FREQ_434 )
     {
-        Eeprom.EepromData.DemoSettings.Frequency      = DEMO_CENTRAL_FREQ_PRESET1; // 868 MHz
+        Eeprom.EepromData.DemoSettings.Frequency      = DEMO_CENTRAL_FREQ_PRESET3;
+    }
+    else if( matchingFreq == MATCHING_FREQ_490 )
+    {
+        Eeprom.EepromData.DemoSettings.Frequency      = DEMO_CENTRAL_FREQ_PRESET4;
     }
-    else 
+    else if( matchingFreq == MATCHING_FREQ_780 )
+    {
+        Eeprom.EepromData.DemoSettings.Frequency      = DEMO_CENTRAL_FREQ_PRESET5;
+    }
+    else if( matchingFreq == MATCHING_FREQ_868 )
     {
-        Eeprom.EepromData.DemoSettings.Frequency      = DEMO_CENTRAL_FREQ_PRESET2; // 915 MHz
+        Eeprom.EepromData.DemoSettings.Frequency      = DEMO_CENTRAL_FREQ_PRESET6;
+    }
+    else if( matchingFreq == MATCHING_FREQ_915 )
+    {
+        Eeprom.EepromData.DemoSettings.Frequency      = DEMO_CENTRAL_FREQ_PRESET7;
     }
 
     Eeprom.EepromData.DemoSettings.MaxNumPacket   = 0x00;