Basic xdot code to check how many memory is available for user APP after initializing libxdot lorawan stack

Revision:
42:20f6b29a9903
Parent:
33:15ea8f985c54
diff -r 67feacfab49c -r 20f6b29a9903 examples/src/peer_to_peer_example.cpp
--- a/examples/src/peer_to_peer_example.cpp	Mon May 18 13:12:47 2020 -0500
+++ b/examples/src/peer_to_peer_example.cpp	Tue May 25 09:54:33 2021 -0500
@@ -26,7 +26,7 @@
 mDot* dot = NULL;
 lora::ChannelPlan* plan = NULL;
 
-Serial pc(USBTX, USBRX);
+mbed::UnbufferedSerial pc(USBTX, USBRX);
 
 #if defined(TARGET_XDOT_L151CC)
 I2C i2c(I2C_SDA, I2C_SCL);
@@ -50,22 +50,9 @@
 #endif
 
     mts::MTSLog::setLogLevel(mts::MTSLog::TRACE_LEVEL);
-    
-#if CHANNEL_PLAN == CP_US915
-    plan = new lora::ChannelPlan_US915();
-#elif CHANNEL_PLAN == CP_AU915
-    plan = new lora::ChannelPlan_AU915();
-#elif CHANNEL_PLAN == CP_EU868
-    plan = new lora::ChannelPlan_EU868();
-#elif CHANNEL_PLAN == CP_KR920
-    plan = new lora::ChannelPlan_KR920();
-#elif CHANNEL_PLAN == CP_AS923
-    plan = new lora::ChannelPlan_AS923();
-#elif CHANNEL_PLAN == CP_AS923_JAPAN
-    plan = new lora::ChannelPlan_AS923_Japan();
-#elif CHANNEL_PLAN == CP_IN865
-    plan = new lora::ChannelPlan_IN865();
-#endif
+
+    // Create channel plan
+    plan = create_channel_plan();
     assert(plan);
 
     dot = mDot::getInstance(plan);
@@ -141,7 +128,7 @@
         default:
             while (true) {
                 logFatal("no known channel plan in use - extra configuration is needed!");
-                wait(5);
+                ThisThread::sleep_for(5s);
             }
             break;
     }
@@ -195,7 +182,7 @@
         // it must be waiting for data from the other Dot
         // send data every 5 seconds
         logInfo("waiting for 5s");
-        wait(5);
+        ThisThread::sleep_for(5s);
     }
  
     return 0;