Fork to see if I can get working

Dependencies:   BufferedSerial OneWire WinbondSPIFlash libxDot-dev-mbed5-deprecated

Fork of xDotBridge_update_test20180823 by Matt Briggs

Files at this revision

API Documentation at this revision

Comitter:
mbriggs_vortex
Date:
Thu Nov 16 20:59:24 2017 +0000
Parent:
80:73b7b2b3aabc
Child:
82:bb9dfd9a2b8b
Commit message:
Added json and bootloader dir

Changed in this revision

libxDot-dev-mbed5.lib Show annotated file Show diff for this revision Revisions of this file
libxDot-mbed5.lib Show diff for this revision Revisions of this file
mbed-os.lib Show annotated file Show diff for this revision Revisions of this file
mbed_app.json Show annotated file Show diff for this revision Revisions of this file
xDotBridge/src/CommProtocolPeerBrute.cpp Show annotated file Show diff for this revision Revisions of this file
xDotBridge/src/dot_util.cpp Show annotated file Show diff for this revision Revisions of this file
xDotBridge/src/main.cpp Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libxDot-dev-mbed5.lib	Thu Nov 16 20:59:24 2017 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/teams/MultiTech/code/libxDot-dev-mbed5/#3eb5210b5039
--- a/libxDot-mbed5.lib	Wed Nov 15 00:25:42 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-http://developer.mbed.org/teams/MultiTech/code/libxDot-mbed5/#aff2c05aacce
--- a/mbed-os.lib	Wed Nov 15 00:25:42 2017 +0000
+++ b/mbed-os.lib	Thu Nov 16 20:59:24 2017 +0000
@@ -1,1 +1,1 @@
-https://github.com/ARMmbed/mbed-os/#a6f3fd1a60d5df59246d7caf3f108c4d34e1808e
+https://github.com/ARMmbed/mbed-os/#78474a5129e18e136cc7e872adbaa5b74fbb8f6a
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed_app.json	Thu Nov 16 20:59:24 2017 +0000
@@ -0,0 +1,8 @@
+{
+    "target_overrides": {
+        "XDOT_L151CC": {
+            "target.bootloader_img": "bootloader/xDotBootloader.bin"
+        }
+    }
+}
+ 
\ No newline at end of file
--- a/xDotBridge/src/CommProtocolPeerBrute.cpp	Wed Nov 15 00:25:42 2017 +0000
+++ b/xDotBridge/src/CommProtocolPeerBrute.cpp	Thu Nov 16 20:59:24 2017 +0000
@@ -78,33 +78,33 @@
     uint8_t tx_datarate;
     uint32_t tx_frequency;
     uint8_t frequency_band = dot->getFrequencyBand();
-    switch (frequency_band) {
-        case mDot::FB_EU868:
-            // 250kHz channels achieve higher throughput
-            // DR6 : SF7 @ 250kHz
-            // DR0 - DR5 (125kHz channels) available but much slower
-            tx_frequency = 869850000;
-            tx_datarate = mDot::DR6;
-            // the 869850000 frequency is 100% duty cycle if the total power is under 7 dBm - tx power 4 + antenna gain 3 = 7
-            tx_power = 4;
-            break;
-        case mDot::FB_US915:
-        case mDot::FB_AU915:
-        default:
-            // 500kHz channels achieve highest throughput
-            // DR8 : SF12 @ 500kHz
-            // DR9 : SF11 @ 500kHz
-            // DR10 : SF10 @ 500kHz
-            // DR11 : SF9 @ 500kHz
-            // DR12 : SF8 @ 500kHz
-            // DR13 : SF7 @ 500kHz
-            // DR0 - DR3 (125kHz channels) available but much slower
-            tx_frequency = 915500000;
-            tx_datarate = mDot::DR13;
-            // 915 bands have no duty cycle restrictions, set tx power to max
-            tx_power = 20;
-            break;
-    }
+//    switch (frequency_band) {
+//        case mDot::FB_EU868:
+//            // 250kHz channels achieve higher throughput
+//            // DR6 : SF7 @ 250kHz
+//            // DR0 - DR5 (125kHz channels) available but much slower
+//            tx_frequency = 869850000;
+//            tx_datarate = mDot::DR6;
+//            // the 869850000 frequency is 100% duty cycle if the total power is under 7 dBm - tx power 4 + antenna gain 3 = 7
+//            tx_power = 4;
+//            break;
+//        case mDot::FB_US915:
+//        case mDot::FB_AU915:
+//        default:
+//            // 500kHz channels achieve highest throughput
+//            // DR8 : SF12 @ 500kHz
+//            // DR9 : SF11 @ 500kHz
+//            // DR10 : SF10 @ 500kHz
+//            // DR11 : SF9 @ 500kHz
+//            // DR12 : SF8 @ 500kHz
+//            // DR13 : SF7 @ 500kHz
+//            // DR0 - DR3 (125kHz channels) available but much slower
+//            tx_frequency = 915500000;
+//            tx_datarate = mDot::DR13;
+//            // 915 bands have no duty cycle restrictions, set tx power to max
+//            tx_power = 20;
+//            break;
+//    }
     // in PEER_TO_PEER mode there is no join request/response transaction
     // as long as both Dots are configured correctly, they should be able to communicate
 
@@ -145,33 +145,33 @@
     uint8_t tx_datarate;
     uint32_t tx_frequency;
     uint8_t frequency_band = dot->getFrequencyBand();
