![]() |
Erriez Serial Terminal library for Arduino
1.1.2
This is a Serial Terminal library for Arduino.
|
SerialTerminal class. More...
#include <ErriezSerialTerminal.h>
Public Member Functions | |
SerialTerminal (char newlineChar='\n', char delimiterChar=' ') | |
SerialTerminal constructor. More... | |
void | addCommand (const char *command, void(*function)()) |
Add command with callback handler. More... | |
void | setDefaultHandler (void(*function)(const char *)) |
Set default callback handler for unknown commands. More... | |
void | readSerial () |
Read from serial port. More... | |
void | clearBuffer () |
Clear serial receive buffer. | |
char * | getNext () |
Get next argument. More... | |
char * | getRemaining () |
Get all remaining characters from serial buffer. More... | |
SerialTerminal class.
Definition at line 52 of file ErriezSerialTerminal.h.
|
explicit |
SerialTerminal constructor.
newlineChar | Newline character '\r' or '\n' . Default: '\n' . |
delimiterChar | Delimiter separator character between commands and arguments. Default: space. |
Definition at line 44 of file ErriezSerialTerminal.cpp.
void SerialTerminal::addCommand | ( | const char * | command, |
void(*)() | function | ||
) |
Add command with callback handler.
command | Register a null-terminated ASCII command. |
function | The function to be called when receiving the command . |
Definition at line 66 of file ErriezSerialTerminal.cpp.
char * SerialTerminal::getNext | ( | ) |
Get next argument.
Definition at line 154 of file ErriezSerialTerminal.cpp.
char * SerialTerminal::getRemaining | ( | ) |
Get all remaining characters from serial buffer.
Definition at line 165 of file ErriezSerialTerminal.cpp.
void SerialTerminal::readSerial | ( | ) |
Read from serial port.
Process command when newline character has been received.
Definition at line 98 of file ErriezSerialTerminal.cpp.
void SerialTerminal::setDefaultHandler | ( | void(*)(const char *) | function | ) |
Set default callback handler for unknown commands.
Store default callback handler which will be called when receiving an unknown command.
function | Address of the default handler. This function will be called when the command is not recognized. The parameter contains the first ASCII command. |
Definition at line 88 of file ErriezSerialTerminal.cpp.