A simple program that connects to University of Queensland's Lora network and requests a joke, then prints the joke to usb serial.
Dependencies: fota-mdot libmDot MTS-Serial
Diff: inc/DebugTerminal.h
- Revision:
- 0:fa546fb96b80
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/inc/DebugTerminal.h Tue Apr 02 05:55:13 2019 +0000 @@ -0,0 +1,39 @@ +/** + * A class that runs a terminal to help debug the program. It handles storing + * received characters in a buffer until a command is read and executing that + * command. + * Usage: + * mts::DebugTerminal* term = new mts::DebugTerminal(dot, UART_TX, UART_RX); + * term->baud(115200); + * term->start(); + */ +#ifndef DEBUG_TERMINAL_H +#define DEBUG_TERMINAL_H + +#include "mDot.h" +#include "MTSSerial.h" +#include "MTSBufferedIO.h" + +namespace mts { + +class DebugTerminal : public MTSSerial { +public: + DebugTerminal(mDot* dot, PinName TXD, PinName RXD, int txBufferSize = 256, + int rxBufferSize = 256); + virtual ~DebugTerminal(); + + // Handle terminal reads in a loop + void start(); + + // Called after the user presses return. + // Parameter is a line without \r or \n + void handleCommand(std::string command); + +protected: + +private: + mDot* dot; +}; + +} // namespace +#endif // Header guard */