![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
AT terminal for the mDot using the USB debug port instead of the serial port.
Dependencies: MTS-Serial libmDot-mbed5
Fork of Dot-AT-Firmware by
CommandTerminal/CmdWakePin.cpp
- Committer:
- pferland
- Date:
- 2018-03-02
- Revision:
- 18:f5d28d621bb0
- Parent:
- 14:f9a77400b622
File content as of revision 18:f5d28d621bb0:
#include "CmdWakePin.h" CmdWakePin::CmdWakePin() #if defined(TARGET_MTS_MDOT_F411RE) : Command("Wake Pin", "AT+WP", "Wakeup DIO pin of sleep mode (1-8) (default: DI8, 1:DIN), deep-sleep uses DIO7", "(1-8)") #else : Command("Wake Pin", "AT+WP", "Wakeup GPIO pin of sleep mode (1-6) (default: WAKE, 1:UART1_RX), deep-sleep uses WAKE", "(1-6)") #endif /* TARGET_MTS_MDOT_F411RE */ { _queryable = true; } uint32_t CmdWakePin::action(std::vector<std::string> args) { if (args.size() == 1) { CommandTerminal::Serial()->writef("%s\r\n", mDot::pinName2Str(CommandTerminal::Dot()->getWakePin()).c_str()); } else if (args.size() == 2) { int pin; sscanf(args[1].c_str(), "%d", &pin); CommandTerminal::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) { int pin; if (sscanf(args[1].c_str(), "%d", &pin) != 1) { CommandTerminal::setErrorMessage("Invalid argument"); return false; } #if defined(TARGET_MTS_MDOT_F411RE) if (pin < 1 || pin > 8) { CommandTerminal::setErrorMessage("Invalid pin, expects (1-8)"); #else if (pin < 1 || pin > 6) { CommandTerminal::setErrorMessage("Invalid pin, expects (1-6)"); #endif /* TARGET_MTS_MDOT_F411RE */ return false; } return true; } CommandTerminal::setErrorMessage("Invalid arguments"); return false; }