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: libmDot-Custom MTS-Serial
Fork of mDot_AT_firmware_CUSTOM by
CmdDebugBaudRate.cpp
00001 #include "CmdDebugBaudRate.h" 00002 00003 CmdDebugBaudRate::CmdDebugBaudRate() : 00004 Command("Debug Baud Rate", "AT+DIPR", "Set debug serial baud rate, default: 115200 ", "(2400,4800,9600,19200,38400,57600,115200,230400,460800,921600)") 00005 { 00006 _queryable = true; 00007 } 00008 00009 uint32_t CmdDebugBaudRate::action(std::vector<std::string> args) 00010 { 00011 if (args.size() == 1) 00012 { 00013 CommandTerminal::Serial()->writef("%lu\r\n", CommandTerminal::Dot()->getDebugBaud()); 00014 } 00015 else if (args.size() == 2) 00016 { 00017 int baudrate = 0; 00018 00019 sscanf(args[1].c_str(), "%d", &baudrate); 00020 00021 if (CommandTerminal::Dot()->setDebugBaud(baudrate) == mDot::MDOT_OK) { 00022 CommandTerminal::Serial()->writef("Set Debug Baud Rate: %d\r\n", baudrate); 00023 } else { 00024 CommandTerminal::setErrorMessage(CommandTerminal::Dot()->getLastError());; 00025 return 1; 00026 } 00027 } 00028 00029 return 0; 00030 } 00031 00032 bool CmdDebugBaudRate::verify(std::vector<std::string> args) 00033 { 00034 if (args.size() == 1) 00035 return true; 00036 00037 if (args.size() == 2) { 00038 int baudrate; 00039 00040 if (sscanf(args[1].c_str(), "%d", &baudrate) != 1) { 00041 CommandTerminal::setErrorMessage("Invalid argument"); 00042 return false; 00043 } 00044 00045 return true; 00046 } 00047 00048 CommandTerminal::setErrorMessage("Invalid arguments"); 00049 return false; 00050 }
Generated on Tue Jul 12 2022 20:42:47 by
1.7.2
