Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: MTS-Serial libmDot-mbed5
Fork of Dot-AT-Firmware by
main.cpp
00001 #include "mbed.h" 00002 #include "mDot.h" 00003 #include "CommandTerminal.h" 00004 #include "ATSerial.h" 00005 #include "ATSerialFlowControl.h" 00006 #include "ChannelPlans.h" 00007 00008 #define SERIAL_BUFFER_SIZE 512 00009 #define USE_USB_SERIAL 00010 00011 Serial debug(USBTX, USBRX); 00012 00013 #ifndef CHANNEL_PLAN 00014 #define CHANNEL_PLAN CP_US915 00015 #endif 00016 00017 #ifndef UNIT_TEST 00018 00019 int main() 00020 { 00021 debug.baud(115200); 00022 00023 #if CHANNEL_PLAN == CP_AS923 00024 lora::ChannelPlan* plan = new lora::ChannelPlan_AS923(); 00025 #elif CHANNEL_PLAN == CP_US915 00026 lora::ChannelPlan* plan = new lora::ChannelPlan_US915(); 00027 #elif CHANNEL_PLAN == CP_AU915 00028 lora::ChannelPlan* plan = new lora::ChannelPlan_AU915(); 00029 #elif CHANNEL_PLAN == CP_EU868 00030 lora::ChannelPlan* plan = new lora::ChannelPlan_EU868(); 00031 #elif CHANNEL_PLAN == CP_KR920 00032 lora::ChannelPlan* plan = new lora::ChannelPlan_KR920(); 00033 #elif CHANNEL_PLAN == CP_IN865 00034 lora::ChannelPlan* plan = new lora::ChannelPlan_IN865(); 00035 #elif CHANNEL_PLAN == CP_AS923_JAPAN 00036 lora::ChannelPlan* plan = new lora::ChannelPlan_AS923_Japan(); 00037 #endif 00038 assert(plan); 00039 00040 mDot* dot = mDot::getInstance(plan); 00041 assert(dot); 00042 00043 // Seed the RNG 00044 srand(dot->getRadioRandom()); 00045 00046 mts::ATSerial* serial; 00047 00048 if (dot->getFlowControl()){ 00049 #if defined(TARGET_MTS_MDOT_F411RE) && defined(USE_USB_SERIAL) 00050 //no flow control available on USB debug port 00051 dot->setFlowControl(false); 00052 serial = new mts::ATSerial(USBTX, USBRX, SERIAL_BUFFER_SIZE, SERIAL_BUFFER_SIZE); 00053 00054 #elif defined(TARGET_MTS_MDOT_F411RE) 00055 serial = new mts::ATSerialFlowControl(XBEE_DOUT, XBEE_DIN, XBEE_RTS, XBEE_CTS, SERIAL_BUFFER_SIZE, SERIAL_BUFFER_SIZE); 00056 #else 00057 serial = new mts::ATSerialFlowControl(UART1_TX, UART1_RX, UART1_RTS, UART1_CTS, SERIAL_BUFFER_SIZE, SERIAL_BUFFER_SIZE); 00058 #endif 00059 } else { 00060 #if defined(TARGET_MTS_MDOT_F411RE) && defined(USE_USB_SERIAL) 00061 serial = new mts::ATSerial(USBTX, USBRX, SERIAL_BUFFER_SIZE, SERIAL_BUFFER_SIZE); 00062 00063 #elif defined(TARGET_MTS_MDOT_F411RE) 00064 serial = new mts::ATSerial(XBEE_DOUT, XBEE_DIN, SERIAL_BUFFER_SIZE, SERIAL_BUFFER_SIZE); 00065 #else 00066 serial = new mts::ATSerial(UART1_TX, UART1_RX, SERIAL_BUFFER_SIZE, SERIAL_BUFFER_SIZE); 00067 #endif 00068 } 00069 00070 debug.baud(dot->getDebugBaud()); 00071 serial->baud(dot->getBaud()); 00072 00073 CommandTerminal term(*serial); 00074 CommandTerminal::_dot = dot; 00075 00076 term.init(); 00077 00078 term.start(); 00079 } 00080 00081 #endif // UNIT_TEST 00082
Generated on Tue Jul 12 2022 19:03:18 by
1.7.2
