Thanh Nguyen
/
Alarm3Sensors_240220
no
Diff: examples/src/class_c_example.cpp
- Revision:
- 21:09d05faf0e13
- Parent:
- 17:d4f82e16de5f
- Child:
- 22:d9bc10bbc433
diff -r 9ea0f3385ab3 -r 09d05faf0e13 examples/src/class_c_example.cpp --- a/examples/src/class_c_example.cpp Tue May 16 10:47:10 2017 -0500 +++ b/examples/src/class_c_example.cpp Fri Jun 09 08:31:21 2017 -0500 @@ -29,8 +29,10 @@ static uint8_t frequency_sub_band = 0; static bool public_network = false; static uint8_t ack = 1; +static bool adr = true; mDot* dot = NULL; +lora::ChannelPlan* plan = NULL; Serial pc(USBTX, USBRX); @@ -49,7 +51,23 @@ mts::MTSLog::setLogLevel(mts::MTSLog::TRACE_LEVEL); - dot = mDot::getInstance(); +#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(); +#endif + assert(plan); + + dot = mDot::getInstance(plan); + assert(dot); logInfo("mbed-os library version: %d", MBED_LIBRARY_VERSION); @@ -86,6 +104,9 @@ if (dot->setClass("C") != mDot::MDOT_OK) { logError("failed to set network mode to class C"); } + + // enable or disable Adaptive Data Rate + dot->setAdr(adr); // save changes to configuration logInfo("saving configuration");