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 mbed-rtos mbed
Fork of mDot_USB_AT_firmware by
CmdRxInverted.cpp
00001 #include "CmdRxInverted.h" 00002 00003 CmdRxInverted::CmdRxInverted(mDot* dot, mts::MTSSerial& serial) : 00004 Command(dot, "Set Rx inverted", "AT+RXI", "Set Rx signal inverted, (default:on)"), _serial(serial) 00005 { 00006 _help = std::string(text()) + ": " + std::string(desc()); 00007 _usage = "(0,1)"; 00008 _queryable = true; 00009 } 00010 00011 uint32_t CmdRxInverted::action(std::vector<std::string> args) 00012 { 00013 if (args.size() == 1) 00014 { 00015 if (_dot->getVerbose()) 00016 _serial.writef("Rx Inverted: "); 00017 00018 _serial.writef("%d\r\n", _dot->getRxInverted()); 00019 } 00020 else if (args.size() == 2) 00021 { 00022 int32_t code; 00023 bool invert = args[1] == "1"; 00024 if ((code = _dot->setRxInverted(invert)) != mDot::MDOT_OK) 00025 { 00026 setErrorMessage(_dot->getLastError());; 00027 return 1; 00028 } 00029 } 00030 00031 return 0; 00032 } 00033 00034 bool CmdRxInverted::verify(std::vector<std::string> args) 00035 { 00036 if (args.size() == 1) 00037 return true; 00038 00039 if (args.size() == 2) 00040 { 00041 if (!(args[1] == "0" || args[1] == "1")) { 00042 setErrorMessage("Invalid parameter, expects (0: off, 1: on)"); 00043 return false; 00044 } 00045 00046 return true; 00047 } 00048 00049 setErrorMessage("Invalid arguments"); 00050 return false; 00051 }
Generated on Tue Jul 12 2022 20:37:29 by
1.7.2
