fp
Dependencies: libmDot-mbed5 ISL29011
Diff: examples/src/manual_example.cpp
- Revision:
- 21:09d05faf0e13
- Parent:
- 17:d4f82e16de5f
- Child:
- 22:d9bc10bbc433
diff -r 9ea0f3385ab3 -r 09d05faf0e13 examples/src/manual_example.cpp --- a/examples/src/manual_example.cpp Tue May 16 10:47:10 2017 -0500 +++ b/examples/src/manual_example.cpp Fri Jun 09 08:31:21 2017 -0500 @@ -26,6 +26,7 @@ static uint8_t frequency_sub_band = 6; static bool public_network = false; static uint8_t ack = 1; +static bool adr = true; // deepsleep consumes slightly less current than sleep // in sleep mode, IO state is maintained, RAM is retained, and application will resume after waking up @@ -34,6 +35,7 @@ static bool deep_sleep = true; mDot* dot = NULL; +lora::ChannelPlan* plan = NULL; Serial pc(USBTX, USBRX); @@ -52,7 +54,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); // attach the custom events handler dot->setEvents(&events); @@ -88,6 +106,9 @@ // to provision your Dot with a 3rd party gateway, see the gateway or network provider documentation update_manual_config(network_address, network_session_key, data_session_key, frequency_sub_band, public_network, ack); + // enable or disable Adaptive Data Rate + dot->setAdr(adr); + // save changes to configuration logInfo("saving configuration"); if (!dot->saveConfig()) {