-    switch (frequency_band) {
-        case mDot::FB_EU868:
-            // 250kHz channels achieve higher throughput
-            // DR6 : SF7 @ 250kHz
-            // DR0 - DR5 (125kHz channels) available but much slower
-            tx_frequency = 869850000;
-            tx_datarate = mDot::DR6;
-            // the 869850000 frequency is 100% duty cycle if the total power is under 7 dBm - tx power 4 + antenna gain 3 = 7
-            tx_power = 4;
-            break;
-        case mDot::FB_US915:
-        case mDot::FB_AU915:
-        default:
-            // 500kHz channels achieve highest throughput
-            // DR8 : SF12 @ 500kHz
-            // DR9 : SF11 @ 500kHz
-            // DR10 : SF10 @ 500kHz
-            // DR11 : SF9 @ 500kHz
-            // DR12 : SF8 @ 500kHz
-            // DR13 : SF7 @ 500kHz
-            // DR0 - DR3 (125kHz channels) available but much slower
-            tx_frequency = 915500000;
-            tx_datarate = mDot::DR13;
-            // 915 bands have no duty cycle restrictions, set tx power to max
-            tx_power = 20;
-            break;
-    }
+//    switch (frequency_band) {
+//        case mDot::FB_EU868:
+//            // 250kHz channels achieve higher throughput
+//            // DR6 : SF7 @ 250kHz
+//            // DR0 - DR5 (125kHz channels) available but much slower
+//            tx_frequency = 869850000;
+//            tx_datarate = mDot::DR6;
+//            // the 869850000 frequency is 100% duty cycle if the total power is under 7 dBm - tx power 4 + antenna gain 3 = 7
+//            tx_power = 4;
+//            break;
+//        case mDot::FB_US915:
+//        case mDot::FB_AU915:
+//        default:
+//            // 500kHz channels achieve highest throughput
+//            // DR8 : SF12 @ 500kHz
+//            // DR9 : SF11 @ 500kHz
+//            // DR10 : SF10 @ 500kHz
+//            // DR11 : SF9 @ 500kHz
+//            // DR12 : SF8 @ 500kHz
+//            // DR13 : SF7 @ 500kHz
+//            // DR0 - DR3 (125kHz channels) available but much slower
+//            tx_frequency = 915500000;
+//            tx_datarate = mDot::DR13;
+//            // 915 bands have no duty cycle restrictions, set tx power to max
+//            tx_power = 20;
+//            break;
+//    }
     update_peer_to_peer_config(pair_network_address, pair_network_session_key, pair_data_session_key, tx_frequency, tx_datarate, tx_power);
     dot->saveConfig(); // This is required for network settings to apply
     return cmdSuccess;
@@ -537,9 +537,9 @@
     myLogInfo("version ------------------ %s", dot->getId().c_str());
     myLogInfo("device ID/EUI ------------ %s", mts::Text::bin2hexString(dot->getDeviceId()).c_str());
     myLogInfo("frequency band ----------- %s", mDot::FrequencyBandStr(dot->getFrequencyBand()).c_str());
-    if (dot->getFrequencySubBand() != mDot::FB_EU868) {
-        myLogInfo("frequency sub band ------- %u", dot->getFrequencySubBand());
-    }
+//    if (dot->getFrequencySubBand() != mDot::FB_EU868) {
+//        myLogInfo("frequency sub band ------- %u", dot->getFrequencySubBand());
+//    }
     myLogInfo("public network ----------- %s", dot->getPublicNetwork() ? "on" : "off");
     myLogInfo("=========================");
     myLogInfo("credentials configuration");
--- a/xDotBridge/src/dot_util.cpp	Wed Nov 15 00:25:42 2017 +0000
+++ b/xDotBridge/src/dot_util.cpp	Thu Nov 16 20:59:24 2017 +0000
@@ -20,9 +20,9 @@
     logInfo("version ------------------ %s", dot->getId().c_str());
     logInfo("device ID/EUI ------------ %s", mts::Text::bin2hexString(dot->getDeviceId()).c_str());
     logInfo("frequency band ----------- %s", mDot::FrequencyBandStr(dot->getFrequencyBand()).c_str());
-    if (dot->getFrequencySubBand() != mDot::FB_EU868) {
-        logInfo("frequency sub band ------- %u", dot->getFrequencySubBand());
-    }
+//    if (dot->getFrequencySubBand() != mDot::FB_EU868) {
+//        logInfo("frequency sub band ------- %u", dot->getFrequencySubBand());
+//    }
     logInfo("public network ----------- %s", dot->getPublicNetwork() ? "on" : "off");
     logInfo("=========================");
     logInfo("credentials configuration");
--- a/xDotBridge/src/main.cpp	Wed Nov 15 00:25:42 2017 +0000
+++ b/xDotBridge/src/main.cpp	Thu Nov 16 20:59:24 2017 +0000
@@ -1,3 +1,4 @@
+#include "mbed.h"
 #include <math.h>
 #include "config.h"
 #include "xdot_flash.h"
@@ -7,6 +8,7 @@
 #include "WinbondSPIFlash.h"
 #include "UserInterface.h"
 //#include <xdot_low_power.h>
+#include "ChannelPlans.h"
 #include "mDot.h"
 #include "MyLog.h"
 #include "SimpleRxSeqLog.h"
@@ -116,7 +118,13 @@
     mts::MTSLog::setLogLevel(mts::MTSLog::TRACE_LEVEL);
     MyLog::setLogLevel(MyLog::DEBUG_LEVEL);
 
-    dot = mDot::getInstance();
+	// use US915 plan
+    lora::ChannelPlan* plan = new lora::ChannelPlan_US915();
+    // use EU868 plan
+    // lora::ChannelPlan* plan = new lora::ChannelPlan_EU868();
+    assert(plan);
+    
+    dot = mDot::getInstance(plan);
 
     // make sure library logging is turned on
     dot->setLogLevel(mts::MTSLog::WARNING_LEVEL);