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
To change channel plans replace AS923 with AU915, EU868, KR920 or US915 on line 15
#define CHANNEL_PLAN CP_AS923
Diff: CommandTerminal/CmdSerialBaudRate.cpp
- Revision:
- 14:e80ace5a6834
- Parent:
- 9:ff62b20f7000
diff -r 27f308724cc4 -r e80ace5a6834 CommandTerminal/CmdSerialBaudRate.cpp
--- a/CommandTerminal/CmdSerialBaudRate.cpp Mon Aug 29 14:06:16 2016 +0000
+++ b/CommandTerminal/CmdSerialBaudRate.cpp Mon Aug 29 10:05:41 2016 -0500
@@ -1,10 +1,8 @@
#include "CmdSerialBaudRate.h"
-CmdSerialBaudRate::CmdSerialBaudRate(mDot* dot, mts::MTSSerial& serial) :
- Command(dot, "Serial Baud Rate", "AT+IPR", "Set serial baud rate, default: 115200 "), _serial(serial)
+CmdSerialBaudRate::CmdSerialBaudRate() :
+ Command("Serial Baud Rate", "AT+IPR", "Set serial baud rate, default: 115200 ", "(1200,2400,4800,9600,19200,38400,57600,115200,230400,460800,921600)")
{
- _help = std::string(text()) + ": " + std::string(desc());
- _usage = "(1200,2400,4800,9600,19200,38400,57600,115200,230400,460800,921600)";
_queryable = true;
}
@@ -12,23 +10,20 @@
{
if (args.size() == 1)
{
- if (_dot->getVerbose())
- _serial.writef("Serial Baud Rate: ");
-
- _serial.writef("%lu\r\n", _dot->getBaud());
+ CommandTerminal::Serial()->writef("%lu\r\n", CommandTerminal::Dot()->getBaud());
}
else if (args.size() == 2)
{
- int32_t code;
+
int baudrate = 0;
sscanf(args[1].c_str(), "%d", &baudrate);
- if ((code = _dot->setBaud(baudrate)) == mDot::MDOT_OK) {
- _serial.writef("Set Serial Baud Rate: %lu\r\n", baudrate);
+ if (CommandTerminal::Dot()->setBaud(baudrate) == mDot::MDOT_OK) {
+ CommandTerminal::Serial()->writef("Set Serial Baud Rate: %lu\r\n", baudrate);
} else {
- setErrorMessage(_dot->getLastError());;
+ CommandTerminal::setErrorMessage(CommandTerminal::Dot()->getLastError());;
return 1;
}
}
@@ -45,13 +40,13 @@
int baudrate;
if (sscanf(args[1].c_str(), "%d", &baudrate) != 1) {
- setErrorMessage("Invalid argument");
+ CommandTerminal::setErrorMessage("Invalid argument");
return false;
}
return true;
}
- setErrorMessage("Invalid arguments");
+ CommandTerminal::setErrorMessage("Invalid arguments");
return false;
}
