Example of using the mDot UDK with the X-NUCLEO-IKS01A2 board

Dependencies:   MTS_X_NUCLEO_IKS01A2 libmDot-mbed5

Fork of mDot-IKS01A1 by Peter Ferland

Revision:
13:e165a137c3af
Parent:
12:63e90d375afd
Child:
15:fb9fa3ac530e
--- a/main.cpp	Fri Jan 26 17:39:50 2018 +0000
+++ b/main.cpp	Fri Jan 26 17:53:23 2018 +0000
@@ -1,5 +1,6 @@
 #include "mbed.h"
 #include "mDot.h"
+#include "ChannelPlan.h"
 #include "XNucleoIKS01A2.h"
 #include "dot_util.h"
 #include "RadioEvent.h"
@@ -7,6 +8,10 @@
 
 #define TTN
 
+#if !defined(CHANNEL_PLAN)
+#define CHANNEL_PLAN CP_US915
+#endif
+
 // mDot UDK board demo with X-NUCLEO-IKS01A1 sensor card
 // For more examples see the Dot-Examples project:
 // https://developer.mbed.org/teams/MultiTech/code/Dot-Examples/
@@ -59,6 +64,7 @@
 static bool deep_sleep = false;
 
 mDot *dot = NULL;
+lora::ChannelPlan* plan = NULL;
 
 int main()
 {
@@ -90,9 +96,23 @@
     // Custom event handler for automatically displaying RX data
     RadioEvent events;
     pc.baud(115200);
-
+#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
     /* Initialize mDot */
-    dot = mDot::getInstance();
+    dot = mDot::getInstance(plan);
 
     //dot->setAdr(true);
     mts::MTSLog::setLogLevel(mts::MTSLog::INFO_LEVEL);