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
CommandTerminal/CmdWakePin.cpp
- Committer:
- Mike Fiore
- Date:
- 2015-08-18
- Revision:
- 4:666017851052
- Child:
- 9:ff62b20f7000
File content as of revision 4:666017851052:
#include "CmdWakePin.h"
CmdWakePin::CmdWakePin(mDot* dot, mts::MTSSerial& serial)
:
Command(dot, "Wake Pin", "AT+WP", "Wakeup DIO pin of sleep mode (default: DI8), deep-sleep uses DIO7"),
_serial(serial) {
_help = std::string(text()) + ": " + std::string(desc());
_usage = "(2-8)";
_queryable = true;
}
uint32_t CmdWakePin::action(std::vector<std::string> args) {
if (args.size() == 1) {
if (_dot->getVerbose())
_serial.writef("%s: ", name());
_serial.writef("%s\r\n", mDot::pinName2Str(_dot->getWakePin()).c_str());
} else if (args.size() == 2) {
int32_t code;
uint32_t pin;
sscanf(args[1].c_str(), "%lu", &pin);
_dot->setWakePin(mDot::pinNum2Name(pin));
}
return 0;
}
bool CmdWakePin::verify(std::vector<std::string> args) {
if (args.size() == 1)
return true;
if (args.size() == 2) {
uint32_t pin;
if (sscanf(args[1].c_str(), "%lu", &pin) != 1) {
setErrorMessage("Invalid argument");
return false;
}
if (pin < 2 || pin > 8) {
setErrorMessage("Invalid pin, expects (2-8)");
return false;
}
return true;
}
setErrorMessage("Invalid arguments");
return false;
}
